Inheritance: KryptonSpace
Beispiel #1
0
        /// <summary>
        /// Occurs when a page is added to a cell in the workspace.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">A KryptonPageEventArgs containing the event data.</param>
        protected virtual void OnSpaceCellPageInserting(object sender, KryptonPageEventArgs e)
        {
            KryptonDockingManager dockingManager = DockingManager;

            if (dockingManager != null)
            {
                if (e.Item is KryptonStorePage)
                {
                    KryptonDockspace dockspace = sender as KryptonDockspace;
                    if ((dockspace != null) && (dockspace.CellForPage(e.Item) != null))
                    {
                        // Prevent this existing store page from being removed due to the Propogate action below. This can
                        // occur because a cell with pages is added in one go and so insert events are generated for the
                        // existing pages inside the cell to ensure that the event is always fired consistently.
                        IgnoreStorePage = (KryptonStorePage)e.Item;
                    }

                    KryptonDockableWorkspace workspace = sender as KryptonDockableWorkspace;
                    if ((workspace != null) && (workspace.CellForPage(e.Item) != null))
                    {
                        // Prevent this existing store page from being removed due to the Propogate action below. This can
                        // occur because a cell with pages is added in one go and so insert events are generated for the
                        // existing pages inside the cell to ensure that the event is always fired consistently.
                        IgnoreStorePage = (KryptonStorePage)e.Item;
                    }
                }

                // Remove any store page for the unique name of this page being added.
                dockingManager.PropogateAction(ClearStoreAction, new string[] { e.Item.UniqueName });
                IgnoreStorePage = null;
            }
        }
 /// <summary>
 /// Initialize a new instance of the DockspaceCellEventArgs class.
 /// </summary>
 /// <param name="dockspace">Reference to existing dockspace control instance.</param>
 /// <param name="element">Reference to docking dockspace element that is managing the dockspace control.</param>
 /// <param name="cell">Reference to dockspace control cell instance.</param>
 public DockspaceCellEventArgs(KryptonDockspace dockspace,
                               KryptonDockingDockspace element,
                               KryptonWorkspaceCell cell)
 {
     _dockspace = dockspace;
     _element   = element;
     _cell      = cell;
 }
 /// <summary>
 /// Initialize a new instance of the DockspaceCellEventArgs class.
 /// </summary>
 /// <param name="dockspace">Reference to existing dockspace control instance.</param>
 /// <param name="element">Reference to docking dockspace element that is managing the dockspace control.</param>
 /// <param name="cell">Reference to dockspace control cell instance.</param>
 public DockspaceCellEventArgs(KryptonDockspace dockspace,
                               KryptonDockingDockspace element,
                               KryptonWorkspaceCell cell)
 {
     DockspaceControl = dockspace;
     DockspaceElement = element;
     CellControl      = cell;
 }
 /// <summary>
 /// Initialize a new instance of the DockspaceCellEventArgs class.
 /// </summary>
 /// <param name="dockspace">Reference to existing dockspace control instance.</param>
 /// <param name="element">Reference to docking dockspace element that is managing the dockspace control.</param>
 /// <param name="cell">Reference to dockspace control cell instance.</param>
 public DockspaceCellEventArgs(KryptonDockspace dockspace,
                               KryptonDockingDockspace element,
                               KryptonWorkspaceCell cell)
 {
     _dockspace = dockspace;
     _element = element;
     _cell = cell;
 }
 /// <summary>
 /// Initialize a new instance of the AutoHiddenSeparatorResizeEventArgs class.
 /// </summary>
 /// <param name="separator">Reference to separator control instance.</param>
 /// <param name="dockspace">Reference to dockspace control instance.</param>
 /// <param name="page">Reference to page contained in the dockspace.</param>
 /// <param name="resizeRect">Initial resizing rectangle.</param>
 public AutoHiddenSeparatorResizeEventArgs(KryptonSeparator separator,
                                           KryptonDockspace dockspace,
                                           KryptonPage page,
                                           Rectangle resizeRect)
 {
     _separator = separator;
     _dockspace = dockspace;
     _page = page;
     _resizeRect = resizeRect;
 }
 /// <summary>
 /// Initialize a new instance of the AutoHiddenSeparatorResizeEventArgs class.
 /// </summary>
 /// <param name="separator">Reference to separator control instance.</param>
 /// <param name="dockspace">Reference to dockspace control instance.</param>
 /// <param name="page">Reference to page contained in the dockspace.</param>
 /// <param name="resizeRect">Initial resizing rectangle.</param>
 public AutoHiddenSeparatorResizeEventArgs(KryptonSeparator separator,
                                           KryptonDockspace dockspace,
                                           KryptonPage page,
                                           Rectangle resizeRect)
 {
     SeparatorControl = separator;
     DockspaceControl = dockspace;
     Page             = page;
     ResizeRect       = resizeRect;
 }
