Exemplo n.º 1
0
 /// <include file='CodeDoc\DisplayingDockList.xml' path='//CodeDoc/Class[@name="DisplayingDockList"]/Method[@name="Contains(DockPane)"]/*'/>
 public bool Contains(DockPane pane)
 {
     return(InnerList.Contains(pane));
 }
Exemplo n.º 2
0
 /// <include file='CodeDoc\DisplayingDockList.xml' path='//CodeDoc/Class[@name="DisplayingDockList"]/Method[@name="IndexOf(DockPane)"]/*'/>
 public int IndexOf(DockPane pane)
 {
     return(InnerList.IndexOf(pane));
 }
Exemplo n.º 3
0
        private void CalculateBounds()
        {
            if (Count == 0)
            {
                return;
            }

            this[0].NestedDockingStatus.SetDisplayingBounds(Container.DisplayingRectangle, Container.DisplayingRectangle, Rectangle.Empty);

            for (int i = 1; i < Count; i++)
            {
                DockPane            pane       = this[i];
                NestedDockingStatus status     = pane.NestedDockingStatus;
                DockPane            prevPane   = status.DisplayingPrevPane;
                NestedDockingStatus statusPrev = prevPane.NestedDockingStatus;

                Rectangle rect = statusPrev.PaneBounds;
                bool      bVerticalSplitter = (status.DisplayingAlignment == DockAlignment.Left || status.DisplayingAlignment == DockAlignment.Right);

                Rectangle rectThis     = rect;
                Rectangle rectPrev     = rect;
                Rectangle rectSplitter = rect;
                if (status.DisplayingAlignment == DockAlignment.Left)
                {
                    rectThis.Width     = (int)((double)rect.Width * status.DisplayingProportion) - (Measures.SplitterSize / 2);
                    rectSplitter.X     = rectThis.X + rectThis.Width;
                    rectSplitter.Width = Measures.SplitterSize;
                    rectPrev.X         = rectSplitter.X + rectSplitter.Width;
                    rectPrev.Width     = rect.Width - rectThis.Width - rectSplitter.Width;
                }
                else if (status.DisplayingAlignment == DockAlignment.Right)
                {
                    rectPrev.Width     = (rect.Width - (int)((double)rect.Width * status.DisplayingProportion)) - (Measures.SplitterSize / 2);
                    rectSplitter.X     = rectPrev.X + rectPrev.Width;
                    rectSplitter.Width = Measures.SplitterSize;
                    rectThis.X         = rectSplitter.X + rectSplitter.Width;
                    rectThis.Width     = rect.Width - rectPrev.Width - rectSplitter.Width;
                }
                else if (status.DisplayingAlignment == DockAlignment.Top)
                {
                    rectThis.Height     = (int)((double)rect.Height * status.DisplayingProportion) - (Measures.SplitterSize / 2);
                    rectSplitter.Y      = rectThis.Y + rectThis.Height;
                    rectSplitter.Height = Measures.SplitterSize;
                    rectPrev.Y          = rectSplitter.Y + rectSplitter.Height;
                    rectPrev.Height     = rect.Height - rectThis.Height - rectSplitter.Height;
                }
                else if (status.DisplayingAlignment == DockAlignment.Bottom)
                {
                    rectPrev.Height     = (rect.Height - (int)((double)rect.Height * status.DisplayingProportion)) - (Measures.SplitterSize / 2);
                    rectSplitter.Y      = rectPrev.Y + rectPrev.Height;
                    rectSplitter.Height = Measures.SplitterSize;
                    rectThis.Y          = rectSplitter.Y + rectSplitter.Height;
                    rectThis.Height     = rect.Height - rectPrev.Height - rectSplitter.Height;
                }
                else
                {
                    rectThis = Rectangle.Empty;
                }

                rectSplitter.Intersect(rect);
                rectThis.Intersect(rect);
                rectPrev.Intersect(rect);
                status.SetDisplayingBounds(rect, rectThis, rectSplitter);
                statusPrev.SetDisplayingBounds(statusPrev.LogicalBounds, rectPrev, statusPrev.SplitterBounds);
            }
        }
