/// <include file='CodeDoc\DockContentHandler.xml' path='//CodeDoc/Class[@name="DockContentHandler"]/Method[@name="Show(DockPane, IDockContent)"]/*'/> public void Show(DockPane pane, IDockableWindow beforeContent) { if (pane == null) { throw(new ArgumentNullException(ResourceHelper.GetString("IDockContent.Show.NullPane"))); } if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1) { throw(new ArgumentException(ResourceHelper.GetString("IDockContent.Show.InvalidBeforeContent"))); } DockPanel = pane.DockPanel; Pane = pane; pane.SetContentIndex(Content, pane.Contents.IndexOf(beforeContent)); Show(); }
private void FloatWindow_OnEndDrag(bool abort) { if (abort) { return; } FloatWindow floatWindow = (FloatWindow)DragControl; if (!DockOutline.FloatWindowBounds.IsEmpty) { DragControl.Bounds = DockOutline.FloatWindowBounds; } else if (DockOutline.DockTo is DockPane) { DockPane paneTo = DockOutline.DockTo as DockPane; if (DockOutline.Dock == DockStyle.Fill) { for (int i = floatWindow.DockList.Count - 1; i >= 0; i--) { DockPane pane = floatWindow.DockList[i]; for (int j = pane.Contents.Count - 1; j >= 0; j--) { IDockableWindow c = pane.Contents[j]; c.DockHandler.Pane = paneTo; if (DockOutline.ContentIndex != -1) { paneTo.SetContentIndex(c, DockOutline.ContentIndex); } c.DockHandler.Activate(); } } } else { DockAlignment alignment = DockAlignment.Left; if (DockOutline.Dock == DockStyle.Left) { alignment = DockAlignment.Left; } else if (DockOutline.Dock == DockStyle.Right) { alignment = DockAlignment.Right; } else if (DockOutline.Dock == DockStyle.Top) { alignment = DockAlignment.Top; } else if (DockOutline.Dock == DockStyle.Bottom) { alignment = DockAlignment.Bottom; } MergeDockList(floatWindow.DisplayingList, paneTo.DockListContainer.DockList, paneTo, alignment, 0.5); } } else if (DockOutline.DockTo is DockContainer) { SetDockWindow(); DockList dockListTo = null; if (DockOutline.Dock == DockStyle.Top) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockTop].DockList; } else if (DockOutline.Dock == DockStyle.Bottom) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockBottom].DockList; } else if (DockOutline.Dock == DockStyle.Left) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockLeft].DockList; } else if (DockOutline.Dock == DockStyle.Right) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.DockRight].DockList; } else if (DockOutline.Dock == DockStyle.Fill) { dockListTo = floatWindow.DockPanel.DockWindows[DockState.Document].DockList; } DockPane prevPane = null; for (int i = dockListTo.Count - 1; i >= 0; i--) { if (dockListTo[i] != floatWindow.DisplayingList[0]) { prevPane = dockListTo[i]; } } MergeDockList(floatWindow.DisplayingList, dockListTo, prevPane, DockAlignment.Left, 0.5); } }
private void Pane_OnEndDrag(bool abort) { User32.SetCursor(DragControl.Cursor.Handle); if (abort) { return; } DockPane pane = (DockPane)DragControl; if (!DockOutline.FloatWindowBounds.IsEmpty) { if (pane.FloatWindow == null || pane.FloatWindow.DockList.Count != 1) { pane.FloatWindow = pane.DockPanel.FloatWindowFactory.CreateFloatWindow(pane.DockPanel, pane, DockOutline.FloatWindowBounds); } else { pane.FloatWindow.Bounds = DockOutline.FloatWindowBounds; } pane.DockState = DockState.Float; pane.Activate(); } else if (DockOutline.DockTo is DockPane) { DockPane paneTo = DockOutline.DockTo as DockPane; if (DockOutline.Dock == DockStyle.Fill) { for (int i = pane.Contents.Count - 1; i >= 0; i--) { IDockableWindow c = pane.Contents[i]; c.DockHandler.Pane = paneTo; if (DockOutline.ContentIndex != -1) { paneTo.SetContentIndex(c, DockOutline.ContentIndex); } c.DockHandler.Activate(); } } else { if (DockOutline.Dock == DockStyle.Left) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Left, 0.5); } else if (DockOutline.Dock == DockStyle.Right) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Right, 0.5); } else if (DockOutline.Dock == DockStyle.Top) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Top, 0.5); } else if (DockOutline.Dock == DockStyle.Bottom) { pane.AddToDockList(paneTo.DockListContainer, paneTo, DockAlignment.Bottom, 0.5); } pane.DockState = paneTo.DockState; pane.Activate(); } } else if (DockOutline.DockTo is DockContainer) { SetDockWindow(); if (DockOutline.Dock == DockStyle.Top) { pane.DockState = DockState.DockTop; } else if (DockOutline.Dock == DockStyle.Bottom) { pane.DockState = DockState.DockBottom; } else if (DockOutline.Dock == DockStyle.Left) { pane.DockState = DockState.DockLeft; } else if (DockOutline.Dock == DockStyle.Right) { pane.DockState = DockState.DockRight; } else if (DockOutline.Dock == DockStyle.Fill) { pane.DockState = DockState.Document; } pane.Activate(); } }
private void Content_OnEndDrag(bool abort) { User32.SetCursor(DragControl.Cursor.Handle); if (abort) { return; } IDockableWindow content = DragControl as IDockableWindow; 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 DockContainer) { DockPane pane; DockContainer 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(); } }