internal void RefreshState() { _isStateLocked = false; DockTree dockTree = DockTree; DockControl = dockTree == null ? null : dockTree.DockControl; FloatingWindow = dockTree == null ? null : dockTree.FloatingWindow; RefreshStateCore(); }
internal FloatingWindow(DockControl dockControl, Rect bounds) { Debug.Assert(dockControl != null); DockControl = dockControl; Left = bounds.Left; Top = bounds.Top; Width = bounds.Width; Height = bounds.Height; DockTree = new DockTree(this); }
internal void RemoveItem(DockItem item, bool removePane) { Debug.Assert(Items.Contains(item)); Debug.Assert(DockTree != null); DockTree.AddDirtyNode(this); Items.Remove(item); if (Items.Count == 0 && removePane) { DockTree.RemovePane(this); } }
private void UpdateActivePanes(DockTree dockTree) { CollectionUtil.Synchronize(GetActivePanes(dockTree), dockTree.ActivePanes, delegate(int index, DockPane item) { dockTree.ActivePanes.Insert(index, item); }, delegate(DockPane item) { dockTree.ActivePanes.Remove(item); }); if (dockTree.ActivePanes.Count != dockTree.VisiblePanes.Count) { throw new InvalidOperationException(); } Debug.Assert(dockTree.ActivePanes.Count == dockTree.VisiblePanes.Count); }
/// <summary>Initializes a new instance of the <see cref="DockControl"/> class.</summary> public DockControl() { bool designMode = DesignerProperties.GetIsInDesignMode(this); VerifyLicense(designMode); _dockItems = new DockItemCollection(this); _floatingWindows = new FloatingWindowCollection(); LeftDockTree = new DockTree(this, DockTreePosition.Left); RightDockTree = new DockTree(this, DockTreePosition.Right); TopDockTree = new DockTree(this, DockTreePosition.Top); BottomDockTree = new DockTree(this, DockTreePosition.Bottom); DocumentDockTree = new DockTree(this, DockTreePosition.Document); _undoStack = new UndoRedoStack <ICommand>(MaxUndoLevel); _redoStack = new UndoRedoStack <ICommand>(MaxUndoLevel); PaneManager = new DockPaneManager(this); this.Loaded += new RoutedEventHandler(OnLoaded); }
private IEnumerable <DockPane> GetActivePanes(DockTree dockTree) { foreach (DockPane dockPane in dockTree.VisiblePanes) { if (!_activatedPanes.Contains(dockPane)) { yield return(dockPane); } } foreach (DockPane dockPane in _activatedPanes) { if (dockPane.DockTree == dockTree && dockTree.VisiblePanes.Contains(dockPane)) { yield return(dockPane); } } }
private static ShowAction GetShowAsDockTreeRootAction(DockItem item, DockPane pane) { DockControl dockControl = item.DockControl; int source = dockControl.DockItems.IndexOf(item); DockItemShowMethod showMethod = GetShowMethod(item, pane); DockTree dockTree = pane.DockTree; if (dockTree.IsFloating) { FloatingWindow floatingWindow = dockTree.FloatingWindow; Rect bounds = new Rect(floatingWindow.Left, floatingWindow.Top, floatingWindow.Width, floatingWindow.Height); return(new ShowAsFloatingAction(source, bounds, showMethod)); } else { DockPosition dockPosition = DockPositionHelper.GetDockPosition(pane.DockTreePosition, pane.IsAutoHide); return(new ShowAsDockPositionAction(source, dockPosition, showMethod)); } }
internal void SetParent(DockTree dockTree) { Debug.Assert(dockTree != null); Debug.Assert(_parent == null); SetParentCore(dockTree); }
private ShowAction GetShowAction(DockItem item, DockPane pane) { Debug.Assert(item != null); Debug.Assert(pane != null && pane.Items.Contains(item)); Debug.Assert(item.FirstPane == pane || item.SecondPane == pane); int source = GetIndex(item); DockItemShowMethod showMethod = item.SecondPane == pane || item.IsHidden ? DockItemShowMethod.Hide : DockItemShowMethod.Activate; Collection <DockItem> items; ShowAction action; if (_panes.Contains(pane)) { items = GetItems(pane); DockItem targetItem = items[0]; int targetIndex = GetIndex(targetItem); DockItem itemToInsert = FindItemToInsert(item, pane); int index = itemToInsert == null ? -1 : items.IndexOf(itemToInsert); action = new ShowAsTabbedAction(source, targetIndex, pane.IsFloating, index, showMethod); } else { if (IsDockTreeEmpty(pane)) { DockTree dockTree = pane.DockTree; if (dockTree.IsFloating) { showMethod = DockItemShowMethod.Activate; FloatingWindow floatingWindow = dockTree.FloatingWindow; Rect bounds = new Rect(floatingWindow.Left, floatingWindow.Top, floatingWindow.Width, floatingWindow.Height); action = new ShowAsFloatingAction(source, bounds, showMethod); } else { DockPosition dockPosition = DockPositionHelper.GetDockPosition(pane.DockTreePosition, pane.IsAutoHide); action = new ShowAsDockPositionAction(source, dockPosition, showMethod); } } else { DockPane targetPane = null; DockPaneSplit split; for (split = pane.Parent; split != null; split = split.Parent) { foreach (DockPane pane1 in _panes) { if (split.IsParentOf(pane1)) { targetPane = pane1; break; } } if (targetPane != null) { break; } } Debug.Assert(targetPane != null); Debug.Assert(split != null); int ancestorSplitLevel = 0; foreach (DockPaneSplit split1 in _splits) { if (split.IsParentOf(split1) && split1.IsParentOf(targetPane)) { ancestorSplitLevel++; } } action = GetShowAsSidePaneAction(item, pane, targetPane, ancestorSplitLevel, split, showMethod); _splits.Add(split); } _panes.Add(pane); items = new Collection <DockItem>(); _itemsCollections.Add(items); } items.Add(item); return(action); }