示例#1
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();
        }
示例#2
0
            private void SetActivePane()
            {
                DockPane value = (ActiveContent == null ? null : ActiveContent.DockHandler.Pane);

                if (value == m_activePane)
                    return;

                m_activePane = value;
            }
示例#3
0
        protected internal DockPaneCaptionBase(DockPane pane)
        {
            m_dockPane = pane;

            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.ResizeRedraw |
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.Selectable, false);
        }
示例#4
0
文件: DockPane.cs 项目: Mofsy/jinxbot
        private void InternalConstruct(IDockContent content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
        {
            if (dockState == DockState.Hidden || dockState == DockState.Unknown)
                throw new ArgumentException(Strings.DockPane_SetDockState_InvalidState);

            if (content == null)
                throw new ArgumentNullException(Strings.DockPane_Constructor_NullContent);

            if (content.DockHandler.DockPanel == null)
                throw new ArgumentException(Strings.DockPane_Constructor_NullDockPanel);


            SuspendLayout();
            SetStyle(ControlStyles.Selectable, false);

            m_isFloat = (dockState == DockState.Float);

            m_contents = new DockContentCollection();
            m_displayingContents = new DockContentCollection(this);
            m_dockPanel = content.DockHandler.DockPanel;
            m_dockPanel.AddPane(this);

            m_splitter = new SplitterControl(this);

            m_nestedDockingStatus = new NestedDockingStatus(this);

            m_captionControl = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this);
            m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this);
            Controls.AddRange(new Control[] { m_captionControl, m_tabStripControl });

            DockPanel.SuspendLayout(true);
            if (flagBounds)
                FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
            else if (prevPane != null)
                DockTo(prevPane.NestedPanesContainer, prevPane, alignment, proportion);

            SetDockState(dockState);
            if (show)
                content.DockHandler.Pane = this;
            else if (this.IsFloat)
                content.DockHandler.FloatPane = this;
            else
                content.DockHandler.PanelPane = this;

            ResumeLayout();
            DockPanel.ResumeLayout(true, true);
        }
示例#5
0
 /// <summary>
 /// Shows the docking container in the specified order.
 /// </summary>
 /// <param name="previousPane">The pane after which to insert this item.</param>
 /// <param name="alignment">The docking alignment.</param>
 /// <param name="proportion">The proportion.</param>
 public void Show(DockPane previousPane, DockAlignment alignment, double proportion)
 {
     DockHandler.Show(previousPane, alignment, proportion);
 }
示例#6
0
 /// <summary>
 /// Docks the content area at the specified location.
 /// </summary>
 /// <param name="paneTo">The pane to which to dock.</param>
 /// <param name="dockStyle">The docking style.</param>
 /// <param name="contentIndex">The index to insert the panel.</param>
 public void DockTo(DockPane paneTo, DockStyle dockStyle, int contentIndex)
 {
     DockHandler.DockTo(paneTo, dockStyle, contentIndex);
 }
示例#7
0
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            if (dockStyle == DockStyle.Fill)
            {
                bool samePane = (Pane == pane);
                if (!samePane)
                    Pane = pane;

                if (contentIndex == -1 || !samePane)
                    pane.SetContentIndex(Content, contentIndex);
                else
                {
                    DockContentCollection contents = pane.Contents;
                    int oldIndex = contents.IndexOf(Content);
                    int newIndex = contentIndex;
                    if (oldIndex < newIndex)
                    {
                        newIndex += 1;
                        if (newIndex > contents.Count - 1)
                            newIndex = -1;
                    }
                    pane.SetContentIndex(Content, newIndex);
                }
            }
            else
            {
                DockPane paneFrom = DockPanel.DockPaneFactory.CreateDockPane(Content, pane.DockState, true);
                INestedPanesContainer container = pane.NestedPanesContainer;
                if (dockStyle == DockStyle.Left)
                    paneFrom.DockTo(container, pane, DockAlignment.Left, 0.5);
                else if (dockStyle == DockStyle.Right)
                    paneFrom.DockTo(container, pane, DockAlignment.Right, 0.5);
                else if (dockStyle == DockStyle.Top)
                    paneFrom.DockTo(container, pane, DockAlignment.Top, 0.5);
                else if (dockStyle == DockStyle.Bottom)
                    paneFrom.DockTo(container, pane, DockAlignment.Bottom, 0.5);

                paneFrom.DockState = pane.DockState;
            }
        }
示例#8
0
        public void Show(DockPane previousPane, DockAlignment alignment, double proportion)
        {
            if (previousPane == null)
                throw (new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane));

            if (DockHelper.IsDockStateAutoHide(previousPane.DockState))
                throw (new ArgumentException(Strings.DockContentHandler_Show_InvalidPrevPane));

            previousPane.DockPanel.SuspendLayout(true);

            DockPanel = previousPane.DockPanel;
            DockPanel.DockPaneFactory.CreateDockPane(Content, previousPane, alignment, proportion, true);
            Show();

            previousPane.DockPanel.ResumeLayout(true, true);
        }