Beispiel #7
0
 /// <summary>
 /// Initialize a new instance of the AutoHiddenSeparatorResizeEventArgs class.
 /// </summary>
 /// <param name="separator">Reference to separator control instance.</param>
 /// <param name="dockspace">Reference to dockspace control instance.</param>
 /// <param name="page">Reference to page contained in the dockspace.</param>
 /// <param name="resizeRect">Initial resizing rectangle.</param>
 public AutoHiddenSeparatorResizeEventArgs(KryptonSeparator separator,
                                           KryptonDockspace dockspace,
                                           KryptonPage page,
                                           Rectangle resizeRect)
 {
     _separator  = separator;
     _dockspace  = dockspace;
     _page       = page;
     _resizeRect = resizeRect;
 }
 /// <summary>
 /// Initialize a new instance of the KryptonDockingDockspace class.
 /// </summary>
 /// <param name="name">Initial name of the element.</param>
 /// <param name="edge">Docking edge this dockspace is against.</param>
 /// <param name="size">Initial size of the dockspace.</param>
 public KryptonDockingDockspace(string name, DockingEdge edge, Size size)
     : base(name, "Docked")
 {
     // Create a new dockspace that will be a host for docking pages
     SpaceControl                              = new KryptonDockspace();
     DockspaceControl.Size                     = size;
     DockspaceControl.Dock                     = DockingHelper.DockStyleFromDockEdge(edge, false);
     DockspaceControl.CellCountChanged        += OnDockspaceCellCountChanged;
     DockspaceControl.CellVisibleCountChanged += OnDockspaceCellVisibleCountChanged;
     DockspaceControl.CellPageInserting       += OnSpaceCellPageInserting;
     DockspaceControl.PageCloseClicked        += OnDockspacePageCloseClicked;
     DockspaceControl.PageAutoHiddenClicked   += OnDockspacePageAutoHiddenClicked;
     DockspaceControl.PagesDoubleClicked      += OnDockspacePagesDoubleClicked;
     DockspaceControl.PageDropDownClicked     += OnDockspaceDropDownClicked;
     DockspaceControl.BeforePageDrag          += OnDockspaceBeforePageDrag;
 }
 /// <summary>
 /// Initialize a new instance of the KryptonDockingDockspace class.
 /// </summary>
 /// <param name="name">Initial name of the element.</param>
 /// <param name="edge">Docking edge this dockspace is against.</param>
 /// <param name="size">Initial size of the dockspace.</param>
 public KryptonDockingDockspace(string name, DockingEdge edge, Size size)
     : base(name, "Docked")
 {
     // Create a new dockspace that will be a host for docking pages
     SpaceControl = new KryptonDockspace();
     DockspaceControl.Size = size;
     DockspaceControl.Dock = DockingHelper.DockStyleFromDockEdge(edge, false);
     DockspaceControl.CellCountChanged += new EventHandler(OnDockspaceCellCountChanged);
     DockspaceControl.CellVisibleCountChanged += new EventHandler(OnDockspaceCellVisibleCountChanged);
     DockspaceControl.CellPageInserting += new EventHandler<KryptonPageEventArgs>(OnSpaceCellPageInserting);
     DockspaceControl.PageCloseClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageCloseClicked);
     DockspaceControl.PageAutoHiddenClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageAutoHiddenClicked);
     DockspaceControl.PagesDoubleClicked += new EventHandler<UniqueNamesEventArgs>(OnDockspacePagesDoubleClicked);
     DockspaceControl.PageDropDownClicked += new EventHandler<CancelDropDownEventArgs>(OnDockspaceDropDownClicked);
     DockspaceControl.BeforePageDrag += new EventHandler<PageDragCancelEventArgs>(OnDockspaceBeforePageDrag);
 }
Beispiel #10
0
 /// <summary>
 /// Initialize a new instance of the KryptonDockingDockspace class.
 /// </summary>
 /// <param name="name">Initial name of the element.</param>
 /// <param name="edge">Docking edge this dockspace is against.</param>
 /// <param name="size">Initial size of the dockspace.</param>
 public KryptonDockingDockspace(string name, DockingEdge edge, Size size)
     : base(name, "Docked")
 {
     // Create a new dockspace that will be a host for docking pages
     SpaceControl                              = new KryptonDockspace();
     DockspaceControl.Size                     = size;
     DockspaceControl.Dock                     = DockingHelper.DockStyleFromDockEdge(edge, false);
     DockspaceControl.CellCountChanged        += new EventHandler(OnDockspaceCellCountChanged);
     DockspaceControl.CellVisibleCountChanged += new EventHandler(OnDockspaceCellVisibleCountChanged);
     DockspaceControl.CellPageInserting       += new EventHandler <KryptonPageEventArgs>(OnSpaceCellPageInserting);
     DockspaceControl.PageCloseClicked        += new EventHandler <UniqueNameEventArgs>(OnDockspacePageCloseClicked);
     DockspaceControl.PageAutoHiddenClicked   += new EventHandler <UniqueNameEventArgs>(OnDockspacePageAutoHiddenClicked);
     DockspaceControl.PagesDoubleClicked      += new EventHandler <UniqueNamesEventArgs>(OnDockspacePagesDoubleClicked);
     DockspaceControl.PageDropDownClicked     += new EventHandler <CancelDropDownEventArgs>(OnDockspaceDropDownClicked);
     DockspaceControl.BeforePageDrag          += new EventHandler <PageDragCancelEventArgs>(OnDockspaceBeforePageDrag);
 }
