示例#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 -= new EventHandler(OnDockingFloatingWindowDisposed);

            // Remove the elemenet from our child collection as it is no longer valid
            InternalRemove(floatingWindowElement);
        }
        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;
                if (floatingWindow != null)
                {
                    bool?ret = floatingWindow.PropogateBoolState(DockingPropogateBoolState.ContainsStorePage, uniqueName);
                    if (ret.HasValue && 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 += 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);
        }
示例#6
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;
 }