SetContentIndex() public method

public SetContentIndex ( IDockContent content, int index ) : void
content IDockContent
index int
return void
Beispiel #1
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;
                switch (dockStyle)
                {
                case DockStyle.Left:
                    paneFrom.DockTo(container, pane, DockAlignment.Left, 0.5);
                    break;

                case DockStyle.Right:
                    paneFrom.DockTo(container, pane, DockAlignment.Right, 0.5);
                    break;

                case DockStyle.Top:
                    paneFrom.DockTo(container, pane, DockAlignment.Top, 0.5);
                    break;

                case DockStyle.Bottom:
                    paneFrom.DockTo(container, pane, DockAlignment.Bottom, 0.5);
                    break;
                }

                paneFrom.DockState = pane.DockState;
            }
        }
Beispiel #2
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);
     this.DockPanel = pane.DockPanel;
     this.Pane      = pane;
     pane.SetContentIndex(this.Content, pane.Contents.IndexOf(beforeContent));
     this.Show();
     pane.DockPanel.ResumeLayout(true, true);
 }
Beispiel #3
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);
                        }
                        c.DockHandler.Activate();
                    }
                }
            }
            else
            {
                DockAlignment alignment = DockAlignment.Left;
                switch (dockStyle)
                {
                case DockStyle.Left:
                    alignment = DockAlignment.Left;
                    break;

                case DockStyle.Right:
                    alignment = DockAlignment.Right;
                    break;

                case DockStyle.Top:
                    alignment = DockAlignment.Top;
                    break;

                case DockStyle.Bottom:
                    alignment = DockAlignment.Bottom;
                    break;
                }

                MergeNestedPanes(VisibleNestedPanes, pane.NestedPanesContainer.NestedPanes, pane, alignment, 0.5);
            }
        }
Beispiel #4
0
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            if (dockStyle == DockStyle.Fill)
            {
                IDockContent activeContent = ActiveContent;
                for (int i = Contents.Count - 1; i >= 0; i--)
                {
                    IDockContent c = Contents[i];
                    if (c.DockHandler.DockState == DockState)
                    {
                        c.DockHandler.Pane = pane;
                        if (contentIndex != -1)
                        {
                            pane.SetContentIndex(c, contentIndex);
                        }
                    }
                }
                pane.ActiveContent = activeContent;
            }
            else
            {
                switch (dockStyle)
                {
                case DockStyle.Left:
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Left, 0.5);
                    break;

                case DockStyle.Right:
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Right, 0.5);
                    break;

                case DockStyle.Top:
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Top, 0.5);
                    break;

                case DockStyle.Bottom:
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Bottom, 0.5);
                    break;
                }

                DockState = pane.DockState;
            }
        }
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            Console.WriteLine("FloatWindow: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);
                        }
                        c.DockHandler.Activate();
                    }
                }
            }
            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);
            }
        }
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            Console.WriteLine("dockPane.DockTo DockPane DockStyle" + dockStyle.ToString() + "contentIndex" + contentIndex.ToString());
            if (dockStyle == DockStyle.Fill)
            {
                IDockContent activeContent = ActiveContent;
                for (int i = Contents.Count - 1; i >= 0; i--)
                {
                    IDockContent c = Contents[i];
                    if (c.DockHandler.DockState == DockState)
                    {
                        c.DockHandler.Pane = pane;
                        if (contentIndex != -1)
                        {
                            pane.SetContentIndex(c, contentIndex);
                        }
                    }
                }
                pane.ActiveContent = activeContent;
            }
            else
            {
                if (dockStyle == DockStyle.Left)
                {
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Left, 0.5);
                }
                else if (dockStyle == DockStyle.Right)
                {
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Right, 0.5);
                }
                else if (dockStyle == DockStyle.Top)
                {
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Top, 0.5);
                }
                else if (dockStyle == DockStyle.Bottom)
                {
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Bottom, 0.5);
                }

                DockState = pane.DockState;
            }
        }
Beispiel #7
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);
        }
Beispiel #8
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;
            }
        }
        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);
                        c.DockHandler.Activate();
                    }
                }
            }
            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);
            }
        }
Beispiel #10
0
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            if (dockStyle == DockStyle.Fill)
            {
                IDockContent activeContent = ActiveContent;
                for (int i = Contents.Count - 1; i >= 0; i--)
                {
                    IDockContent c = Contents[i];
                    if (c.DockHandler.DockState == DockState)
                    {
                        c.DockHandler.Pane = pane;
                        if (contentIndex != -1)
                            pane.SetContentIndex(c, contentIndex);
                    }
                }
                pane.ActiveContent = activeContent;
            }
            else
            {
                if (dockStyle == DockStyle.Left)
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Left, 0.5);
                else if (dockStyle == DockStyle.Right)
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Right, 0.5);
                else if (dockStyle == DockStyle.Top)
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Top, 0.5);
                else if (dockStyle == DockStyle.Bottom)
                    DockTo(pane.NestedPanesContainer, pane, DockAlignment.Bottom, 0.5);

                DockState = pane.DockState;
            }
        }
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            if (dockStyle == DockStyle.Fill)
            {
                bool samePane = (Pane == pane);
                if (!samePane)
                {
                    Pane = pane;
                }

                int visiblePanes   = 0;
                int convertedIndex = 0;
                while (visiblePanes <= contentIndex && convertedIndex < Pane.Contents.Count)
                {
                    DockContent window = Pane.Contents[convertedIndex] as DockContent;
                    if (window != null && !window.IsHidden)
                    {
                        ++visiblePanes;
                    }

                    ++convertedIndex;
                }

                contentIndex = Math.Min(Math.Max(0, convertedIndex - 1), Pane.Contents.Count - 1);

                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.Theme.Extender.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;
            }
        }
        public void DockTo(DockPane pane, DockStyle dockStyle, int contentIndex)
        {
            if (dockStyle == DockStyle.Fill)
            {
                bool samePane = (Pane == pane);
                if (!samePane)
                    Pane = pane;

                int visiblePanes = 0;
                int convertedIndex = 0;
                while (visiblePanes <= contentIndex && convertedIndex < Pane.Contents.Count)
                {
                    DockContent window = Pane.Contents[convertedIndex] as DockContent;
                    if (window != null && !window.IsHidden)
                        ++visiblePanes;

                    ++convertedIndex;
                }

                contentIndex = Math.Min(Math.Max(0, convertedIndex-1), Pane.Contents.Count - 1);

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