/// <summary>
        /// Propagates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="value">Integer value associated with the request.</param>
        public override void PropogateAction(DockingPropogateAction action, int value)
        {
            switch (action)
            {
            case DockingPropogateAction.RepositionDockspace:
                // Only processes if it applies to us
                if (value == Order)
                {
                    Control parent = DockspaceControl.Parent;
                    if (parent != null)
                    {
                        // Process all sibling controls starting from end to front of collection
                        int indexInsert = -1;
                        for (int i = parent.Controls.Count - 1; i >= 0; i--)
                        {
                            Control c = parent.Controls[i];

                            // Insert before the last auto hidden panel/slidepanel (this handles the Order=0 case)
                            if ((c is KryptonAutoHiddenPanel) || (c is KryptonAutoHiddenSlidePanel))
                            {
                                indexInsert = i;
                            }

                            // Insert before the 'order' found dockspace separator (this handles the Order>0 cases)
                            if (c is KryptonDockspaceSeparator)
                            {
                                if (value == 1)
                                {
                                    indexInsert = i - 1;
                                    break;
                                }

                                value--;
                            }
                        }

                        // Did we manage to find an insertion point
                        if (indexInsert >= 0)
                        {
                            // Our separator should be one before is in the controls collection
                            int ourIndex = parent.Controls.IndexOf(DockspaceControl);
                            if (ourIndex > 0)
                            {
                                Control separator = parent.Controls[ourIndex - 1];
                                parent.Controls.SetChildIndex(separator, indexInsert);
                            }

                            parent.Controls.SetChildIndex(DockspaceControl, indexInsert);
                        }
                    }
                }
                break;

            default:
                base.PropogateAction(action, value);
                break;
            }
        }
Exemple #2
0
 /// <summary>
 /// Propogates an action request down the hierarchy of docking elements.
 /// </summary>
 /// <param name="action">Action that is requested to be performed.</param>
 /// <param name="value">Integer value associated with the request.</param>
 public virtual void PropogateAction(DockingPropogateAction action, int value)
 {
     // Propogate the action request to all the child elements
     // (use reverse order so if element removes itself we still have a valid loop)
     for (int i = Count - 1; i >= 0; i--)
     {
         this[i].PropogateAction(action, value);
     }
 }
        /// <summary>
        /// Propagates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
            case DockingPropogateAction.StartUpdate:
                // Only the first of several 'StartUpdate' actions needs actioning
                if (_updateCount++ == 0)
                {
                    Control.SuspendLayout();

                    /* Place the obscuring control at the top of the z-order
                     * Control.Controls.SetChildIndex(_obscure, 0);
                     *
                     * // Set obscuring control to take up entire client area and be made visible, this prevents
                     * // the drawing of any control underneath it and so prevents any drawing artifacts being seen
                     * // until the end of all operations resulting from the request action.
                     * _obscure.SetBounds(0, 0, Control.Width, Control.Height);
                     * _obscure.Visible = true;
                     */
                }
                break;

            case DockingPropogateAction.EndUpdate:
                // Only final matching 'EndUpdate' needs to reverse start action
                if ((_updateCount > 0) && (_updateCount-- == 1))
                {
                    // Multi operation might have caused a change in the inner minimum
                    EnforceInnerMinimum();

                    Control.ResumeLayout();

                    //_obscure.Visible = false;
                }
                break;

            case DockingPropogateAction.ShowPages:
            case DockingPropogateAction.ShowAllPages:
                // Let base class perform actual requested actions
                base.PropogateAction(action, uniqueNames);

                // Ensure that showing extra pages does not trespass on the inner minimum
                if ((action == DockingPropogateAction.ShowPages) ||
                    (action == DockingPropogateAction.ShowAllPages))
                {
                    EnforceInnerMinimum();
                }

                break;

            default:
                // Let base class perform actual requested actions
                base.PropogateAction(action, uniqueNames);
                break;
            }
        }
        /// <summary>
        /// Propagates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="pages">Array of pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, KryptonPage[] pages)
        {
            switch (action)
            {
                case DockingPropogateAction.RestorePages:
                    AutoHiddenGroupControl.RestorePages(pages);
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, pages);
        }
        /// <summary>
        /// Propagates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
            case DockingPropogateAction.ShowAllPages:
            case DockingPropogateAction.HideAllPages:
            case DockingPropogateAction.RemoveAllPages:
            case DockingPropogateAction.RemoveAndDisposeAllPages:
                // Ignore some global actions
                break;

            default:
                base.PropogateAction(action, uniqueNames);
                break;
            }
        }
Exemple #6
0
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="pages">Array of pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, KryptonPage[] pages)
        {
            switch (action)
            {
            case DockingPropogateAction.RestorePages:
                // Ask the sliding panel to remove its display if an incoming name matches
                foreach (KryptonPage page in pages)
                {
                    _slidePanel.HideUniqueName(page.UniqueName);
                }
                break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, pages);
        }