Beispiel #11
0
        private void OnSlidePanelSeparatorMoveRect(object sender, SplitterMoveRectMenuArgs e)
        {
            // Cast to correct type and grab associated dockspace control
            KryptonDockspaceSeparator separatorControl = (KryptonDockspaceSeparator)sender;
            KryptonDockspace          dockspaceControl = _slidePanel.DockspaceControl;
            KryptonPage page = _slidePanel.Page;

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

            if (dockingManager != null)
            {
                // Allow the movement rectangle to be modified by event handlers
                AutoHiddenSeparatorResizeEventArgs autoHiddenSeparatorResizeRectArgs = new AutoHiddenSeparatorResizeEventArgs(separatorControl, dockspaceControl, page, FindMovementRect(e.MoveRect));
                dockingManager.RaiseAutoHiddenSeparatorResize(autoHiddenSeparatorResizeRectArgs);
                e.MoveRect = autoHiddenSeparatorResizeRectArgs.ResizeRect;
            }
        }
Beispiel #12
0
 /// <summary>
 /// Initialize a new instance of the DockspaceEventArgs class.
 /// </summary>
 /// <param name="dockspace">Reference to new dockspace control instance.</param>
 /// <param name="element">Reference to docking dockspace element that is managing the dockspace control.</param>
 public DockspaceEventArgs(KryptonDockspace dockspace,
                           KryptonDockingDockspace element)
 {
     DockspaceControl = dockspace;
     DockspaceElement = element;
 }
Beispiel #13
0
        private void EnforceInnerMinimum(int remove, Orientation orientation)
        {
            // Create a list of all the dockspace controls in our orientation and a matching array
            // of lengths that will be used in the final phase of updating the control sizes
            List <KryptonDockspace> controls = new List <KryptonDockspace>();

            foreach (Control c in Control.Controls)
            {
                KryptonDockspace dockspace = c as KryptonDockspace;
                if ((dockspace != null) && c.Visible)
                {
                    switch (c.Dock)
                    {
                    case DockStyle.Left:
                    case DockStyle.Right:
                        if (orientation == Orientation.Horizontal)
                        {
                            controls.Add(dockspace);
                        }
                        break;

                    case DockStyle.Top:
                    case DockStyle.Bottom:
                        if (orientation == Orientation.Vertical)
                        {
                            controls.Add(dockspace);
                        }
                        break;
                    }
                }
            }

            // Keep trying to remove size from controls until we have removed all
            // needed space or have no more controls that can be reduced in size
            while ((remove > 0) && (controls.Count > 0))
            {
                // How much space to remove from each control
                int delta = Math.Max(1, remove / controls.Count);

                // Try and remove delta from each control
                int dockDelta;
                for (int i = controls.Count - 1; i >= 0; i--)
                {
                    KryptonDockspace dockspace = controls[i];

                    // Find how much we can subtract from the dockspace without violating the minimum size
                    if (orientation == Orientation.Horizontal)
                    {
                        dockDelta = dockspace.Width - Math.Max(dockspace.MinimumSize.Width, dockspace.Width - delta);
                    }
                    else
                    {
                        dockDelta = dockspace.Height - Math.Max(dockspace.MinimumSize.Height, dockspace.Height - delta);
                    }

                    // We cannot remove any more from the dockspace control, then we are done with that control
                    if (dockDelta == 0)
                    {
                        controls.Remove(dockspace);
                    }
                    else
                    {
                        // Reduce the dockspace size
                        if (orientation == Orientation.Horizontal)
                        {
                            dockspace.Width -= dockDelta;
                        }
                        else
                        {
                            dockspace.Height -= dockDelta;
                        }

                        // Update total amount to be removed
                        remove -= dockDelta;
                    }
                }
            }
        }
 /// <summary>
 /// Initialize a new instance of the DockspaceEventArgs class.
 /// </summary>
 /// <param name="dockspace">Reference to new dockspace control instance.</param>
 /// <param name="element">Reference to docking dockspace element that is managing the dockspace control.</param>
 public DockspaceEventArgs(KryptonDockspace dockspace,
                           KryptonDockingDockspace element)
 {
     _dockspace = dockspace;
     _element = element;
 }
Beispiel #15
0
 /// <summary>
 /// Initialize a new instance of the DockspaceEventArgs class.
 /// </summary>
 /// <param name="dockspace">Reference to new dockspace control instance.</param>
 /// <param name="element">Reference to docking dockspace element that is managing the dockspace control.</param>
 public DockspaceEventArgs(KryptonDockspace dockspace,
                           KryptonDockingDockspace element)
 {
     _dockspace = dockspace;
     _element   = element;
 }