public override DockFloatingBay PurgePane(DockPane pane, Point windowLocation, Size windowSize) { var bay = new DockFloatingBay(); bay.Items.Add(pane); bay.WindowTop = windowLocation.Y; bay.WindowLeft = windowLocation.X; bay.WindowWidth = windowSize.Width; bay.WindowHeight = windowSize.Height; FloatingBays.Add(bay); return bay; }
public DockFloatingWindow(DockFloatingBay bay) { InitializeComponent(); _isDraging = false; Loaded += DockFloatingWindow_Loaded; Closed += DockFloatingWindow_Closed; MouseMove += DockFloatingWindow_MouseMove; MouseUp += DockFloatingWindow_MouseUp; Content = bay; DockBay = bay; ShowInTaskbar = false; RegisterName("bay", bay); }
public DockFloatingBayLayoutEngine(DockFloatingBay target) : base(target) { IsClosed = false; PaneRemoved += DockFloatingBayLayoutEngine_PaneRemoved; }
void wnd_WindowDraged(object sender, EventArgs e) { //Helperを表示するBayがあるかどうかを調べる var mvForm = (DockFloatingWindow)sender; var hoverBay = _baysOrder.Concat(new[] { this }).Where(bay => { var mp = Mouse.GetPosition(bay); return bay != mvForm.DockBay && (mp.X >= 0 && mp.X < bay.RenderSize.Width && mp.Y >= 0 && mp.Y < bay.RenderSize.Height); }).FirstOrDefault(); _dragingBay = mvForm.DockBay; _hoverBay = hoverBay; //Helperを表示する必要がある場合は表示とマウスが乗ってる座標下の //Paneも探す。無い場合は非表示にし、各一時保存用変数をクリアする if (hoverBay != null) { var mPos = Mouse.GetPosition(hoverBay); var childAtPoint = hoverBay.GetChildAtPoint(mPos); _dragEffect = DockingHelper.GetDragDropEffect(hoverBay, childAtPoint); _hoverPane = childAtPoint; DockingHelper.ActiveIndicator = _dragEffect; } else { DockingHelper.Visibility = System.Windows.Visibility.Hidden; _dragEffect = DragDropEffects.None; _hoverPane = null; DockingHelper.ActiveIndicator = _dragEffect; } OnFloatingWindowMoved(new FloatFormEventArgs((DockFloatingWindow)sender)); }
void wnd_EndWindowDrag(object sender, EventArgs e) { if (_dragingBay == null) return; var len = _dragingBay.Items.Count == 1 && ((DockPaneBase)_dragingBay.Items[0]).Items.Count == 0 ? ((DockPaneBase)_dragingBay.Items[0]).Length : new DockLength(); switch (_dragEffect) { case DragDropEffects.Top: _hoverPane.AddPanesOf(_dragingBay, DockDirection.Top, len); Window.GetWindow(this).Activate(); break; case DragDropEffects.Bottom: _hoverPane.AddPanesOf(_dragingBay, DockDirection.Bottom, len); Window.GetWindow(this).Activate(); break; case DragDropEffects.Left: _hoverPane.AddPanesOf(_dragingBay, DockDirection.Left, len); Window.GetWindow(this).Activate(); break; case DragDropEffects.Right: _hoverPane.AddPanesOf(_dragingBay, DockDirection.Right, len); Window.GetWindow(this).Activate(); break; case DragDropEffects.Fill: break; case DragDropEffects.OuterTop: _hoverBay.AddPanesOf(_dragingBay, DockDirection.Top, len); Window.GetWindow(this).Activate(); break; case DragDropEffects.OuterBottom: _hoverBay.AddPanesOf(_dragingBay, DockDirection.Bottom, len); Window.GetWindow(this).Activate(); break; case DragDropEffects.OuterLeft: _hoverBay.AddPanesOf(_dragingBay, DockDirection.Left, len); Window.GetWindow(this).Activate(); break; case DragDropEffects.OuterRight: _hoverBay.AddPanesOf(_dragingBay, DockDirection.Right, len); Window.GetWindow(this).Activate(); break; default: break; } DockingHelper.Visibility = System.Windows.Visibility.Hidden; _hoverPane = null; _hoverBay = null; _dragingBay = null; _dragEffect = DragDropEffects.None; OnFloatingWindowEndMove(new FloatFormEventArgs((DockFloatingWindow)sender)); }