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); }
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); }
private void Content_OnEndDrag(bool abort) { User32.SetCursor(DragControl.Cursor.Handle); if (abort) { return; } IDockContent content = DragControl as IDockContent; if (!DockOutline.FloatWindowBounds.IsEmpty) { DockPane pane = content.DockHandler.DockPanel.DockPaneFactory.CreateDockPane(content, DockOutline.FloatWindowBounds, true); pane.Activate(); } else if (DockOutline.DockTo is DockPane) { DockPane paneTo = DockOutline.DockTo as DockPane; if (DockOutline.Dock == DockStyle.Fill) { bool samePane = (content.DockHandler.Pane == paneTo); if (!samePane) { content.DockHandler.Pane = paneTo; } if (DockOutline.ContentIndex == -1 || !samePane) { paneTo.SetContentIndex(content, DockOutline.ContentIndex); } else { DockContentCollection contents = paneTo.Contents; int oldIndex = contents.IndexOf(content); int newIndex = DockOutline.ContentIndex; if (oldIndex < newIndex) { newIndex += 1; if (newIndex > contents.Count - 1) { newIndex = -1; } } paneTo.SetContentIndex(content, newIndex); } content.DockHandler.Activate(); } else { DockPane pane = content.DockHandler.DockPanel.DockPaneFactory.CreateDockPane(content, paneTo.DockState, true); IDockListContainer container = paneTo.DockListContainer; if (DockOutline.Dock == DockStyle.Left) { pane.AddToDockList(container, paneTo, DockAlignment.Left, 0.5); } else if (DockOutline.Dock == DockStyle.Right) { pane.AddToDockList(container, paneTo, DockAlignment.Right, 0.5); } else if (DockOutline.Dock == DockStyle.Top) { pane.AddToDockList(container, paneTo, DockAlignment.Top, 0.5); } else if (DockOutline.Dock == DockStyle.Bottom) { pane.AddToDockList(container, paneTo, DockAlignment.Bottom, 0.5); } pane.DockState = paneTo.DockState; pane.Activate(); } } else if (DockOutline.DockTo is DockPanel) { DockPane pane; DockPanel dockPanel = content.DockHandler.DockPanel; SetDockWindow(); if (DockOutline.Dock == DockStyle.Top) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockTop, true); } else if (DockOutline.Dock == DockStyle.Bottom) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockBottom, true); } else if (DockOutline.Dock == DockStyle.Left) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockLeft, true); } else if (DockOutline.Dock == DockStyle.Right) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.DockRight, true); } else if (DockOutline.Dock == DockStyle.Fill) { pane = dockPanel.DockPaneFactory.CreateDockPane(content, DockState.Document, true); } else { return; } pane.Activate(); } }