示例#9
0
 private void SetPane(DockPane pane)
 {
     if (pane != null && pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.DockingMdi)
     {
         if (Form.Parent is DockPane)
             SetParent(null);
         if (Form.MdiParent != DockPanel.ParentForm)
         {
             FlagClipWindow = true;
             Form.MdiParent = DockPanel.ParentForm;
         }
     }
     else
     {
         FlagClipWindow = true;
         if (Form.MdiParent != null)
             Form.MdiParent = null;
         if (Form.TopLevel)
             Form.TopLevel = false;
         SetParent(pane);
     }
 }
示例#10
0
 public void Show(DockPane pane, DockStyle dock)
 {
     SaveOldValues();
     SetValues(Rectangle.Empty, pane, dock, -1);
     TestChange();
 }
示例#11
0
 private static void RefreshDockPane(DockPane pane)
 {
     pane.RefreshChanges();
     pane.ValidateActiveContent();
 }
示例#12
0
        internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
        {
            if (IsSuspendSetDockState)
            {
                return;
            }

            if (DockPanel == null && visibleState != DockState.Unknown)
            {
                throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel);
            }

            if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !IsDockStateValid(visibleState)))
            {
                throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState);
            }

            DockPanel dockPanel = DockPanel;

            if (dockPanel != null)
            {
                dockPanel.SuspendLayout(true);
            }

            SuspendSetDockState();

            DockState oldDockState = DockState;

            if (m_isHidden != isHidden || oldDockState == DockState.Unknown)
            {
                m_isHidden = isHidden;
            }
            m_visibleState = visibleState;
            m_dockState    = isHidden ? DockState.Hidden : visibleState;

            if (visibleState == DockState.Unknown)
            {
                Pane = null;
            }
            else
            {
                m_isFloat = (m_visibleState == DockState.Float);

                if (Pane == null)
                {
                    Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
                }
                else if (Pane.DockState != visibleState)
                {
                    if (Pane.Contents.Count == 1)
                    {
                        Pane.SetDockState(visibleState);
                    }
                    else
                    {
                        Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
                    }
                }
            }

            if (Form.ContainsFocus)
            {
                if (DockState == DockState.Hidden || DockState == DockState.Unknown)
                {
                    DockPanel.ContentFocusManager.GiveUpFocus(Content);
                }
            }

            SetPaneAndVisible(Pane);

            if (oldPane != null && !oldPane.IsDisposed && oldDockState == oldPane.DockState)
            {
                RefreshDockPane(oldPane);
            }

            if (Pane != null && DockState == Pane.DockState)
            {
                if ((Pane != oldPane) ||
                    (Pane == oldPane && oldDockState != oldPane.DockState))
                {
                    RefreshDockPane(Pane);
                }
            }

            if (oldDockState != DockState)
            {
                if (DockState == DockState.Hidden || DockState == DockState.Unknown ||
                    DockHelper.IsDockStateAutoHide(DockState))
                {
                    DockPanel.ContentFocusManager.RemoveFromList(Content);
                }
                else
                {
                    DockPanel.ContentFocusManager.AddToList(Content);
                }

                OnDockStateChanged(EventArgs.Empty);
            }
            ResumeSetDockState();

            if (dockPanel != null)
            {
                dockPanel.ResumeLayout(true, true);
            }
        }
示例#13
0
 private void ResumeSetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
 {
     ResumeSetDockState();
     SetDockState(isHidden, visibleState, oldPane);
 }
示例#14
0
 protected virtual Pane CreatePane(DockPane dockPane)
 {
     return(new Pane(dockPane));
 }
示例#15
0
 protected internal Pane(DockPane dockPane)
 {
     m_dockPane = dockPane;
 }
示例#16
0
 internal TabCollection(DockPane pane)
 {
     m_dockPane = pane;
 }