Exemple #7
0
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="pages">Array of pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, KryptonPage[] pages)
        {
            switch (action)
            {
            case DockingPropogateAction.RestorePages:
                foreach (KryptonPage page in pages)
                {
                    // Swap pages that are placeholders for the actual pages
                    KryptonPage storePage = SpaceControl.PageForUniqueName(page.UniqueName);
                    if (storePage is KryptonStorePage)
                    {
                        KryptonWorkspaceCell cell = SpaceControl.CellForPage(storePage);
                        cell.Pages.Insert(cell.Pages.IndexOf(storePage), page);
                    }
                }
                break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, pages);
        }
        /// <summary>
        /// Propagates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
            case DockingPropogateAction.HidePages:
            case DockingPropogateAction.RemovePages:
            case DockingPropogateAction.RemoveAndDisposePages:
            case DockingPropogateAction.StorePages:
                // Ask the sliding panel to remove its display if an incoming name matches
                foreach (var uniqueName in uniqueNames)
                {
                    _slidePanel.HideUniqueName(uniqueName);
                }

                break;

            case DockingPropogateAction.Loading:
            case DockingPropogateAction.HideAllPages:
            case DockingPropogateAction.RemoveAllPages:
            case DockingPropogateAction.RemoveAndDisposeAllPages:
            case DockingPropogateAction.StoreAllPages:
                // Remove any slide out page
                _slidePanel.HideUniqueName();
                break;

            case DockingPropogateAction.StringChanged:
                // Pushed changed strings to the tooltips
                KryptonDockingManager dockingManager = DockingManager;
                if (dockingManager?.Strings != null)
                {
                    _slidePanel.DockspaceControl.PinTooltip      = dockingManager.Strings.TextDock;
                    _slidePanel.DockspaceControl.CloseTooltip    = dockingManager.Strings.TextClose;
                    _slidePanel.DockspaceControl.DropDownTooltip = dockingManager.Strings.TextWindowLocation;
                }
                break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, uniqueNames);
        }
