Inheritance: DockingElementClosedCollection
コード例 #1
0
        private void OnDockingFloatingWindowDisposed(object sender, EventArgs e)
        {
            // Cast to correct type and unhook event handlers so garbage collection can occur
            KryptonDockingFloatingWindow floatingWindowElement = (KryptonDockingFloatingWindow)sender;

            floatingWindowElement.Disposed -= OnDockingFloatingWindowDisposed;

            // Remove the elemenet from our child collection as it is no longer valid
            InternalRemove(floatingWindowElement);
        }
コード例 #2
0
        private void OnFloatspaceBeforePageDrag(object sender, PageDragCancelEventArgs e)
        {
            // Validate the list of names to those that are still present in the floatspace
            List <KryptonPage> pages = new List <KryptonPage>();

            foreach (KryptonPage page in e.Pages)
            {
                if (!(page is KryptonStorePage) && (FloatspaceControl.CellForPage(page) != null))
                {
                    pages.Add(page);
                }
            }

            // Only need to start docking dragging if we have some valid pages
            if (pages.Count != 0)
            {
                KryptonDockingManager dockingManager = DockingManager;
                if (dockingManager != null)
                {
                    // If there is just a single visible cell
                    if (FloatspaceControl.CellVisibleCount == 1)
                    {
                        // And that visible cell has all the pages being dragged
                        KryptonWorkspaceCell cell = FloatspaceControl.FirstVisibleCell();
                        if (cell.Pages.VisibleCount == pages.Count)
                        {
                            // Get the owning floating window element
                            KryptonDockingFloatingWindow window = GetParentType(typeof(KryptonDockingFloatingWindow)) as KryptonDockingFloatingWindow;
                            if (window != null)
                            {
                                // Drag the entire floating window
                                dockingManager.DoDragDrop(e.ScreenPoint, e.ElementOffset, e.Control, window);

                                // Always take over docking
                                e.Cancel = true;
                                return;
                            }
                        }
                    }

                    // Add a placeholder for the cell that contains the dragged page, so the cell is not removed during dragging
                    KryptonWorkspaceCell firstCell = FloatspaceControl.CellForPage(e.Pages[0]);
                    if (firstCell != null)
                    {
                        firstCell.Pages.Add(new KryptonStorePage("TemporaryPage", "Floating"));
                    }

                    // Ask the docking manager for a IDragPageNotify implementation to handle the dragging operation
                    dockingManager.DoDragDrop(e.ScreenPoint, e.ElementOffset, e.Control, e.Pages);
                }
            }

            // Always take over docking
            e.Cancel = true;
        }
コード例 #3
0
 /// <summary>
 /// Perform docking element specific actions for loading a child xml.
 /// </summary>
 /// <param name="xmlReader">Xml reader object.</param>
 /// <param name="pages">Collection of available pages.</param>
 /// <param name="child">Optional reference to existing child docking element.</param>
 protected override void LoadChildDockingElement(XmlReader xmlReader,
                                                 KryptonPageCollection pages,
                                                 IDockingElement child)
 {
     if (child != null)
     {
         child.LoadElementFromXml(xmlReader, pages);
     }
     else
     {
         // Create a new floating window and then reload it
         KryptonDockingFloatingWindow floatingWindow = AddFloatingWindow(xmlReader.GetAttribute("N"));
         floatingWindow.LoadElementFromXml(xmlReader, pages);
     }
 }
コード例 #4
0
        /// <summary>
        /// Return the floating window element that contains a placeholder for the named page.
        /// </summary>
        /// <param name="uniqueName">Unique name for search.</param>
        /// <returns>Reference to KryptonDockingFloatingWindow if placeholder found; otherwise null.</returns>
        public KryptonDockingFloatingWindow FloatingWindowForStorePage(string uniqueName)
        {
            // Search all the child docking elements
            foreach (IDockingElement child in this)
            {
                // Only interested in floating window elements
                KryptonDockingFloatingWindow floatingWindow = child as KryptonDockingFloatingWindow;
                bool?ret = floatingWindow?.PropogateBoolState(DockingPropogateBoolState.ContainsStorePage, uniqueName);
                if (ret != null && ret.Value)
                {
                    return(floatingWindow);
                }
            }

            return(null);
        }