示例#17
0
                private void SetOutline(DockPane pane, DockStyle dock, int contentIndex)
                {
                    if (dock != DockStyle.Fill)
                    {
                        Rectangle rect = pane.DisplayingRectangle;
                        if (dock == DockStyle.Right)
                            rect.X += rect.Width / 2;
                        if (dock == DockStyle.Bottom)
                            rect.Y += rect.Height / 2;
                        if (dock == DockStyle.Left || dock == DockStyle.Right)
                            rect.Width -= rect.Width / 2;
                        if (dock == DockStyle.Top || dock == DockStyle.Bottom)
                            rect.Height -= rect.Height / 2;
                        rect.Location = pane.PointToScreen(rect.Location);

                        SetDragForm(rect);
                    }
                    else if (contentIndex == -1)
                    {
                        Rectangle rect = pane.DisplayingRectangle;
                        rect.Location = pane.PointToScreen(rect.Location);
                        SetDragForm(rect);
                    }
                    else
                    {
                        using (GraphicsPath path = pane.TabStripControl.GetOutline(contentIndex))
                        {
                            RectangleF rectF = path.GetBounds();
                            Rectangle rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
                            using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) }))
                            {
                                path.Transform(matrix);
                            }
                            Region region = new Region(path);
                            SetDragForm(rect, region);
                        }
                    }
                }
示例#18
0
        internal void RemovePane(DockPane pane)
        {
            if (!Panes.Contains(pane))
                return;

            Panes.Remove(pane);
        }
示例#19
0
 internal void SetPaneAndVisible(DockPane pane)
 {
     SetPane(pane);
     SetVisible();
 }
示例#20
0
 /// <summary>
 /// Shows the docking container next to the docking pane.
 /// </summary>
 /// <param name="pane">The docking panel on which to dock.</param>
 /// <param name="beforeContent">The docking container previous to this.</param>
 public void Show(DockPane pane, IDockContent beforeContent)
 {
     DockHandler.Show(pane, beforeContent);
 }
示例#21
0
 protected void ShowTabPageContextMenu(Point position)
 {
     DockPane.ShowTabPageContextMenu(this, position);
 }
示例#22
0
        public void Show(DockPane pane, IDockContent beforeContent)
        {
            if (pane == null)
                throw (new ArgumentNullException(Strings.DockContentHandler_Show_NullPane));

            if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1)
                throw (new ArgumentException(Strings.DockContentHandler_Show_InvalidBeforeContent));

            pane.DockPanel.SuspendLayout(true);

            DockPanel = pane.DockPanel;
            Pane = pane;
            pane.SetContentIndex(Content, pane.Contents.IndexOf(beforeContent));
            Show();

            pane.DockPanel.ResumeLayout(true, true);
        }
示例#23
0
 public DockPane CreateDockPane(IDockContent content, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
 {
     return new DockPane(content, prevPane, alignment, proportion, show);
 }
示例#24
0
        bool IDockDragSource.CanDockTo(DockPane pane)
        {
            if (!IsDockStateValid(pane.DockState))
                return false;

            if (Pane == pane && pane.DisplayingContents.Count == 1)
                return false;

            return true;
        }
示例#25
0
 public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
 {
     return new FloatWindow(dockPanel, pane, bounds);
 }
示例#26
0
 public DockPaneStripBase CreateDockPaneStrip(DockPane pane)
 {
     return new VS2005DockPaneStrip(pane);
 }
示例#27
0
 /// <summary>
 /// Shows the docking container in the specified order.
 /// </summary>
 /// <param name="previousPane">The pane after which to insert this item.</param>
 /// <param name="alignment">The docking alignment.</param>
 /// <param name="proportion">The proportion.</param>
 public void Show(DockPane previousPane, DockAlignment alignment, double proportion)
 {
     DockHandler.Show(previousPane, alignment, proportion);
 }
示例#28
0
 public FloatWindow CreateFloatWindow(DockPanel dockPanel, DockPane pane)
 {
     return new FloatWindow(dockPanel, pane);
 }
示例#29
0
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            if (dockStyle == DockStyle.Fill)
            {
                for (int i = NestedPanes.Count - 1; i >= 0; i--)
                {
                    DockPane paneFrom = NestedPanes[i];
                    for (int j = paneFrom.Contents.Count - 1; j >= 0; j--)
                    {
                        IDockContent c = paneFrom.Contents[j];
                        c.DockHandler.Pane = pane;
                        if (contentIndex != -1)
                            pane.SetContentIndex(c, contentIndex);
                    }
                }
            }
            else
            {
                DockAlignment alignment = DockAlignment.Left;
                if (dockStyle == DockStyle.Left)
                    alignment = DockAlignment.Left;
                else if (dockStyle == DockStyle.Right)
                    alignment = DockAlignment.Right;
                else if (dockStyle == DockStyle.Top)
                    alignment = DockAlignment.Top;
                else if (dockStyle == DockStyle.Bottom)
                    alignment = DockAlignment.Bottom;

                MergeNestedPanes(VisibleNestedPanes, pane.NestedPanesContainer.NestedPanes, pane, alignment, 0.5);
            }
        }
示例#30
0
 public DockPaneCaptionBase CreateDockPaneCaption(DockPane pane)
 {
     return new VS2005DockPaneCaption(pane);
 }
示例#31
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;
            }
        }
