Esempio n. 1
0
        private void UpdateCellSettings()
        {
            KryptonWorkspaceCell cell = FloatspaceControl.FirstVisibleCell();

            if (cell != null)
            {
                // If there is only a single cell inside the floating window
                if (FloatspaceControl.CellVisibleCount <= 1)
                {
                    // Cell display mode depends on the number of tabs in the cell
                    cell.NavigatorMode = cell.Pages.VisibleCount == 1 ? NavigatorMode.HeaderGroup : NavigatorMode.HeaderGroupTab;
                }
                else
                {
                    do
                    {
                        // With multiple cells we always need the tabs showing
                        cell.NavigatorMode = NavigatorMode.HeaderGroupTab;
                        cell = FloatspaceControl.NextVisibleCell(cell);
                    }while (cell != null);
                }
            }

            // Only show the floating window if there is a visible cell
            Visible = (FloatspaceControl.CellVisibleCount > 0);
        }
Esempio n. 2
0
 private void OnFloatspaceCellCountChanged(object sender, EventArgs e)
 {
     // When all the cells (and so pages) have been removed we kill ourself
     if (FloatspaceControl.CellCount == 0)
     {
         FloatspaceControl.Dispose();
     }
 }
        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;
        }
Esempio n. 4
0
        /// <summary>
        /// Loads docking configuration information using a provider xml reader.
        /// </summary>
        /// <param name="xmlReader">Xml reader object.</param>
        /// <param name="pages">Collection of available pages for adding.</param>
        public override void LoadElementFromXml(XmlReader xmlReader, KryptonPageCollection pages)
        {
            // Let base class load the pages into the floatspace
            base.LoadElementFromXml(xmlReader, pages);

            // If loading did not create any pages then kill ourself as not needed
            if (FloatspaceControl.PageCount == 0)
            {
                FloatspaceControl.Dispose();
            }
        }
        private IReadOnlyList <string> VisibleCloseableUniqueNames()
        {
            var uniqueNames           = new List <string>();
            KryptonWorkspaceCell cell = FloatspaceControl.FirstVisibleCell();

            while (cell != null)
            {
                // Create a list of all the visible page names in the floatspace that are allowed to be closed
                uniqueNames.AddRange(from page in cell.Pages
                                     where page.LastVisibleSet &&
                                     page.AreFlagsSet(KryptonPageFlags.DockingAllowClose)
                                     select page.UniqueName);

                cell = FloatspaceControl.NextVisibleCell(cell);
            }

            return(uniqueNames);
        }
Esempio n. 6
0
        private string[] VisibleCloseableUniqueNames()
        {
            List <string>        uniqueNames = new List <string>();
            KryptonWorkspaceCell cell        = FloatspaceControl.FirstVisibleCell();

            while (cell != null)
            {
                // Create a list of all the visible page names in the floatspace that are allowed to be closed
                foreach (KryptonPage page in cell.Pages)
                {
                    if (page.LastVisibleSet && page.AreFlagsSet(KryptonPageFlags.DockingAllowClose))
                    {
                        uniqueNames.Add(page.UniqueName);
                    }
                }

                cell = FloatspaceControl.NextVisibleCell(cell);
            }

            return(uniqueNames.ToArray());
        }
Esempio n. 7
0
 private void OnLayoutWorkspace(object sender, EventArgs e)
 {
     FloatspaceControl.PerformNeedPaint(true);
 }