private void Initialize(FloatingWindow floatingWindow, Rect oldValue, Rect newValue) { DockControl dockControl = floatingWindow.DockControl; DockItem dockItem = floatingWindow.Panes[0].Items[0]; _dockItemIndex = dockControl.DockItems.IndexOf(dockItem); _oldValue = oldValue; _newValue = newValue; }
private DockTree(DockControl dockControl, FloatingWindow floatingWindow, DockTreePosition dockTreePosition) { DockControl = dockControl; _floatingWindow = floatingWindow; _panes = new DockPaneCollection(); _visiblePanes = new DockPaneCollection(); _activePanes = new DockPaneCollection(); _autoHidePanes = new DockPaneCollection(); _autoHideItems = new DockItemCollection(); _dirtyNodes = new List <DockPaneNode>(); Position = dockTreePosition; }
internal void OnDockItemFocusEnter(DockItem item) { Debug.Assert(item.IsSelected); DockPane pane = item.FirstPane; FloatingWindow floatingWindow = pane.FloatingWindow; _dockControl.FloatingWindows.BringToFront(floatingWindow); BringToFront(pane); FocusedItem = item; if (!_isDockItemStateChanging) { CoerceValues(); RaiseEvents(); } }
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)); } }
private static void OnBoundsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FloatingWindow floatingWindow = (FloatingWindow)d; DockControl dockControl = floatingWindow.DockControl; if (dockControl == null) { return; } Rect oldBounds = floatingWindow.GetBounds(e.Property, (double)e.OldValue); Rect newBounds = floatingWindow.GetBounds(e.Property, (double)e.NewValue); UpdateBoundsData oldValue = new UpdateBoundsData(floatingWindow, oldBounds); UpdateBoundsData newValue = new UpdateBoundsData(floatingWindow, newBounds); dockControl.OnValueChanged(oldValue, newValue, delegate(UpdateBoundsData oldData, UpdateBoundsData newData) { return(new UpdateBoundsCommand(oldData.FloatingWindow, oldData.Value, newData.Value)); }); }
public UpdateBoundsData(FloatingWindow floatingWindow, Rect value) { FloatingWindow = floatingWindow; Value = value; }
internal DockTree(FloatingWindow floatingWindow) : this(floatingWindow.DockControl, floatingWindow, DockTreePosition.Floating) { }
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); }
internal void RemoveFloatingWindow(FloatingWindow floatingWindow) { Debug.Assert(floatingWindow != null); Debug.Assert(FloatingWindows.Contains(floatingWindow)); FloatingWindows.Remove(floatingWindow); }
public UpdateBoundsCommand(FloatingWindow floatingWindow, Rect oldValue, Rect newValue) { Initialize(floatingWindow, oldValue, newValue); }