/// <summary>
        /// Initialize a new instance of the KryptonDockingFloatingWindow class.
        /// </summary>
        /// <param name="name">Initial name of the element.</param>
        /// <param name="owner">Reference to form that owns the floating windows.</param>
        /// <param name="floatspace">Reference to form that will own all the floating window.</param>
        /// <param name="useMinimiseBox">Allow window to be minimised.</param>
        public KryptonDockingFloatingWindow(string name, Form owner, KryptonDockingFloatspace floatspace, bool useMinimiseBox)
            : base(name)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }

            FloatspaceElement           = floatspace ?? throw new ArgumentNullException(nameof(floatspace));
            FloatspaceElement.Disposed += OnDockingFloatspaceDisposed;

            // Create the actual window control and hook into events
            FloatingWindow = new KryptonFloatingWindow(owner, floatspace.FloatspaceControl, useMinimiseBox);
            FloatingWindow.WindowCloseClicked    += OnFloatingWindowCloseClicked;
            FloatingWindow.WindowCaptionDragging += OnFloatingWindowCaptionDragging;
            FloatingWindow.Disposed += OnFloatingWindowDisposed;

            // Create and add a control we use to obscure the floating window client area during multi-part operations
            _obscure = new ObscureControl
            {
                Anchor  = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom),
                Visible = false
            };
            FloatingWindow.Controls.Add(_obscure);

            // Add the floatspace as the only child of this collection
            InternalAdd(floatspace);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize a new instance of the KryptonDockingFloatingWindow class.
        /// </summary>
        /// <param name="name">Initial name of the element.</param>
        /// <param name="owner">Reference to form that owns the floating windows.</param>
        /// <param name="floatspace">Reference to form that will own all the floating window.</param>
        public KryptonDockingFloatingWindow(string name, Form owner, KryptonDockingFloatspace floatspace)
            : base(name)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }
            if (floatspace == null)
            {
                throw new ArgumentNullException("floatspace");
            }

            _floatspace           = floatspace;
            _floatspace.Disposed += new EventHandler(OnDockingFloatspaceDisposed);

            // Create the actual window control and hook into events
            _window = new KryptonFloatingWindow(owner, floatspace.FloatspaceControl);
            _window.WindowCloseClicked    += new EventHandler <UniqueNamesEventArgs>(OnFloatingWindowCloseClicked);
            _window.WindowCaptionDragging += new EventHandler <ScreenAndOffsetEventArgs>(OnFloatingWindowCaptionDragging);
            _window.Disposed += new EventHandler(OnFloatingWindowDisposed);

            // Create and add a control we use to obscure the floating window client area during multi-part operations
            _obscure         = new ObscureControl();
            _obscure.Anchor  = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom);
            _obscure.Visible = false;
            _window.Controls.Add(_obscure);

            // Add the floatspace as the only child of this collection
            InternalAdd(floatspace);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initialize a new instance of the DragTargetNull class.
 /// </summary>
 /// <param name="manager">Reference to docking manager.</param>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="pages">Reference to collection of pages to drag.</param>
 public DockingDragTargetProvider(KryptonDockingManager manager,
                                  KryptonFloatingWindow floatingWindow,
                                  KryptonPageCollection pages)
 {
     _manager        = manager;
     _floatingWindow = floatingWindow;
     _pages          = pages;
 }
 /// <summary>
 /// Initialize a new instance of the DragTargetNull class.
 /// </summary>
 /// <param name="manager">Reference to docking manager.</param>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="pages">Reference to collection of pages to drag.</param>
 public DockingDragTargetProvider(KryptonDockingManager manager, 
                                  KryptonFloatingWindow floatingWindow,
                                  KryptonPageCollection pages)
 {
     _manager = manager;
     _floatingWindow = floatingWindow;
     _pages = pages;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Propogates a request for drag targets down the hierarchy of docking elements.
 /// </summary>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="dragData">Set of pages being dragged.</param>
 /// <param name="targets">Collection of drag targets.</param>
 public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                           PageDragEndData dragData,
                                           DragTargetList targets)
 {
     // Can only generate targets for a floating window that is actually visible and not the one being dragged
     if (FloatingWindow.Visible && (floatingWindow != FloatingWindow))
     {
         base.PropogateDragTargets(floatingWindow, dragData, targets);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Propogates a request for drag targets down the hierarchy of docking elements.
 /// </summary>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="dragData">Set of pages being dragged.</param>
 /// <param name="targets">Collection of drag targets.</param>
 public virtual void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                          PageDragEndData dragData,
                                          DragTargetList targets)
 {
     // Propogate the request to all child elements
     foreach (IDockingElement child in this)
     {
         child.PropogateDragTargets(floatingWindow, dragData, targets);
     }
 }
        /// <summary>
        /// Propagates a request for drag targets down the hierarchy of docking elements.
        /// </summary>
        /// <param name="floatingWindow">Reference to window being dragged.</param>
        /// <param name="dragData">Set of pages being dragged.</param>
        /// <param name="targets">Collection of drag targets.</param>
        public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                                  PageDragEndData dragData,
                                                  DragTargetList targets)
        {
            // Create list of the pages that are allowed to be dropped into this workspace
            KryptonPageCollection pages = new KryptonPageCollection();

            foreach (KryptonPage page in dragData.Pages)
            {
                if (page.AreFlagsSet(KryptonPageFlags.DockingAllowWorkspace))
                {
                    pages.Add(page);
                }
            }

            // Do we have any pages left for dragging?
            if (pages.Count > 0)
            {
                DragTargetList workspaceTargets = DockableWorkspaceControl.GenerateDragTargets(new PageDragEndData(this, pages), KryptonPageFlags.DockingAllowWorkspace);
                targets.AddRange(workspaceTargets.ToArray());
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Propogates a request for drag targets down the hierarchy of docking elements.
        /// </summary>
        /// <param name="floatingWindow">Reference to window being dragged.</param>
        /// <param name="dragData">Set of pages being dragged.</param>
        /// <param name="targets">Collection of drag targets.</param>
        public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                                  PageDragEndData dragData,
                                                  DragTargetList targets)
        {
            // Create a list of pages that are allowed to be transferred into a dockspace
            List <KryptonPage> transferPages = new List <KryptonPage>();

            foreach (KryptonPage page in dragData.Pages)
            {
                if (page.AreFlagsSet(KryptonPageFlags.DockingAllowDocked))
                {
                    transferPages.Add(page);
                }
            }

            // Only generate targets if we have some valid pages to transfer
            if (transferPages.Count > 0)
            {
                // Generate targets for the four control edges
                Rectangle   screenRect = Control.RectangleToScreen(Control.ClientRectangle);
                Rectangle[] rectsDraw  = SubdivideRectangle(screenRect, 3, int.MaxValue);
                Rectangle[] rectsHot   = SubdivideRectangle(screenRect, 10, 20);

                // Must insert at start of target list as they are higher priority than cell targets
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[0], rectsDraw[0], DragTargetHint.EdgeLeft | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[1], rectsDraw[1], DragTargetHint.EdgeRight | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[2], rectsDraw[2], DragTargetHint.EdgeTop | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[3], rectsDraw[3], DragTargetHint.EdgeBottom | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));

                // If we have no designated inner element when we have to decide if we can place edge drag drop targets based on the
                // available space at the center of the control after taking into account any edge docked controls already in place.
                if (_innerElement == null)
                {
                    // Find the inner rectangle after taking docked controls into account
                    Size tl = Size.Empty;
                    Size br = Control.ClientSize;
                    foreach (Control c in Control.Controls)
                    {
                        if (c.Visible)
                        {
                            switch (c.Dock)
                            {
                            case DockStyle.Left:
                                tl.Width = Math.Max(tl.Width, c.Right);
                                break;

                            case DockStyle.Right:
                                br.Width = Math.Min(br.Width, c.Left);
                                break;

                            case DockStyle.Top:
                                tl.Height = Math.Max(tl.Height, c.Bottom);
                                break;

                            case DockStyle.Bottom:
                                br.Height = Math.Min(br.Height, c.Top);
                                break;
                            }
                        }
                    }

                    // If there is inner space available
                    Rectangle innerRect = new Rectangle(tl.Width, tl.Height, br.Width - tl.Width, br.Height - tl.Height);
                    if ((innerRect.Width > 0) && (innerRect.Height > 0))
                    {
                        Rectangle   innerScreenRect = Control.RectangleToScreen(innerRect);
                        Rectangle[] innerRectsDraw  = SubdivideRectangle(innerScreenRect, 3, int.MaxValue);
                        Rectangle[] innerRectsHot   = SubdivideRectangle(innerScreenRect, 10, 20);
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[0], innerRectsDraw[0], DragTargetHint.EdgeLeft, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[1], innerRectsDraw[1], DragTargetHint.EdgeRight, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[2], innerRectsDraw[2], DragTargetHint.EdgeTop, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[3], innerRectsDraw[3], DragTargetHint.EdgeBottom, this, KryptonPageFlags.DockingAllowDocked, false));
                    }
                }
                else if (_innerElement is KryptonDockingNavigator)
                {
                    KryptonDockingNavigator dockingNavigator = (KryptonDockingNavigator)_innerElement;

                    // If there is inner space available
                    Rectangle innerScreenRect = dockingNavigator.DockableNavigatorControl.RectangleToScreen(dockingNavigator.DockableNavigatorControl.ClientRectangle);
                    if ((innerScreenRect.Width > 0) && (innerScreenRect.Height > 0))
                    {
                        Rectangle[] innerRectsDraw = SubdivideRectangle(innerScreenRect, 3, int.MaxValue);
                        Rectangle[] innerRectsHot  = SubdivideRectangle(innerScreenRect, 10, 20);
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[0], innerRectsDraw[0], DragTargetHint.EdgeLeft, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[1], innerRectsDraw[1], DragTargetHint.EdgeRight, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[2], innerRectsDraw[2], DragTargetHint.EdgeTop, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[3], innerRectsDraw[3], DragTargetHint.EdgeBottom, this, KryptonPageFlags.DockingAllowDocked, false));
                    }
                }

                // Let base class generate targets for contained elements
                base.PropogateDragTargets(floatingWindow, dragData, targets);
            }
        }
 /// <summary>
 /// Initialize a new instance of the FloatingWindowEventArgs class.
 /// </summary>
 /// <param name="floatingWindow">Reference to floating window instance.</param>
 /// <param name="element">Reference to docking floating winodw element that is managing the floating window.</param>
 public FloatingWindowEventArgs(KryptonFloatingWindow floatingWindow,
                                KryptonDockingFloatingWindow element)
 {
     FloatingWindow        = floatingWindow;
     FloatingWindowElement = element;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Propogates a request for drag targets down the hierarchy of docking elements.
        /// </summary>
        /// <param name="floatingWindow">Reference to window being dragged.</param>
        /// <param name="dragData">Set of pages being dragged.</param>
        /// <param name="targets">Collection of drag targets.</param>
        public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
            PageDragEndData dragData,
            DragTargetList targets)
        {
            if (DockspaceControl.CellVisibleCount > 0)
            {
                // Create list of the pages that are allowed to be dropped into this dockspace
                KryptonPageCollection pages = new KryptonPageCollection();
                foreach (KryptonPage page in dragData.Pages)
                    if (page.AreFlagsSet(KryptonPageFlags.DockingAllowDocked))
                        pages.Add(page);

                // Do we have any pages left for dragging?
                if (pages.Count > 0)
                {
                    DragTargetList dockspaceTargets = DockspaceControl.GenerateDragTargets(new PageDragEndData(this, pages), KryptonPageFlags.DockingAllowDocked);
                    targets.AddRange(dockspaceTargets.ToArray());
                }
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Propogates a request for drag targets down the hierarchy of docking elements.
 /// </summary>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="dragData">Set of pages being dragged.</param>
 /// <param name="targets">Collection of drag targets.</param>
 public virtual void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                          PageDragEndData dragData,
                                          DragTargetList targets)
 {
     // Propogate the request to all child elements
     foreach (IDockingElement child in this)
         child.PropogateDragTargets(floatingWindow, dragData, targets);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initialize a new instance of the FloatingWindowEventArgs class.
 /// </summary>
 /// <param name="floatingWindow">Reference to floating window instance.</param>
 /// <param name="element">Reference to docking floating winodw element that is managing the floating window.</param>
 public FloatingWindowEventArgs(KryptonFloatingWindow floatingWindow,
                                KryptonDockingFloatingWindow element)
 {
     _floatingWindow = floatingWindow;
     _element = element;
 }
 /// <summary>
 /// Propogates a request for drag targets down the hierarchy of docking elements.
 /// </summary>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="dragData">Set of pages being dragged.</param>
 /// <param name="targets">Collection of drag targets.</param>
 public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                           PageDragEndData dragData,
                                           DragTargetList targets)
 {
     // Can only generate targets for a floating window that is actually visible and not the one being dragged
     if (FloatingWindow.Visible && (floatingWindow != FloatingWindow))
         base.PropogateDragTargets(floatingWindow, dragData, targets);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Propogates a request for drag targets down the hierarchy of docking elements.
        /// </summary>
        /// <param name="floatingWindow">Reference to window being dragged.</param>
        /// <param name="dragData">Set of pages being dragged.</param>
        /// <param name="targets">Collection of drag targets.</param>
        public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                                  PageDragEndData dragData,
                                                  DragTargetList targets)
        {
            // Create a list of pages that are allowed to be transferred into a dockspace
            List<KryptonPage> transferPages = new List<KryptonPage>();
            foreach (KryptonPage page in dragData.Pages)
                if (page.AreFlagsSet(KryptonPageFlags.DockingAllowDocked))
                    transferPages.Add(page);

            // Only generate targets if we have some valid pages to transfer
            if (transferPages.Count > 0)
            {
                // Generate targets for the four control edges
                Rectangle screenRect = Control.RectangleToScreen(Control.ClientRectangle);
                Rectangle[] rectsDraw = SubdivideRectangle(screenRect, 3, int.MaxValue);
                Rectangle[] rectsHot = SubdivideRectangle(screenRect, 10, 20);

                // Must insert at start of target list as they are higher priority than cell targets
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[0], rectsDraw[0], DragTargetHint.EdgeLeft | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[1], rectsDraw[1], DragTargetHint.EdgeRight | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[2], rectsDraw[2], DragTargetHint.EdgeTop | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));
                targets.Add(new DragTargetControlEdge(screenRect, rectsHot[3], rectsDraw[3], DragTargetHint.EdgeBottom | DragTargetHint.ExcludeCluster, this, KryptonPageFlags.DockingAllowDocked, true));

                // If we have no designated inner element when we have to decide if we can place edge drag drop targets based on the
                // available space at the center of the control after taking into account any edge docked controls already in place.
                if (_innerElement == null)
                {
                    // Find the inner rectangle after taking docked controls into account
                    Size tl = Size.Empty;
                    Size br = Control.ClientSize;
                    foreach (Control c in Control.Controls)
                        if (c.Visible)
                        {
                            switch (c.Dock)
                            {
                                case DockStyle.Left:
                                    tl.Width = Math.Max(tl.Width, c.Right);
                                    break;
                                case DockStyle.Right:
                                    br.Width = Math.Min(br.Width, c.Left);
                                    break;
                                case DockStyle.Top:
                                    tl.Height = Math.Max(tl.Height, c.Bottom);
                                    break;
                                case DockStyle.Bottom:
                                    br.Height = Math.Min(br.Height, c.Top);
                                    break;
                            }
                        }

                    // If there is inner space available
                    Rectangle innerRect = new Rectangle(tl.Width, tl.Height, br.Width - tl.Width, br.Height - tl.Height);
                    if ((innerRect.Width > 0) && (innerRect.Height > 0))
                    {
                        Rectangle innerScreenRect = Control.RectangleToScreen(innerRect);
                        Rectangle[] innerRectsDraw = SubdivideRectangle(innerScreenRect, 3, int.MaxValue);
                        Rectangle[] innerRectsHot = SubdivideRectangle(innerScreenRect, 10, 20);
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[0], innerRectsDraw[0], DragTargetHint.EdgeLeft, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[1], innerRectsDraw[1], DragTargetHint.EdgeRight, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[2], innerRectsDraw[2], DragTargetHint.EdgeTop, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[3], innerRectsDraw[3], DragTargetHint.EdgeBottom, this, KryptonPageFlags.DockingAllowDocked, false));
                    }
                }
                else if (_innerElement is KryptonDockingNavigator)
                {
                    KryptonDockingNavigator dockingNavigator = (KryptonDockingNavigator)_innerElement;

                    // If there is inner space available
                    Rectangle innerScreenRect = dockingNavigator.DockableNavigatorControl.RectangleToScreen(dockingNavigator.DockableNavigatorControl.ClientRectangle);
                    if ((innerScreenRect.Width > 0) && (innerScreenRect.Height > 0))
                    {
                        Rectangle[] innerRectsDraw = SubdivideRectangle(innerScreenRect, 3, int.MaxValue);
                        Rectangle[] innerRectsHot = SubdivideRectangle(innerScreenRect, 10, 20);
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[0], innerRectsDraw[0], DragTargetHint.EdgeLeft, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[1], innerRectsDraw[1], DragTargetHint.EdgeRight, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[2], innerRectsDraw[2], DragTargetHint.EdgeTop, this, KryptonPageFlags.DockingAllowDocked, false));
                        targets.Add(new DragTargetControlEdge(innerScreenRect, innerRectsHot[3], innerRectsDraw[3], DragTargetHint.EdgeBottom, this, KryptonPageFlags.DockingAllowDocked, false));
                    }
                }

                // Let base class generate targets for contained elements
                base.PropogateDragTargets(floatingWindow, dragData, targets);
            }
        }
        /// <summary>
        /// Initialize a new instance of the KryptonDockingFloatingWindow class.
        /// </summary>
        /// <param name="name">Initial name of the element.</param>
        /// <param name="owner">Reference to form that owns the floating windows.</param>
        /// <param name="floatspace">Reference to form that will own all the floating window.</param>
        public KryptonDockingFloatingWindow(string name, Form owner, KryptonDockingFloatspace floatspace)
            : base(name)
        {
            if (owner == null)      throw new ArgumentNullException("owner");
            if (floatspace == null) throw new ArgumentNullException("floatspace");

            _floatspace = floatspace;
            _floatspace.Disposed += new EventHandler(OnDockingFloatspaceDisposed);

            // Create the actual window control and hook into events
            _window = new KryptonFloatingWindow(owner, floatspace.FloatspaceControl);
            _window.WindowCloseClicked += new EventHandler<UniqueNamesEventArgs>(OnFloatingWindowCloseClicked);
            _window.WindowCaptionDragging += new EventHandler<ScreenAndOffsetEventArgs>(OnFloatingWindowCaptionDragging);
            _window.Disposed += new EventHandler(OnFloatingWindowDisposed);

            // Create and add a control we use to obscure the floating window client area during multi-part operations
            _obscure = new ObscureControl();
            _obscure.Anchor = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom);
            _obscure.Visible = false;
            _window.Controls.Add(_obscure);

            // Add the floatspace as the only child of this collection
            InternalAdd(floatspace);
        }