Esempio n. 1
0
        /// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Method[@name="SetPaneIndex(DockPane, int)"]/*'/>
        public void SetPaneIndex(DockPane pane, int index)
        {
            int oldIndex = Panes.IndexOf(pane);

            if (oldIndex == -1)
            {
                throw(new ArgumentException(ResourceHelper.GetString("DockPanel.SetPaneIndex.InvalidPane")));
            }

            if (index < 0 || index > Panes.Count - 1)
            {
                if (index != -1)
                {
                    throw(new ArgumentOutOfRangeException(ResourceHelper.GetString("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);
            }

            if (pane.DockState == DockState.Float)
            {
                pane.FloatWindow.PerformLayout();
            }
            else if (DockHelper.IsDockWindowState(pane.DockState))
            {
                DockWindows[pane.DockState].PerformLayout();
            }
            else if (DockHelper.IsDockStateAutoHide(pane.DockState))
            {
                Refresh();
            }
        }
Esempio n. 2
0
        private void InternalAddToDockList(IDockListContainer container, DockPane prevPane, DockAlignment alignment, double proportion)
        {
            if ((container.DockState == DockState.Float) != IsFloat)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("DockPane.AddToDockList.InvalidContainer"));
            }

            int count = container.DockList.Count;

            if (container.DockList.Contains(this))
            {
                count--;
            }
            if (prevPane == null && count > 0)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("DockPane.AddToDockList.NullPrevPane"));
            }

            if (prevPane != null && !container.DockList.Contains(prevPane))
            {
                throw new InvalidOperationException(ResourceHelper.GetString("DockPane.AddToDockList.NoPrevPane"));
            }

            if (prevPane == this)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("DockPane.AddToDockList.SelfPrevPane"));
            }

            IDockListContainer oldContainer = DockListContainer;
            DockState          oldDockState = DockState;

            container.DockList.Add(this);
            NestedDockingStatus.SetStatus(container.DockList, prevPane, alignment, proportion);

            if (DockHelper.IsDockWindowState(DockState))
            {
                m_dockState = container.DockState;
            }

            RefreshStateChange(oldContainer, oldDockState);
        }