コード例 #5
0
        private KryptonDockingFloatingWindow CreateFloatingWindow(string name)
        {
            // Create a floatspace and floating window for hosting the floatspace
            KryptonDockingFloatspace     floatSpaceElement     = new KryptonDockingFloatspace("Floatspace");
            KryptonDockingFloatingWindow floatingWindowElement = new KryptonDockingFloatingWindow(name, OwnerForm, floatSpaceElement);

            floatingWindowElement.Disposed += OnDockingFloatingWindowDisposed;
            InternalAdd(floatingWindowElement);

            // Events are generated from the parent docking manager
            KryptonDockingManager dockingManager = DockingManager;

            if (dockingManager != null)
            {
                // Generate events so the floating window/dockspace appearance can be customized
                FloatingWindowEventArgs floatingWindowArgs = new FloatingWindowEventArgs(floatingWindowElement.FloatingWindow, floatingWindowElement);
                FloatspaceEventArgs     floatSpaceArgs     = new FloatspaceEventArgs(floatSpaceElement.FloatspaceControl, floatSpaceElement);
                dockingManager.RaiseFloatingWindowAdding(floatingWindowArgs);
                dockingManager.RaiseFloatspaceAdding(floatSpaceArgs);
            }

            return(floatingWindowElement);
        }
コード例 #6
0
        private KryptonDockingFloatingWindow CreateFloatingWindow(string name)
        {
            // Create a floatspace and floating window for hosting the floatspace
            KryptonDockingFloatspace floatSpaceElement = new KryptonDockingFloatspace("Floatspace");
            KryptonDockingFloatingWindow floatingWindowElement = new KryptonDockingFloatingWindow(name, OwnerForm, floatSpaceElement);
            floatingWindowElement.Disposed += new EventHandler(OnDockingFloatingWindowDisposed);
            InternalAdd(floatingWindowElement);

            // Events are generated from the parent docking manager
            KryptonDockingManager dockingManager = DockingManager;
            if (dockingManager != null)
            {
                // Generate events so the floating window/dockspace appearance can be customized
                FloatingWindowEventArgs floatingWindowArgs = new FloatingWindowEventArgs(floatingWindowElement.FloatingWindow, floatingWindowElement);
                FloatspaceEventArgs floatSpaceArgs = new FloatspaceEventArgs(floatSpaceElement.FloatspaceControl, floatSpaceElement);
                dockingManager.RaiseFloatingWindowAdding(floatingWindowArgs);
                dockingManager.RaiseFloatspaceAdding(floatSpaceArgs);
            }

            return floatingWindowElement;
        }
コード例 #7
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;
     FloatingWindowElement = element;
 }
コード例 #8
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;
 }
コード例 #9
0
ファイル: KryptonDockingManager.cs プロジェクト: yp25/Krypton
        /// <summary>
        /// Generate an implementation of the IDragPageNotify class that will be used to handle the drag/drop operation.
        /// </summary>
        /// <param name="screenPoint">Screen point of the mouse for the drag operation.</param>
        /// <param name="elementOffset">Offset from top left of element causing the drag.</param>
        /// <param name="c">Control that started the drag operation.</param>
        /// <param name="window">Reference to floating window element that should be dragged.</param>
        public virtual void DoDragDrop(Point screenPoint, Point elementOffset, Control c, KryptonDockingFloatingWindow window)
        {
            // Cannot drag a null reference
            if (window == null)
                throw new ArgumentNullException("window");

            // Create a list of all the visible pages inside the floating window
            KryptonPageCollection pages = new KryptonPageCollection();
            KryptonWorkspaceCell cell = window.FloatspaceElement.FloatspaceControl.FirstVisibleCell();
            while (cell != null)
            {
                foreach (KryptonPage page in cell.Pages)
                    if (!(page is KryptonStorePage) && page.LastVisibleSet)
                        pages.Add(page);

                cell = window.FloatspaceElement.FloatspaceControl.NextVisibleCell(cell);
            }

            // If it actually has any visible contents to be moved
            if (pages.Count > 0)
            {
                // Create docking specific drag manager for moving the pages around
                DockingDragManager dragManager = new DockingDragManager(this, null);
                dragManager.FloatingWindow = window.FloatingWindow;
                dragManager.FloatingWindowOffset = elementOffset;

                // Set the window location before it is shown otherwise we see a brief flash as it appears at the
                // existing location and then it moves to the correct location based on the screen mouse position
                dragManager.FloatingWindow.Location = new Point(screenPoint.X - elementOffset.X, screenPoint.Y - elementOffset.Y);

                // Add ourself as a source of drag targets and then begin the dragging process
                dragManager.DragTargetProviders.Add(new DockingDragTargetProvider(this, dragManager.FloatingWindow, pages));
                dragManager.DragStart(screenPoint, new PageDragEndData(this, pages));
            }
        }