Exemplo n.º 4
0
        private void RefreshChanges()
        {
            Region    region       = new Region(Rectangle.Empty);
            Rectangle rectDockArea = FullPanelEdge ? DockPanel.DockArea : DockPanel.DocumentWindowBounds;

            rectDockArea.Location = DockPanel.PointToScreen(rectDockArea.Location);
            if (ShouldPanelIndicatorVisible(DockState.DockLeft))
            {
                PanelLeft.Location = new Point(rectDockArea.X + _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
                PanelLeft.Visible  = true;
                region.Union(PanelLeft.Bounds);
            }
            else
            {
                PanelLeft.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockRight))
            {
                PanelRight.Location = new Point(rectDockArea.X + rectDockArea.Width - PanelRight.Width - _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
                PanelRight.Visible  = true;
                region.Union(PanelRight.Bounds);
            }
            else
            {
                PanelRight.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockTop))
            {
                PanelTop.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelTop.Width) / 2, rectDockArea.Y + _PanelIndicatorMargin);
                PanelTop.Visible  = true;
                region.Union(PanelTop.Bounds);
            }
            else
            {
                PanelTop.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockBottom))
            {
                PanelBottom.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelBottom.Width) / 2, rectDockArea.Y + rectDockArea.Height - PanelBottom.Height - _PanelIndicatorMargin);
                PanelBottom.Visible  = true;
                region.Union(PanelBottom.Bounds);
            }
            else
            {
                PanelBottom.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.Document))
            {
                Rectangle rectDocumentWindow = DockPanel.DocumentWindowBounds;
                rectDocumentWindow.Location = DockPanel.PointToScreen(rectDocumentWindow.Location);
                PanelFill.Location          = new Point(rectDocumentWindow.X + (rectDocumentWindow.Width - PanelFill.Width) / 2, rectDocumentWindow.Y + (rectDocumentWindow.Height - PanelFill.Height) / 2);
                PanelFill.Visible           = true;
                region.Union(PanelFill.Bounds);
            }
            else
            {
                PanelFill.Visible = false;
            }

            if (ShouldPaneDiamondVisible())
            {
                Rectangle rect = DockPane.ClientRectangle;
                rect.Location        = DockPane.PointToScreen(rect.Location);
                PaneDiamond.Location = new Point(rect.Left + (rect.Width - PaneDiamond.Width) / 2, rect.Top + (rect.Height - PaneDiamond.Height) / 2);
                PaneDiamond.Visible  = true;
                using (GraphicsPath graphicsPath = PaneDiamond.DisplayingGraphicsPath.Clone() as GraphicsPath)
                {
                    Point[] pts = new Point[]
                    {
                        new Point(PaneDiamond.Left, PaneDiamond.Top),
                        new Point(PaneDiamond.Right, PaneDiamond.Top),
                        new Point(PaneDiamond.Left, PaneDiamond.Bottom)
                    };
                    using (Matrix matrix = new Matrix(PaneDiamond.ClientRectangle, pts))
                    {
                        graphicsPath.Transform(matrix);
                    }
                    region.Union(graphicsPath);
                }
            }
            else
            {
                PaneDiamond.Visible = false;
            }

            Region = region;
        }
Exemplo n.º 5
0
 private void RefreshDockPane(DockPane pane)
 {
     pane.RefreshChanges();
     pane.ValidateActiveContent();
 }
Exemplo n.º 6
0
        internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
        {
            if (IsSuspendSetDockState)
            {
                return;
            }

            if (DockPanel == null && visibleState != DockState.Unknown)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("IDockContent.SetDockState.NullPanel"));
            }

            if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !IsDockStateValid(visibleState)))
            {
                throw new InvalidOperationException(ResourceHelper.GetString("IDockContent.SetDockState.InvalidState"));
            }

            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);
                    }
                }
            }

            SetPane(Pane);
            SetVisible();

            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)
            {
                OnDockStateChanged(EventArgs.Empty);
            }

            ResumeSetDockState();
        }
Exemplo n.º 7
0
 private void ResumeSetDockState(bool isHidden, DockState visibleState, DockPane oldPane)
 {
     ResumeSetDockState();
     SetDockState(isHidden, visibleState, oldPane);
 }