示例#32
0
 /// <summary>
 /// Shows the docking container next to the docking pane.
 /// </summary>
 /// <param name="pane">The docking panel on which to dock.</param>
 /// <param name="beforeContent">The docking container previous to this.</param>
 public void Show(DockPane pane, IDockContent beforeContent)
 {
     DockHandler.Show(pane, beforeContent);
 }
示例#33
0
 private void RemoveFromPane(DockPane pane)
 {
     pane.RemoveContent(Content);
     SetPane(null);
     if (pane.Contents.Count == 0)
         pane.Dispose();
 }
示例#34
0
 /// <summary>
 /// Docks the content area at the specified location.
 /// </summary>
 /// <param name="paneTo">The pane to which to dock.</param>
 /// <param name="dockStyle">The docking style.</param>
 /// <param name="contentIndex">The index to insert the panel.</param>
 public void DockTo(DockPane paneTo, DockStyle dockStyle, int contentIndex)
 {
     DockHandler.DockTo(paneTo, dockStyle, contentIndex);
 }
示例#35
0
 private void ResumeSetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
 {
     ResumeSetDockState();
     SetDockState(isHidden, visibleState, oldPane);
 }
示例#36
0
        internal void AddPane(DockPane pane)
        {
            if (Panes.Contains(pane))
                return;

            Panes.Add(pane);
        }
示例#37
0
        internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
        {
            if (IsSuspendSetDockState)
                return;

            if (DockPanel == null && visibleState != DockState.Unknown)
                throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel);

            if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !IsDockStateValid(visibleState)))
                throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState);

            DockPanel dockPanel = DockPanel;
            if (dockPanel != null)
                dockPanel.SuspendLayout(true);

            SuspendSetDockState();

            DockState oldDockState = DockState;

            if (m_isHidden != isHidden || oldDockState == DockState.Unknown)
            {
                m_isHidden = isHidden;
            }
            m_visibleState = visibleState;
            m_dockState = isHidden ? DockState.Hidden : visibleState;

            if (visibleState == DockState.Unknown)
                Pane = null;
            else
            {
                m_isFloat = (m_visibleState == DockState.Float);

                if (Pane == null)
                    Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
                else if (Pane.DockState != visibleState)
                {
                    if (Pane.Contents.Count == 1)
                        Pane.SetDockState(visibleState);
                    else
                        Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
                }
            }

            if (Form.ContainsFocus)
                if (DockState == DockState.Hidden || DockState == DockState.Unknown)
                    DockPanel.ContentFocusManager.GiveUpFocus(Content);

            SetPaneAndVisible(Pane);

            if (oldPane != null && !oldPane.IsDisposed && oldDockState == oldPane.DockState)
                RefreshDockPane(oldPane);

            if (Pane != null && DockState == Pane.DockState)
            {
                if ((Pane != oldPane) ||
                    (Pane == oldPane && oldDockState != oldPane.DockState))
                    RefreshDockPane(Pane);
            }

            if (oldDockState != DockState)
            {
                if (DockState == DockState.Hidden || DockState == DockState.Unknown ||
                    DockHelper.IsDockStateAutoHide(DockState))
                    DockPanel.ContentFocusManager.RemoveFromList(Content);
                else
                    DockPanel.ContentFocusManager.AddToList(Content);

                OnDockStateChanged(EventArgs.Empty);
            }
            ResumeSetDockState();

            if (dockPanel != null)
                dockPanel.ResumeLayout(true, true);
        }
示例#38
0
        public void SetPaneIndex(DockPane pane, int index)
        {
            int oldIndex = Panes.IndexOf(pane);
            if (oldIndex == -1)
                throw (new ArgumentException(Strings.DockPanel_SetPaneIndex_InvalidPane));

            if (index < 0 || index > Panes.Count - 1)
                if (index != -1)
                    throw (new ArgumentOutOfRangeException(Strings.DockPanel_SetPaneIndex_InvalidIndex));

            if (oldIndex == index)
                return;
            if (oldIndex == Panes.Count - 1 && index == -1)
                return;

            Panes.Remove(pane);
            if (index == -1)
                Panes.Add(pane);
            else if (oldIndex < index)
                Panes.AddAt(pane, index - 1);
            else
                Panes.AddAt(pane, index);
        }
示例#39
0
 private static void RefreshDockPane(DockPane pane)
 {
     pane.RefreshChanges();
     pane.ValidateActiveContent();
 }
示例#40
0
 public void Show(DockPane pane, int contentIndex)
 {
     SaveOldValues();
     SetValues(Rectangle.Empty, pane, DockStyle.Fill, contentIndex);
     TestChange();
 }
示例#41
0
 internal void SetPaneAndVisible(DockPane pane)
 {
     SetPane(pane);
     SetVisible();
 }