Пример #1
0
        /// <include file='CodeDoc\DockPane.xml' path='//CodeDoc/Class[@name="DockPane"]/Method[@name="AddToDockList(IDockListContainer, DockPane, DockAlignment, double)"]/*'/>
        public DockPane AddToDockList(IDockListContainer container, DockPane prevPane, DockAlignment alignment, double proportion)
        {
            if (container == null)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("DockPane.AddToDockList.NullContainer"));
            }

            if (container.IsFloat == this.IsFloat)
            {
                InternalAddToDockList(container, prevPane, alignment, proportion);
                return(this);
            }

            IDockContent firstContent = GetFirstContent(container.DockState);

            if (firstContent == null)
            {
                return(null);
            }

            DockPane pane;

            DockPanel.DummyContent.DockPanel = DockPanel;
            if (container.IsFloat)
            {
                pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, (FloatWindow)container, true);
            }
            else
            {
                pane = DockPanel.DockPaneFactory.CreateDockPane(DockPanel.DummyContent, container.DockState, true);
            }

            pane.AddToDockList(container, prevPane, alignment, proportion);
            SetVisibleContentsToPane(pane);
            DockPanel.DummyContent.DockPanel = null;

            return(pane);
        }
Пример #2
0
 protected override string GetLocalizedString(string key)
 {
     return(ResourceHelper.GetString(key));
 }
Пример #3
0
        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(ResourceHelper.GetString("DockPane.DockState.InvalidState"));
            }

            if (content == null)
            {
                throw new ArgumentNullException(ResourceHelper.GetString("DockPane.Constructor.NullContent"));
            }

            if (content.DockHandler.DockPanel == null)
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPane.Constructor.NullDockPanel"));
            }


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

            m_isFloat = (dockState == DockState.Float);

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

            m_splitter = new DockPaneSplitter(this);

            m_nestedDockingStatus = new NestedDockingStatus(this);

            m_autoHidePane    = DockPanel.AutoHidePaneFactory.CreateAutoHidePane(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)
            {
                AddToDockList(prevPane.DockListContainer, 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);
        }