コード例 #1
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;
            }
        }
コード例 #2
0
 protected void ShowTabPageContextMenu(Point position)
 {
     DockPane.ShowTabPageContextMenu(this, position);
 }
コード例 #3
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDOWN)
            {
                if (IsDisposed)
                {
                    return;
                }

                uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result == 2 && DockPanel.AllowEndUserDocking && this.AllowEndUserDocking)                   // HITTEST_CAPTION
                {
                    Activate();
                    m_dockPanel.BeginDrag(this);
                }
                else
                {
                    base.WndProc(ref m);
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_NCRBUTTONDOWN)
            {
                uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result == 2)        // HITTEST_CAPTION
                {
                    DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
                    if (theOnlyPane != null && theOnlyPane.ActiveContent != null)
                    {
                        theOnlyPane.ShowTabPageContextMenu(this, PointToClient(Control.MousePosition));
                        return;
                    }
                }

                base.WndProc(ref m);
                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_CLOSE)
            {
                if (NestedPanes.Count == 0)
                {
                    base.WndProc(ref m);
                    return;
                }

                for (int i = NestedPanes.Count - 1; i >= 0; i--)
                {
                    DockContentCollection contents = NestedPanes[i].Contents;
                    for (int j = contents.Count - 1; j >= 0; j--)
                    {
                        IDockContent content = contents[j];
                        if (content.DockHandler.DockState != DockState.Float)
                        {
                            continue;
                        }

                        if (!content.DockHandler.CloseButton)
                        {
                            continue;
                        }

                        if (content.DockHandler.HideOnClose)
                        {
                            content.DockHandler.Hide();
                        }
                        else
                        {
                            content.DockHandler.Close();
                        }
                    }
                }

                return;
            }
            else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
            {
                uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
                if (result != 2)        // HITTEST_CAPTION
                {
                    base.WndProc(ref m);
                    return;
                }

                DockPanel.SuspendLayout(true);

                // Restore to panel
                foreach (DockPane pane in NestedPanes)
                {
                    if (pane.DockState != DockState.Float)
                    {
                        continue;
                    }
                    pane.RestoreToPanel();
                }


                DockPanel.ResumeLayout(true, true);
                return;
            }
            else if (m.Msg == WM_CHECKDISPOSE)
            {
                if (NestedPanes.Count == 0)
                {
                    Dispose();
                }

                return;
            }

            base.WndProc(ref m);
        }
コード例 #4
0
 internal protected FloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
 {
     InternalConstruct(dockPanel, pane, true, bounds);
 }
コード例 #5
0
 internal protected FloatWindow(DockPanel dockPanel, DockPane pane)
 {
     InternalConstruct(dockPanel, pane, false, Rectangle.Empty);
 }
コード例 #6
0
 public void Show(DockPane pane, int contentIndex)
 {
     SaveOldValues();
     SetValues(Rectangle.Empty, pane, DockStyle.Fill, contentIndex);
     TestChange();
 }
コード例 #7
0
 public void Show(DockPane pane, DockStyle dock)
 {
     SaveOldValues();
     SetValues(Rectangle.Empty, pane, dock, -1);
     TestChange();
 }