Exemple #9
0
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
            case DockingPropogateAction.StartUpdate:
                // Only the first of several 'StartUpdate' actions needs actioning
                if (_updateCount++ == 0)
                {
                    // Do not layout the floatspace until all changes have been made
                    FloatingWindow.FloatspaceControl.SuspendWorkspaceLayout();

                    // Place the obscuring control at the top of the z-order
                    FloatingWindow.Controls.SetChildIndex(_obscure, 0);

                    // Set obscuring control to take up entire client area and be made visible, this prevents
                    // the drawing of any control underneath it and so prevents any drawing artifacts being seen
                    // until the end of all operations resulting from the request action.
                    _obscure.SetBounds(0, 0, FloatingWindow.ClientSize.Width, FloatingWindow.ClientSize.Height);
                    _obscure.Visible = true;
                }
                break;

            case DockingPropogateAction.EndUpdate:
                // Only final matching 'EndUpdate' needs to reverse start action
                if ((_updateCount > 0) && (_updateCount-- == 1))
                {
                    FloatingWindow.FloatspaceControl.ResumeWorkspaceLayout();
                    _obscure.Visible = false;
                }
                break;

            default:
                // Let base class perform actual requested actions
                base.PropogateAction(action, uniqueNames);
                break;
            }
        }
        /// <summary>
        /// Propagates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
                case DockingPropogateAction.ShowPages:
                case DockingPropogateAction.HidePages:
                    {
                        bool newVisible = (action == DockingPropogateAction.ShowPages);
                        // Update visible state of pages that are not placeholders
                        foreach (KryptonPage page in uniqueNames
                            .Select(uniqueName => AutoHiddenGroupControl.Pages[uniqueName])
                            .Where(page => (page != null) && !(page is KryptonStorePage))
                        )
                        {
                            page.Visible = newVisible;
                        }
                    }
                    break;
                case DockingPropogateAction.ShowAllPages:
                    AutoHiddenGroupControl.ShowAllPages(typeof(KryptonStorePage));
                    break;
                case DockingPropogateAction.HideAllPages:
                    AutoHiddenGroupControl.HideAllPages(typeof(KryptonStorePage));
                    break;
                case DockingPropogateAction.RemovePages:
                case DockingPropogateAction.RemoveAndDisposePages:
                    // Only remove the actual page and not placeholders
                    foreach (KryptonPage page in uniqueNames
                        .Select(uniqueName => AutoHiddenGroupControl.Pages[uniqueName])
                        .Where(page => (page != null) && !(page is KryptonStorePage))
                    )
                    {
                        AutoHiddenGroupControl.Pages.Remove(page);

                        if (action == DockingPropogateAction.RemoveAndDisposePages)
                        {
                            page.Dispose();
                        }
                    }
                    break;
                case DockingPropogateAction.Loading:
                    // Remove all pages including store pages
                    AutoHiddenGroupControl.Pages.Clear();
                    break;
                case DockingPropogateAction.RemoveAllPages:
                case DockingPropogateAction.RemoveAndDisposeAllPages:
                    for (int i = AutoHiddenGroupControl.Pages.Count - 1; i >= 0; i--)
                    {
                        // Only remove the actual page and not placeholders
                        KryptonPage page = AutoHiddenGroupControl.Pages[i];
                        if ((page != null) && !(page is KryptonStorePage))
                        {
                            AutoHiddenGroupControl.Pages.RemoveAt(i);

                            if (action == DockingPropogateAction.RemoveAndDisposeAllPages)
                            {
                                page.Dispose();
                            }
                        }
                    }
                    break;
                case DockingPropogateAction.StorePages:
                    AutoHiddenGroupControl.StorePages(uniqueNames);
                    break;
                case DockingPropogateAction.StoreAllPages:
                    AutoHiddenGroupControl.StoreAllPages();
                    break;
                case DockingPropogateAction.ClearAutoHiddenStoredPages:
                case DockingPropogateAction.ClearStoredPages:
                    foreach (string uniqueName in uniqueNames)
                    {
                        // Only remove a matching placeholder page
                        KryptonPage page = AutoHiddenGroupControl.Pages[uniqueName];
                        if (page is KryptonStorePage)
                        {
                            AutoHiddenGroupControl.Pages.Remove(page);
                        }
                    }
                    break;
                case DockingPropogateAction.ClearAllStoredPages:
                    for (int i = AutoHiddenGroupControl.Pages.Count - 1; i >= 0; i--)
                    {
                        // Only remove a placeholder paged
                        KryptonPage page = AutoHiddenGroupControl.Pages[i];
                        if (page is KryptonStorePage)
                        {
                            AutoHiddenGroupControl.Pages.RemoveAt(i);
                        }
                    }
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, uniqueNames);
        }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
                case DockingPropogateAction.StartUpdate:
                    // Only the first of several 'StartUpdate' actions needs actioning
                    if (_updateCount++ == 0)
                    {
                        // Do not layout the floatspace until all changes have been made
                        FloatingWindow.FloatspaceControl.SuspendWorkspaceLayout();

                        // Place the obscuring control at the top of the z-order
                        FloatingWindow.Controls.SetChildIndex(_obscure, 0);

                        // Set obscuring control to take up entire client area and be made visible, this prevents
                        // the drawing of any control underneath it and so prevents any drawing artifacts being seen
                        // until the end of all operations resulting from the request action.
                        _obscure.SetBounds(0, 0, FloatingWindow.ClientSize.Width, FloatingWindow.ClientSize.Height);
                        _obscure.Visible = true;
                    }
                    break;
                case DockingPropogateAction.EndUpdate:
                    // Only final matching 'EndUpdate' needs to reverse start action
                    if ((_updateCount > 0) && (_updateCount-- == 1))
                    {
                        FloatingWindow.FloatspaceControl.ResumeWorkspaceLayout();
                        _obscure.Visible = false;
                    }
                    break;
                default:
                    // Let base class perform actual requested actions
                    base.PropogateAction(action, uniqueNames);
                    break;
            }
        }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="pages">Array of pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, KryptonPage[] pages)
        {
            switch (action)
            {
                case DockingPropogateAction.RestorePages:
                    AutoHiddenGroupControl.RestorePages(pages);
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, pages);
        }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
                case DockingPropogateAction.Loading:
                    // Force layout so that the correct number of pages is recognized
                    SpaceControl.PerformLayout();

                    // Remove all the pages including store pages
                    SpaceControl.ClearAllPages();

                    // Force layout so that the control will kill itself
                    SpaceControl.PerformLayout();
                    break;
                case DockingPropogateAction.ShowPages:
                case DockingPropogateAction.HidePages:
                    {
                        bool newVisible = (action == DockingPropogateAction.ShowPages);
                        foreach (string uniqueName in uniqueNames)
                        {
                            // Update visible state of pages that are not placeholders
                            KryptonPage page = SpaceControl.PageForUniqueName(uniqueName);
                            if ((page != null) && !(page is KryptonStorePage))
                                page.Visible = newVisible;
                        }
                    }
                    break;
                case DockingPropogateAction.ShowAllPages:
                    SpaceControl.ShowAllPages(typeof(KryptonStorePage));
                    break;
                case DockingPropogateAction.HideAllPages:
                    SpaceControl.HideAllPages(typeof(KryptonStorePage));
                    break;
                case DockingPropogateAction.RemovePages:
                case DockingPropogateAction.RemoveAndDisposePages:
                    foreach (string uniqueName in uniqueNames)
                    {
                        // If the named page exists and is not placeholder then remove it
                        KryptonPage removePage = SpaceControl.PageForUniqueName(uniqueName);
                        if ((removePage != null) && !(removePage is KryptonStorePage))
                        {
                            // Find the cell that contains the target so we can remove the page
                            KryptonWorkspaceCell cell = SpaceControl.CellForPage(removePage);
                            if (cell != null)
                            {
                                cell.Pages.Remove(removePage);

                                if (action == DockingPropogateAction.RemoveAndDisposePages)
                                    removePage.Dispose();
                            }
                        }
                    }
                    break;
                case DockingPropogateAction.RemoveAllPages:
                case DockingPropogateAction.RemoveAndDisposeAllPages:
                    {
                        // Process each cell in turn
                        KryptonWorkspaceCell cell = SpaceControl.FirstCell();
                        while (cell != null)
                        {
                            // Process each page inside the cell
                            for (int i = cell.Pages.Count - 1; i >= 0; i--)
                            {
                                // Only remove the actual page and not placeholders
                                KryptonPage page = cell.Pages[i];
                                if ((page != null) && !(page is KryptonStorePage))
                                {
                                    cell.Pages.RemoveAt(i);

                                    if (action == DockingPropogateAction.RemoveAndDisposeAllPages)
                                        page.Dispose();
                                }
                            }

                            cell = SpaceControl.NextCell(cell);
                        }

                        // Force layout so that the control will kill itself
                        SpaceControl.PerformLayout();
                    }
                    break;
                case DockingPropogateAction.StorePages:
                    foreach (string uniqueName in uniqueNames)
                    {
                        // Swap pages that are not placeholders to become placeholders
                        KryptonPage page = SpaceControl.PageForUniqueName(uniqueName);
                        if ((page != null) && !(page is KryptonStorePage))
                        {
                            // Replace the existing page with a placeholder that has the same unique name
                            KryptonWorkspaceCell cell = SpaceControl.CellForPage(page);
                            KryptonStorePage placeholder = new KryptonStorePage(uniqueName, _storeName);
                            cell.Pages.Insert(cell.Pages.IndexOf(page), placeholder);
                            cell.Pages.Remove(page);
                        }
                    }
                    break;
                case DockingPropogateAction.StoreAllPages:
                    {
                        // Process each cell in turn
                        KryptonWorkspaceCell cell = SpaceControl.FirstCell();
                        while (cell != null)
                        {
                            // Process each page inside the cell
                            for (int i = cell.Pages.Count - 1; i >= 0; i--)
                            {
                                // Swap pages that are not placeholders to become placeholders
                                KryptonPage page = cell.Pages[i];
                                if ((page != null) && !(page is KryptonStorePage))
                                {
                                    // Replace the existing page with a placeholder that has the same unique name
                                    KryptonStorePage placeholder = new KryptonStorePage(page.UniqueName, _storeName);
                                    cell.Pages.Insert(cell.Pages.IndexOf(page), placeholder);
                                    cell.Pages.Remove(page);
                                }
                            }

                            cell = SpaceControl.NextCell(cell);
                        }
                    }
                    break;
                case DockingPropogateAction.ClearFillerStoredPages:
                case DockingPropogateAction.ClearFloatingStoredPages:
                case DockingPropogateAction.ClearDockedStoredPages:
                case DockingPropogateAction.ClearStoredPages:
                    // Only process an attempt to clear all pages or those related to this docking location
                    if ((action == DockingPropogateAction.ClearStoredPages) || (action == ClearStoreAction))
                    {
                        foreach (string uniqueName in uniqueNames)
                        {
                            // Only remove a matching unique name if it is a placeholder page
                            KryptonPage removePage = SpaceControl.PageForUniqueName(uniqueName);
                            if ((removePage != null) && (removePage is KryptonStorePage))
                            {
                                // Check if the page is one marked to be ignored in this operation
                                if (removePage != IgnoreStorePage)
                                {
                                    // Find the cell that contains the target so we can remove the page
                                    KryptonWorkspaceCell cell = SpaceControl.CellForPage(removePage);
                                    if (cell != null)
                                        cell.Pages.Remove(removePage);
                                }
                            }
                        }
                    }
                    break;
                case DockingPropogateAction.ClearAllStoredPages:
                    {
                        // Process each cell in turn
                        KryptonWorkspaceCell cell = SpaceControl.FirstCell();
                        while (cell != null)
                        {
                            // Process each page inside the cell
                            for (int i = cell.Pages.Count - 1; i >= 0; i--)
                            {
                                // Remove all placeholders
                                KryptonPage page = cell.Pages[i];
                                if ((page != null) && (page is KryptonStorePage))
                                    cell.Pages.Remove(page);
                            }

                            cell = SpaceControl.NextCell(cell);
                        }
                    }
                    break;
                case DockingPropogateAction.StringChanged:
                    UpdateStrings();
                    break;
                case DockingPropogateAction.DebugOutput:
                    Console.WriteLine(SpaceControl.ToString());
                    SpaceControl.DebugOutput();
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, uniqueNames);
        }
