Exemplo n.º 1
0
 internal void SetStatus(DockList list, DockPane prevPane, DockAlignment alignment, double proportion)
 {
     m_dockList   = list;
     m_prevPane   = prevPane;
     m_alignment  = alignment;
     m_proportion = proportion;
 }
Exemplo n.º 2
0
        internal void Add(DockPane pane)
        {
            if (pane == null)
            {
                return;
            }

            DockList oldDockList = (pane.DockListContainer == null) ? null : pane.DockListContainer.DockList;

            if (oldDockList != null)
            {
                oldDockList.InternalRemove(pane);
            }
            InnerList.Add(pane);
            if (oldDockList != null)
            {
                oldDockList.CheckFloatWindowDispose();
            }
        }
Exemplo n.º 3
0
        internal DockWindow(DockContainer dockPanel, DockState dockState)
        {
            _dockList  = new DockList(this);
            _dockPanel = dockPanel;
            _dockState = dockState;
            Visible    = false;

            SuspendLayout();

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

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

            ResumeLayout();
        }
Exemplo n.º 4
0
        private void MergeDockList(DisplayingDockList dockListFrom, DockList dockListTo, DockPane prevPane, DockAlignment alignment, double proportion)
        {
            if (dockListFrom.Count == 0)
            {
                return;
            }

            int count = dockListFrom.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]       = dockListFrom[i];
                prevPanes[i]   = dockListFrom[i].NestedDockingStatus.PrevPane;
                alignments[i]  = dockListFrom[i].NestedDockingStatus.Alignment;
                proportions[i] = dockListFrom[i].NestedDockingStatus.Proportion;
            }

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

            panes[0].DockState = dockListTo.DockState;
            panes[0].Activate();

            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].AddToDockList(dockListTo.Container, prevPanes[i], alignments[i], proportions[i]);
                panes[i].DockState = dockListTo.DockState;
                panes[i].Activate();
            }
        }
Exemplo n.º 5
0
        private void InternalConstruct(DockContainer dockPanel, DockPane pane, bool boundsSpecified, Rectangle bounds)
        {
            if (dockPanel == null)
            {
                throw (new ArgumentNullException(ResourceHelper.GetString("FloatWindow.Constructor.NullDockPanel")));
            }

            _dockList = new DockList(this);

            FormBorderStyle = FormBorderStyle.SizableToolWindow;
            ShowInTaskbar   = false;

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

            if (Environment.Version.Major == 1)
            {
                _dummyControl        = new DummyControl();
                _dummyControl.Bounds = Rectangle.Empty;
                Controls.Add(_dummyControl);
            }

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

            ResumeLayout();
        }
Exemplo n.º 6
0
 internal DisplayingDockList(DockList dockList)
 {
     m_dockList = dockList;
 }
Exemplo n.º 7
0
        private void FloatWindow_OnEndDrag(bool abort)
        {
            if (abort)
            {
                return;
            }

            FloatWindow floatWindow = (FloatWindow)DragControl;

            if (!DockOutline.FloatWindowBounds.IsEmpty)
            {
                DragControl.Bounds = DockOutline.FloatWindowBounds;
            }
            else if (DockOutline.DockTo is DockPane)
            {
                DockPane paneTo = DockOutline.DockTo as DockPane;

                if (DockOutline.Dock == DockStyle.Fill)
                {
                    for (int i = floatWindow.DockList.Count - 1; i >= 0; i--)
                    {
                        DockPane pane = floatWindow.DockList[i];
                        for (int j = pane.Contents.Count - 1; j >= 0; j--)
                        {
                            IDockableWindow c = pane.Contents[j];
                            c.DockHandler.Pane = paneTo;
                            if (DockOutline.ContentIndex != -1)
                            {
                                paneTo.SetContentIndex(c, DockOutline.ContentIndex);
                            }
                            c.DockHandler.Activate();
                        }
                    }
                }
                else
                {
                    DockAlignment alignment = DockAlignment.Left;
                    if (DockOutline.Dock == DockStyle.Left)
                    {
                        alignment = DockAlignment.Left;
                    }
                    else if (DockOutline.Dock == DockStyle.Right)
                    {
                        alignment = DockAlignment.Right;
                    }
                    else if (DockOutline.Dock == DockStyle.Top)
                    {
                        alignment = DockAlignment.Top;
                    }
                    else if (DockOutline.Dock == DockStyle.Bottom)
                    {
                        alignment = DockAlignment.Bottom;
                    }

                    MergeDockList(floatWindow.DisplayingList, paneTo.DockListContainer.DockList, paneTo, alignment, 0.5);
                }
            }
            else if (DockOutline.DockTo is DockContainer)
            {
                SetDockWindow();

                DockList dockListTo = null;

                if (DockOutline.Dock == DockStyle.Top)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockTop].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Bottom)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockBottom].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Left)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockLeft].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Right)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockRight].DockList;
                }
                else if (DockOutline.Dock == DockStyle.Fill)
                {
                    dockListTo = floatWindow.DockPanel.DockWindows[DockState.Document].DockList;
                }

                DockPane prevPane = null;
                for (int i = dockListTo.Count - 1; i >= 0; i--)
                {
                    if (dockListTo[i] != floatWindow.DisplayingList[0])
                    {
                        prevPane = dockListTo[i];
                    }
                }
                MergeDockList(floatWindow.DisplayingList, dockListTo, prevPane, DockAlignment.Left, 0.5);
            }
        }