Esempio n. 1
0
 public void SetNestedDockingProportion(double proportion)
 {
     NestedDockingStatus.SetStatus(NestedDockingStatus.NestedPanes, NestedDockingStatus.PreviousPane, NestedDockingStatus.Alignment, proportion);
     if (NestedPanesContainer != null)
     {
         ((Control)NestedPanesContainer).PerformLayout();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Switches a pane with its first child in the pane hierarchy. (The actual hiding happens elsewhere.)
        /// </summary>
        /// <param name="pane">Pane to switch</param>
        internal void SwitchPaneWithFirstChild(DockPane pane)
        {
            if (!Contains(pane))
            {
                return;
            }

            NestedDockingStatus statusPane     = pane.NestedDockingStatus;
            DockPane            lastNestedPane = null;

            for (int i = Count - 1; i > IndexOf(pane); i--)
            {
                if (this[i].NestedDockingStatus.PreviousPane == pane)
                {
                    lastNestedPane = this[i];
                    break;
                }
            }

            if (lastNestedPane != null)
            {
                int indexLastNestedPane = IndexOf(lastNestedPane);
                Items[IndexOf(pane)]       = lastNestedPane;
                Items[indexLastNestedPane] = pane;
                NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;

                DockAlignment newAlignment;
                if (lastNestedDock.Alignment == DockAlignment.Left)
                {
                    newAlignment = DockAlignment.Right;
                }
                else if (lastNestedDock.Alignment == DockAlignment.Right)
                {
                    newAlignment = DockAlignment.Left;
                }
                else if (lastNestedDock.Alignment == DockAlignment.Top)
                {
                    newAlignment = DockAlignment.Bottom;
                }
                else
                {
                    newAlignment = DockAlignment.Top;
                }
                double newProportion = 1 - lastNestedDock.Proportion;

                lastNestedDock.SetStatus(this, statusPane.PreviousPane, statusPane.Alignment, statusPane.Proportion);
                for (int i = indexLastNestedPane - 1; i > IndexOf(lastNestedPane); i--)
                {
                    NestedDockingStatus status = this[i].NestedDockingStatus;
                    if (status.PreviousPane == pane)
                    {
                        status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion);
                    }
                }

                statusPane.SetStatus(this, lastNestedPane, newAlignment, newProportion);
            }
        }
Esempio n. 3
0
        private void InternalRemove(DockPane pane)
        {
            if (!Contains(pane))
            {
                return;
            }

            NestedDockingStatus statusPane     = pane.NestedDockingStatus;
            DockPane            lastNestedPane = null;

            for (int i = Count - 1; i > IndexOf(pane); i--)
            {
                if (this[i].NestedDockingStatus.PreviousPane == pane)
                {
                    lastNestedPane = this[i];
                    break;
                }
            }

            if (lastNestedPane != null)
            {
                int indexLastNestedPane = IndexOf(lastNestedPane);
                Items.Remove(lastNestedPane);
                Items[IndexOf(pane)] = lastNestedPane;
                NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;
                lastNestedDock.SetStatus(this, statusPane.PreviousPane, statusPane.Alignment, statusPane.Proportion);
                for (int i = indexLastNestedPane - 1; i > IndexOf(lastNestedPane); i--)
                {
                    NestedDockingStatus status = this[i].NestedDockingStatus;
                    if (status.PreviousPane == pane)
                    {
                        status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion);
                    }
                }
            }
            else
            {
                Items.Remove(pane);
            }

            statusPane.SetStatus(null, null, DockAlignment.Left, 0.5);
            statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5);
            statusPane.SetDisplayingBounds(Rectangle.Empty, Rectangle.Empty, Rectangle.Empty);
        }
Esempio n. 4
0
        private void InternalAddToDockList(INestedPanesContainer container, DockPane prevPane, DockAlignment alignment, double proportion)
        {
            if ((container.DockState == DockState.Float) != IsFloat)
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_InvalidContainer);
            }

            int count = container.NestedPanes.Count;

            if (container.NestedPanes.Contains(this))
            {
                count--;
            }
            if (prevPane == null && count > 0)
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_NullPrevPane);
            }

            if (prevPane != null && !container.NestedPanes.Contains(prevPane))
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_NoPrevPane);
            }

            if (prevPane == this)
            {
                throw new InvalidOperationException(Strings.DockPane_DockTo_SelfPrevPane);
            }

            INestedPanesContainer oldContainer = NestedPanesContainer;
            DockState             oldDockState = DockState;

            container.NestedPanes.Add(this);
            NestedDockingStatus.SetStatus(container.NestedPanes, prevPane, alignment, proportion);

            if (DockHelper.IsDockWindowState(DockState))
            {
                m_dockState = container.DockState;
            }

            RefreshStateChange(oldContainer, oldDockState);
        }