private IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { switch (msg) { case WM_CLOSE: if (FloatingWindow != null && FloatingWindow.DockControl != null) { PerformClose(); handled = true; } break; case WM_NCLBUTTONDOWN: if (wParam.ToInt32() == HTCAPTION && WindowState != WindowState.Maximized) { short x = (short)((lParam.ToInt32() & 0xFFFF)); short y = (short)((lParam.ToInt32() >> 16)); Point pt = new Point(x, y); DockManager.BeginDrag(this, this, pt); } break; case WM_NCLBUTTONDBLCLK: if (wParam.ToInt32() == HTCAPTION) { handled = DockCommands.Execute(this, DoubleClickCommand); } break; case WM_NCRBUTTONDOWN: if (wParam.ToInt32() == HTCAPTION && FloatingWindow.CountOfVisiblePanes == 1) { short x = (short)((lParam.ToInt32() & 0xFFFF)); short y = (short)((lParam.ToInt32() >> 16)); ContextMenu menu = FloatingWindow.FirstVisiblePane.SelectedItem.TabContextMenu; if (menu != null) { menu.Placement = PlacementMode.AbsolutePoint; menu.PlacementRectangle = new Rect(new Point(x, y), new Size(0, 0)); menu.PlacementTarget = this; menu.IsOpen = true; } } handled = true; break; } return(IntPtr.Zero); }
/// <exclude /> protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); if (e.Handled || !DockManager.CanDrag(e)) return; if (e.ClickCount == 1) { DockManager.BeginDrag(this, this, e); e.Handled = true; } else if (e.ClickCount == 2) e.Handled = DockCommands.Execute(this, DoubleClickCommand); }
void Refresh() { if (DockControl == null) { return; } LeftSplitterWidth = ConvertSplitterSize(DockControl.LeftDockTree.IsVisible); RightSplitterWidth = ConvertSplitterSize(DockControl.RightDockTree.IsVisible); TopSplitterHeight = ConvertSplitterSize(DockControl.TopDockTree.IsVisible); BottomSplitterHeight = ConvertSplitterSize(DockControl.BottomDockTree.IsVisible); IsLeftGuideVisible = DockManager.GetShowsLeftGuide(DockControl); IsRightGuideVisible = DockManager.GetShowsRightGuide(DockControl); IsTopGuideVisible = DockManager.GetShowsTopGuide(DockControl); IsBottomGuideVisible = DockManager.GetShowsBottomGuide(DockControl); IsDocumentGuideVisible = DockManager.GetShowsFillGuide(DockControl); LeftTreeWidth = RightTreeWidth = TopTreeHeight = BottomTreeHeight = new GridLength(); DockTreeClient dockTreeClient = FindVisualChild <DockTreeClient>(DockControl); foreach (DockTreeControl dockTreeControl in FindVisualChildren <DockTreeControl>(dockTreeClient)) { DockTree dockTree = dockTreeControl.DockTree; if (dockTree == null) { continue; } if (dockTree.Position == DockTreePosition.Left) { LeftTreeWidth = new GridLength(dockTreeControl.ActualWidth); } else if (dockTree.Position == DockTreePosition.Right) { RightTreeWidth = new GridLength(dockTreeControl.ActualWidth); } else if (dockTree.Position == DockTreePosition.Top) { TopTreeHeight = new GridLength(dockTreeControl.ActualHeight); } else if (dockTree.Position == DockTreePosition.Bottom) { BottomTreeHeight = new GridLength(dockTreeControl.ActualHeight); } } }
private void Attach(FrameworkElement associatedElement) { Debug.Assert(associatedElement != null); if (AssociatedElement != null) { throw new InvalidOperationException(SR.Exception_OverlayActivator_HostMultipleTimes); } if (!associatedElement.IsLoaded) { return; } AssociatedElement = associatedElement; Container = new ContentPresenter(); Container.Content = Content ?? AssociatedElement; Container.ContentTemplate = ContentTemplate; Container.ContentTemplateSelector = ContentTemplateSelector; DockManager.AddOverlay(this); }
/// <exclude /> protected override void OnMouseRightButtonDown(MouseButtonEventArgs e) { base.OnMouseRightButtonDown(e); if (e.Handled || !DockManager.CanDrag(e)) { return; } if (FloatingWindow.CountOfVisiblePanes == 1) { Point pt = e.GetPosition(this); ContextMenu menu = FloatingWindow.FirstVisiblePane.SelectedItem.TabContextMenu; if (menu != null) { menu.Placement = PlacementMode.RelativePoint; menu.PlacementRectangle = new Rect(pt, new Size(0, 0)); menu.PlacementTarget = this; menu.IsOpen = true; } e.Handled = true; } }
/// <exclude /> protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); if (e.Handled) { return; } if (e.ClickCount == 1) { DockItem dockItem = DockItem; if (dockItem != null) { dockItem.Activate(); UpdateLayout(); // Fix in 2.0.4846: this can avoid unnecessary mouse move event caused by layout change } DockManager.BeginDrag(this, this, e); e.Handled = true; } else if (e.ClickCount == 2) { e.Handled = DockCommands.Execute(this, DoubleClickCommand); } }
bool IDragSource.CanDrop(DockPane targetPane) { return(DockManager.CanDrop(DockPane, targetPane)); }
bool IDragSource.CanDrop(DockTreePosition dockTreePosition) { return(DockManager.CanDrop(DockPane, dockTreePosition)); }
Rect IDragSource.GetFloatingWindowPreview(RelativePoint mouseStartPosition) { return(DockManager.GetDefaultFloatingPreview(DockControl, mouseStartPosition.Point)); }
private static void OnToggleFloatingExecuted(object sender, ExecutedRoutedEventArgs e) { DockManager.ToggleFloating(((AutoHideWindow)sender).DockItem); }
private static void OnToggleFloatingExecuted(object sender, ExecutedRoutedEventArgs e) { DockManager.ToggleFloating(((DockWindow)sender).DockPane); }
void IDragSource.Drop(DockPane targetPane, DockPanePreviewPlacement placement) { DockManager.Drop(DockPane, targetPane, placement); }
void IDragSource.Drop(Dock dock, bool sendToBack) { DockManager.Drop(DockPane, dock, sendToBack); }
void IDragSource.Drop() { DockManager.Drop(FloatingWindow); }
void IDragSource.Drop(Dock dock, bool sendToBack) { DockManager.Drop(FloatingWindow, dock, sendToBack); }
bool IDragSource.CanDrop(DockItem targetItem) { return(DockManager.CanDrop(FloatingWindow, targetItem)); }
bool IDragSource.CanDrop(DockPane targetPane) { return(DockManager.CanDrop(FloatingWindow, targetPane)); }
bool IDragSource.CanDrop(DockTreePosition dockTreePosition) { return(DockManager.CanDrop(FloatingWindow, dockTreePosition)); }
bool IDragSource.CanDrop(DockPane targetPane) { return DockManager.CanDrop(DockItem, targetPane); }
bool IDragSource.CanDrop(DockItem targetItem) { return(DockManager.CanDrop(DockPane, targetItem)); }
void IDragSource.Drop() { DockManager.Drop(DockPane); }
void IDragSource.Drop(DockItem targetItem) { DockManager.Drop(FloatingWindow, targetItem); }
void IDragSource.Drop(Rect floatingWindowBounds) { DockManager.Drop(DockPane, floatingWindowBounds); }
bool IDragSource.CanDrop(DockTreePosition dockTreePosition) { return DockManager.CanDrop(DockItem, dockTreePosition); }
void IDragSource.Drop(DockItem targetItem) { DockManager.Drop(DockPane, targetItem); }
void IDragSource.Drop() { DockManager.Drop(DockItem); }
void OnToggleFloatingExecuted() { DockManager.ToggleFloating(FloatingWindow); }
bool IDragSource.CanDrop(DockItem targetItem) { return DockManager.CanDrop(DockItem, targetItem); }