Exemple #14
0
        /// <summary>
        /// Propagates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            KryptonPageCollection pageCollection = DockableNavigatorControl.Pages;

            switch (action)
            {
            case DockingPropogateAction.Loading:
                // Remove all pages including store pages
                pageCollection.Clear();
                return;

            case DockingPropogateAction.ShowAllPages:
            case DockingPropogateAction.HideAllPages:
            case DockingPropogateAction.RemoveAllPages:
            case DockingPropogateAction.RemoveAndDisposeAllPages:
                // Ignore some global actions
                return;

            case DockingPropogateAction.StorePages:
                foreach (string uniqueName in uniqueNames)
                {
                    // Swap pages that are not placeholders to become placeholders
                    KryptonPage page = pageCollection[uniqueName];
                    if ((page != null) && !(page is KryptonStorePage))
                    {
                        // Replace the existing page with a placeholder that has the same unique name
                        KryptonStorePage placeholder = new KryptonStorePage(uniqueName, _storeName);
                        pageCollection.Insert(pageCollection.IndexOf(page), placeholder);
                        pageCollection.Remove(page);
                    }
                }
                break;

            case DockingPropogateAction.StoreAllPages:
                // Process each page inside the cell
                for (int i = pageCollection.Count - 1; i >= 0; i--)
                {
                    // Swap pages that are not placeholders to become placeholders
                    KryptonPage page = pageCollection[i];
                    if ((page != null) && !(page is KryptonStorePage))
                    {
                        // Replace the existing page with a placeholder that has the same unique name
                        KryptonStorePage placeholder = new KryptonStorePage(page.UniqueName, _storeName);
                        pageCollection.Insert(pageCollection.IndexOf(page), placeholder);
                        pageCollection.Remove(page);
                    }
                }

                break;

            case DockingPropogateAction.ClearFillerStoredPages:
            case DockingPropogateAction.ClearStoredPages:
                foreach (string uniqueName in uniqueNames)
                {
                    // Only remove a matching unique name if it is a placeholder page
                    KryptonPage removePage = pageCollection[uniqueName];
                    if (removePage is KryptonStorePage)
                    {
                        pageCollection.Remove(removePage);
                    }
                }
                break;

            case DockingPropogateAction.ClearAllStoredPages:
            {
                // Process each page inside the cell
                for (int i = pageCollection.Count - 1; i >= 0; i--)
                {
                    // Remove all placeholders
                    KryptonPage page = pageCollection[i];
                    if (page is KryptonStorePage)
                    {
                        pageCollection.Remove(page);
                    }
                }
            }
            break;

            case DockingPropogateAction.DebugOutput:
                Console.WriteLine(GetType().ToString());
                DockableNavigatorControl.DebugOutput();
                break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, uniqueNames);
        }
