Пример #1
0
 internal void SetStatus(NestedPaneCollection nestedPanes, DockPane previousPane, DockAlignment alignment, double proportion)
 {
     m_nestedPanes  = nestedPanes;
     m_previousPane = previousPane;
     m_alignment    = alignment;
     m_proportion   = proportion;
 }
Пример #2
0
        internal DockWindow(DockPanel dockPanel, DockState dockState)
        {
            m_nestedPanes = new NestedPaneCollection(this);
            m_dockPanel   = dockPanel;
            m_dockState   = dockState;
            Visible       = false;

            SuspendLayout();

            if (DockState == DockState.DockLeft || DockState == DockState.DockRight ||
                DockState == DockState.DockTop || DockState == DockState.DockBottom)
            {
                m_splitter = new SplitterControl();
                Controls.Add(m_splitter);
            }

            if (DockState == DockState.DockLeft)
            {
                Dock            = DockStyle.Left;
                m_splitter.Dock = DockStyle.Right;
            }
            else if (DockState == DockState.DockRight)
            {
                Dock            = DockStyle.Right;
                m_splitter.Dock = DockStyle.Left;
            }
            else if (DockState == DockState.DockTop)
            {
                Dock            = DockStyle.Top;
                m_splitter.Dock = DockStyle.Bottom;
            }
            else if (DockState == DockState.DockBottom)
            {
                Dock            = DockStyle.Bottom;
                m_splitter.Dock = DockStyle.Top;
            }
            else if (DockState == DockState.Document)
            {
                Dock = DockStyle.Fill;
            }

            ResumeLayout();
        }
Пример #3
0
        internal void Add(DockPane pane)
        {
            if (pane == null)
            {
                return;
            }

            NestedPaneCollection oldNestedPanes = (pane.NestedPanesContainer == null) ? null : pane.NestedPanesContainer.NestedPanes;

            if (oldNestedPanes != null)
            {
                oldNestedPanes.InternalRemove(pane);
            }
            Items.Add(pane);
            if (oldNestedPanes != null)
            {
                oldNestedPanes.CheckFloatWindowDispose();
            }
        }
Пример #4
0
        private void InternalConstruct(DockPanel dockPanel, DockPane pane, bool boundsSpecified, Rectangle bounds)
        {
            if (dockPanel == null)
            {
                throw(new ArgumentNullException(Strings.FloatWindow_Constructor_NullDockPanel));
            }

            m_nestedPanes = new NestedPaneCollection(this);

            FormBorderStyle = FormBorderStyle.SizableToolWindow;
            ShowInTaskbar   = false;
            if (dockPanel.RightToLeft != RightToLeft)
            {
                RightToLeft = dockPanel.RightToLeft;
            }
            if (RightToLeftLayout != dockPanel.RightToLeftLayout)
            {
                RightToLeftLayout = dockPanel.RightToLeftLayout;
            }

            SuspendLayout();
            if (boundsSpecified)
            {
                Bounds        = bounds;
                StartPosition = FormStartPosition.Manual;
            }
            else
            {
                StartPosition = FormStartPosition.WindowsDefaultLocation;
                Size          = dockPanel.DefaultFloatWindowSize;
            }

            m_dockPanel = dockPanel;
            Owner       = DockPanel.FindForm();
            DockPanel.AddFloatWindow(this);
            if (pane != null)
            {
                pane.FloatWindow = this;
            }

            ResumeLayout();
        }
Пример #5
0
        public void DockTo(DockPanel panel, DockStyle dockStyle)
        {
            if (panel != DockPanel)
            {
                throw new ArgumentException(Strings.IDockDragSource_DockTo_InvalidPanel, "panel");
            }

            NestedPaneCollection nestedPanesTo = null;

            if (dockStyle == DockStyle.Top)
            {
                nestedPanesTo = DockPanel.DockWindows[DockState.DockTop].NestedPanes;
            }
            else if (dockStyle == DockStyle.Bottom)
            {
                nestedPanesTo = DockPanel.DockWindows[DockState.DockBottom].NestedPanes;
            }
            else if (dockStyle == DockStyle.Left)
            {
                nestedPanesTo = DockPanel.DockWindows[DockState.DockLeft].NestedPanes;
            }
            else if (dockStyle == DockStyle.Right)
            {
                nestedPanesTo = DockPanel.DockWindows[DockState.DockRight].NestedPanes;
            }
            else if (dockStyle == DockStyle.Fill)
            {
                nestedPanesTo = DockPanel.DockWindows[DockState.Document].NestedPanes;
            }

            DockPane prevPane = null;

            for (int i = nestedPanesTo.Count - 1; i >= 0; i--)
            {
                if (nestedPanesTo[i] != VisibleNestedPanes[0])
                {
                    prevPane = nestedPanesTo[i];
                }
            }
            MergeNestedPanes(VisibleNestedPanes, nestedPanesTo, prevPane, DockAlignment.Left, 0.5);
        }
Пример #6
0
        private static void MergeNestedPanes(VisibleNestedPaneCollection nestedPanesFrom, NestedPaneCollection nestedPanesTo, DockPane prevPane, DockAlignment alignment, double proportion)
        {
            if (nestedPanesFrom.Count == 0)
            {
                return;
            }

            int count = nestedPanesFrom.Count;

            DockPane[]      panes       = new DockPane[count];
            DockPane[]      prevPanes   = new DockPane[count];
            DockAlignment[] alignments  = new DockAlignment[count];
            double[]        proportions = new double[count];

            for (int i = 0; i < count; i++)
            {
                panes[i]       = nestedPanesFrom[i];
                prevPanes[i]   = nestedPanesFrom[i].NestedDockingStatus.PreviousPane;
                alignments[i]  = nestedPanesFrom[i].NestedDockingStatus.Alignment;
                proportions[i] = nestedPanesFrom[i].NestedDockingStatus.Proportion;
            }

            DockPane pane = panes[0].DockTo(nestedPanesTo.Container, prevPane, alignment, proportion);

            panes[0].DockState = nestedPanesTo.DockState;

            for (int i = 1; i < count; i++)
            {
                for (int j = i; j < count; j++)
                {
                    if (prevPanes[j] == panes[i - 1])
                    {
                        prevPanes[j] = pane;
                    }
                }
                pane = panes[i].DockTo(nestedPanesTo.Container, prevPanes[i], alignments[i], proportions[i]);
                panes[i].DockState = nestedPanesTo.DockState;
            }
        }
 internal VisibleNestedPaneCollection(NestedPaneCollection nestedPanes)
     : base(new List <DockPane>())
 {
     m_nestedPanes = nestedPanes;
 }