Exemple #15
0
 /// <summary>
 /// Propogates an action request down the hierarchy of docking elements.
 /// </summary>
 /// <param name="action">Action that is requested to be performed.</param>
 /// <param name="value">Integer value associated with the request.</param>
 public virtual void PropogateAction(DockingPropogateAction action, int value)
 {
     // Propogate the action request to all the child elements
     // (use reverse order so if element removes itself we still have a valid loop)
     for (int i = Count - 1; i >= 0; i--)
         this[i].PropogateAction(action, value);
 }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="pages">Array of pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, KryptonPage[] pages)
        {
            switch (action)
            {
                case DockingPropogateAction.RestorePages:
                    foreach (KryptonPage page in pages)
                    {
                        // Swap pages that are placeholders for the actual pages
                        KryptonPage storePage = SpaceControl.PageForUniqueName(page.UniqueName);
                        if ((storePage != null) && (storePage is KryptonStorePage))
                        {
                            KryptonWorkspaceCell cell = SpaceControl.CellForPage(storePage);
                            cell.Pages.Insert(cell.Pages.IndexOf(storePage), page);
                        }
                    }
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, pages);
        }
Exemple #17
0
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
            case DockingPropogateAction.Loading:
                // Force layout so that the correct number of pages is recognized
                SpaceControl.PerformLayout();

                // Remove all the pages including store pages
                SpaceControl.ClearAllPages();

                // Force layout so that the control will kill itself
                SpaceControl.PerformLayout();
                break;

            case DockingPropogateAction.ShowPages:
            case DockingPropogateAction.HidePages:
            {
                bool newVisible = (action == DockingPropogateAction.ShowPages);
                foreach (string uniqueName in uniqueNames)
                {
                    // Update visible state of pages that are not placeholders
                    KryptonPage page = SpaceControl.PageForUniqueName(uniqueName);
                    if ((page != null) && !(page is KryptonStorePage))
                    {
                        page.Visible = newVisible;
                    }
                }
            }
            break;

            case DockingPropogateAction.ShowAllPages:
                SpaceControl.ShowAllPages(typeof(KryptonStorePage));
                break;

            case DockingPropogateAction.HideAllPages:
                SpaceControl.HideAllPages(typeof(KryptonStorePage));
                break;

            case DockingPropogateAction.RemovePages:
            case DockingPropogateAction.RemoveAndDisposePages:
                foreach (string uniqueName in uniqueNames)
                {
                    // If the named page exists and is not placeholder then remove it
                    KryptonPage removePage = SpaceControl.PageForUniqueName(uniqueName);
                    if ((removePage != null) && !(removePage is KryptonStorePage))
                    {
                        // Find the cell that contains the target so we can remove the page
                        KryptonWorkspaceCell cell = SpaceControl.CellForPage(removePage);
                        if (cell != null)
                        {
                            cell.Pages.Remove(removePage);

                            if (action == DockingPropogateAction.RemoveAndDisposePages)
                            {
                                removePage.Dispose();
                            }
                        }
                    }
                }
                break;

            case DockingPropogateAction.RemoveAllPages:
            case DockingPropogateAction.RemoveAndDisposeAllPages:
            {
                // Process each cell in turn
                KryptonWorkspaceCell cell = SpaceControl.FirstCell();
                while (cell != null)
                {
                    // Process each page inside the cell
                    for (int i = cell.Pages.Count - 1; i >= 0; i--)
                    {
                        // Only remove the actual page and not placeholders
                        KryptonPage page = cell.Pages[i];
                        if ((page != null) && !(page is KryptonStorePage))
                        {
                            cell.Pages.RemoveAt(i);

                            if (action == DockingPropogateAction.RemoveAndDisposeAllPages)
                            {
                                page.Dispose();
                            }
                        }
                    }

                    cell = SpaceControl.NextCell(cell);
                }

                // Force layout so that the control will kill itself
                SpaceControl.PerformLayout();
            }
            break;

            case DockingPropogateAction.StorePages:
                foreach (string uniqueName in uniqueNames)
                {
                    // Swap pages that are not placeholders to become placeholders
                    KryptonPage page = SpaceControl.PageForUniqueName(uniqueName);
                    if ((page != null) && !(page is KryptonStorePage))
                    {
                        // Replace the existing page with a placeholder that has the same unique name
                        KryptonWorkspaceCell cell        = SpaceControl.CellForPage(page);
                        KryptonStorePage     placeholder = new KryptonStorePage(uniqueName, _storeName);
                        cell.Pages.Insert(cell.Pages.IndexOf(page), placeholder);
                        cell.Pages.Remove(page);
                    }
                }
                break;

            case DockingPropogateAction.StoreAllPages:
            {
                // Process each cell in turn
                KryptonWorkspaceCell cell = SpaceControl.FirstCell();
                while (cell != null)
                {
                    // Process each page inside the cell
                    for (int i = cell.Pages.Count - 1; i >= 0; i--)
                    {
                        // Swap pages that are not placeholders to become placeholders
                        KryptonPage page = cell.Pages[i];
                        if ((page != null) && !(page is KryptonStorePage))
                        {
                            // Replace the existing page with a placeholder that has the same unique name
                            KryptonStorePage placeholder = new KryptonStorePage(page.UniqueName, _storeName);
                            cell.Pages.Insert(cell.Pages.IndexOf(page), placeholder);
                            cell.Pages.Remove(page);
                        }
                    }

                    cell = SpaceControl.NextCell(cell);
                }
            }
            break;

            case DockingPropogateAction.ClearFillerStoredPages:
            case DockingPropogateAction.ClearFloatingStoredPages:
            case DockingPropogateAction.ClearDockedStoredPages:
            case DockingPropogateAction.ClearStoredPages:
                // Only process an attempt to clear all pages or those related to this docking location
                if ((action == DockingPropogateAction.ClearStoredPages) || (action == ClearStoreAction))
                {
                    foreach (string uniqueName in uniqueNames)
                    {
                        // Only remove a matching unique name if it is a placeholder page
                        KryptonPage removePage = SpaceControl.PageForUniqueName(uniqueName);
                        if (removePage is KryptonStorePage)
                        {
                            // Check if the page is one marked to be ignored in this operation
                            if (removePage != IgnoreStorePage)
                            {
                                // Find the cell that contains the target so we can remove the page
                                KryptonWorkspaceCell cell = SpaceControl.CellForPage(removePage);
                                cell?.Pages.Remove(removePage);
                            }
                        }
                    }
                }
                break;

            case DockingPropogateAction.ClearAllStoredPages:
            {
                // Process each cell in turn
                KryptonWorkspaceCell cell = SpaceControl.FirstCell();
                while (cell != null)
                {
                    // Process each page inside the cell
                    for (int i = cell.Pages.Count - 1; i >= 0; i--)
                    {
                        // Remove all placeholders
                        KryptonPage page = cell.Pages[i];
                        if (page is KryptonStorePage)
                        {
                            cell.Pages.Remove(page);
                        }
                    }

                    cell = SpaceControl.NextCell(cell);
                }
            }
            break;

            case DockingPropogateAction.StringChanged:
                UpdateStrings();
                break;

            case DockingPropogateAction.DebugOutput:
                Console.WriteLine(SpaceControl.ToString());
                SpaceControl.DebugOutput();
                break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, uniqueNames);
        }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="pages">Array of pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, KryptonPage[] pages)
        {
            switch (action)
            {
                case DockingPropogateAction.RestorePages:
                    // Ask the sliding panel to remove its display if an incoming name matches
                    foreach (KryptonPage page in pages)
                        _slidePanel.HideUniqueName(page.UniqueName);
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, pages);
        }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
                case DockingPropogateAction.ShowPages:
                case DockingPropogateAction.HidePages:
                    {
                        bool newVisible = (action == DockingPropogateAction.ShowPages);
                        foreach (string uniqueName in uniqueNames)
                        {
                            // Update visible state of pages that are not placeholders
                            KryptonPage page = AutoHiddenGroupControl.Pages[uniqueName];
                            if ((page != null) && !(page is KryptonStorePage))
                                page.Visible = newVisible;
                        }
                    }
                    break;
                case DockingPropogateAction.ShowAllPages:
                    AutoHiddenGroupControl.ShowAllPages(typeof(KryptonStorePage));
                    break;
                case DockingPropogateAction.HideAllPages:
                    AutoHiddenGroupControl.HideAllPages(typeof(KryptonStorePage));
                    break;
                case DockingPropogateAction.RemovePages:
                case DockingPropogateAction.RemoveAndDisposePages:
                    foreach (string uniqueName in uniqueNames)
                    {
                        // Only remove the actual page and not placeholders
                        KryptonPage page = AutoHiddenGroupControl.Pages[uniqueName];
                        if ((page != null) && !(page is KryptonStorePage))
                        {
                            AutoHiddenGroupControl.Pages.Remove(page);

                            if (action == DockingPropogateAction.RemoveAndDisposePages)
                                page.Dispose();
                        }
                    }
                    break;
                case DockingPropogateAction.Loading:
                    // Remove all pages including store pages
                    AutoHiddenGroupControl.Pages.Clear();
                    break;
                case DockingPropogateAction.RemoveAllPages:
                case DockingPropogateAction.RemoveAndDisposeAllPages:
                    for (int i = AutoHiddenGroupControl.Pages.Count - 1; i >= 0; i--)
                    {
                        // Only remove the actual page and not placeholders
                        KryptonPage page = AutoHiddenGroupControl.Pages[i];
                        if ((page != null) && !(page is KryptonStorePage))
                        {
                            AutoHiddenGroupControl.Pages.RemoveAt(i);

                            if (action == DockingPropogateAction.RemoveAndDisposeAllPages)
                                page.Dispose();
                        }
                    }
                    break;
                case DockingPropogateAction.StorePages:
                    AutoHiddenGroupControl.StorePages(uniqueNames);
                    break;
                case DockingPropogateAction.StoreAllPages:
                    AutoHiddenGroupControl.StoreAllPages();
                    break;
                case DockingPropogateAction.ClearAutoHiddenStoredPages:
                case DockingPropogateAction.ClearStoredPages:
                    foreach (string uniqueName in uniqueNames)
                    {
                        // Only remove a matching placeholder page
                        KryptonPage page = AutoHiddenGroupControl.Pages[uniqueName];
                        if ((page != null) && (page is KryptonStorePage))
                            AutoHiddenGroupControl.Pages.Remove(page);
                    }
                    break;
                case DockingPropogateAction.ClearAllStoredPages:
                    for(int i=AutoHiddenGroupControl.Pages.Count-1; i>=0; i--)
                    {
                        // Only remove a placeholder paged
                        KryptonPage page = AutoHiddenGroupControl.Pages[i];
                        if ((page != null) && (page is KryptonStorePage))
                            AutoHiddenGroupControl.Pages.RemoveAt(i);
                    }
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, uniqueNames);
        }
 /// <summary>
 /// Propogates an action request down the hierarchy of docking elements.
 /// </summary>
 /// <param name="action">Action that is requested to be performed.</param>
 /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
 public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
 {
     switch (action)
     {
         case DockingPropogateAction.ShowAllPages:
         case DockingPropogateAction.HideAllPages:
         case DockingPropogateAction.RemoveAllPages:
         case DockingPropogateAction.RemoveAndDisposeAllPages:
             // Ignore some global actions
             break;
         default:
             base.PropogateAction(action, uniqueNames);
             break;
     }
 }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="value">Integer value associated with the request.</param>
        public override void PropogateAction(DockingPropogateAction action, int value)
        {
            switch (action)
            {
                case DockingPropogateAction.RepositionDockspace:
                    // Only processs if it applies to us
                    if (value == Order)
                    {
                        Control parent = DockspaceControl.Parent;
                        if (parent != null)
                        {
                            // Process all sibling controls starting from end to front of collection
                            int indexInsert = -1;
                            for (int i = parent.Controls.Count - 1; i >= 0; i--)
                            {
                                Control c = parent.Controls[i];

                                // Insert before the last auto hidden panel/slidepanel (this handles the Order=0 case)
                                if ((c is KryptonAutoHiddenPanel) || (c is KryptonAutoHiddenSlidePanel))
                                    indexInsert = i;

                                // Insert before the 'order' found dockspace separator (this handles the Order>0 cases)
                                if (c is KryptonDockspaceSeparator)
                                {
                                    if (value == 1)
                                    {
                                        indexInsert = i - 1;
                                        break;
                                    }

                                    value--;
                                }
                            }

                            // Did we manage to find an insertion point
                            if (indexInsert >= 0)
                            {
                                // Our separator should be one before is in the controls collection
                                int ourIndex = parent.Controls.IndexOf(DockspaceControl);
                                if (ourIndex > 0)
                                {
                                    Control separator = parent.Controls[ourIndex - 1];
                                    parent.Controls.SetChildIndex(separator, indexInsert);
                                }

                                parent.Controls.SetChildIndex(DockspaceControl, indexInsert);
                            }
                        }
                    }
                    break;
                default:
                    base.PropogateAction(action, value);
                    break;
            }
        }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
                case DockingPropogateAction.HidePages:
                case DockingPropogateAction.RemovePages:
                case DockingPropogateAction.RemoveAndDisposePages:
                case DockingPropogateAction.StorePages:
                    // Ask the sliding panel to remove its display if an incoming name matches
                    foreach (string uniqueName in uniqueNames)
                        _slidePanel.HideUniqueName(uniqueName);
                    break;
                case DockingPropogateAction.Loading:
                case DockingPropogateAction.HideAllPages:
                case DockingPropogateAction.RemoveAllPages:
                case DockingPropogateAction.RemoveAndDisposeAllPages:
                case DockingPropogateAction.StoreAllPages:
                    // Remove any slide out page
                    _slidePanel.HideUniqueName();
                    break;
                case DockingPropogateAction.StringChanged:
                    // Pushed changed strings to the tooltips
                    KryptonDockingManager dockingManager = DockingManager;
                    if (dockingManager != null)
                    {
                        _slidePanel.DockspaceControl.PinTooltip = dockingManager.Strings.TextDock;
                        _slidePanel.DockspaceControl.CloseTooltip = dockingManager.Strings.TextClose;
                        _slidePanel.DockspaceControl.DropDownTooltip = dockingManager.Strings.TextWindowLocation;
                    }
                    break;
            }

            // Let base class perform standard processing
            base.PropogateAction(action, uniqueNames);
        }
        /// <summary>
        /// Propogates an action request down the hierarchy of docking elements.
        /// </summary>
        /// <param name="action">Action that is requested to be performed.</param>
        /// <param name="uniqueNames">Array of unique names of the pages the action relates to.</param>
        public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames)
        {
            switch (action)
            {
                case DockingPropogateAction.StartUpdate:
                    // Only the first of several 'StartUpdate' actions needs actioning
                    if (_updateCount++ == 0)
                    {
                        // Place the obscuring control at the top of the z-order
                        Control.Controls.SetChildIndex(_obscure, 0);

                        // Set obscuring control to take up entire client area and be made visible, this prevents
                        // the drawing of any control underneath it and so prevents any drawing artifacts being seen
                        // until the end of all operations resulting from the request action.
                        _obscure.SetBounds(0, 0, Control.Width, Control.Height);
                        _obscure.Visible = true;
                    }
                    break;
                case DockingPropogateAction.EndUpdate:
                    // Only final matching 'EndUpdate' needs to reverse start action
                    if ((_updateCount > 0) && (_updateCount-- == 1))
                    {
                        // Multi operation might have caused a change in the inner minimum
                        EnforceInnerMinimum();

                        _obscure.Visible = false;
                    }
                    break;
                case DockingPropogateAction.ShowPages:
                case DockingPropogateAction.ShowAllPages:
                    // Let base class perform actual requested actions
                    base.PropogateAction(action, uniqueNames);

                    // Ensure that showing extra pages does not trespass on the inner minimum
                    if ((action == DockingPropogateAction.ShowPages) ||
                        (action == DockingPropogateAction.ShowAllPages))
                        EnforceInnerMinimum();
                    break;
                default:
                    // Let base class perform actual requested actions
                    base.PropogateAction(action, uniqueNames);
                    break;
            }
        }