/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Find related floating window in manager /// </summary> private FloatingWindow _GetRelatedFloatingWnd() { FloatingWindow wndFloating = null; if (null != _paneContainer) { wndFloating = _paneContainer.FloatingWindow; } return(wndFloating); }
/// <summary> /// Begins dragging operations. /// </summary> /// <param name="floatingWindow">Floating window containing pane which is dragged by user.</param> /// <param name="point">Current mouse position.</param> /// <param name="offset">Offset to be use to set floating window screen position.</param> /// <returns>Retruns True is drag is completed, false otherwise.</returns> public bool Drag(FloatingWindow floatingWindow, Point point, Point offset) { if (IsMouseCaptured) { return(false); } if (!CaptureMouse()) { return(false); } DragPaneServices.StartDrag(floatingWindow, point, offset); return(true); }
/// <summary> /// Close content /// </summary> public virtual new void Close() { FloatingWindow window = _GetRelatedFloatingWnd(); if (null != window) { window.ForceClose(); } else { _paneContainer.Close(); } FireVisibileStateChanged(); }
/// <summary> /// Show this content /// </summary> /// <param name="dock">New dock border</param> /// <remarks>Show this content in a dockable pane. If no pane was previuosly created, it creates a new one with passed initial dock. </remarks> private void _Show(Dock dock) { FloatingWindow window = _GetRelatedFloatingWnd(); if (null != window) { window.Show(); } else { ContainerPane.UseSpecAllocation = true; ContainerPane.Show(dock); } FireVisibileStateChanged(); }
/// <summary> /// Create a floating window hosting this pane /// </summary> private void _CreateFloatingWindow(PaneState state) { Debug.Assert((PaneState.DockableWindow == state)); StoreSize(); State = state; if (null == _wndFloating) { _content.DockManager.Remove(this); ShowHeader = false; _wndFloating = new FloatingWindow(this); _wndFloating.Owner = _content.DockManager.ParentWindow; _wndFloating.Width = _szFloatingWindow.Width; _wndFloating.Height = _szFloatingWindow.Height; } }
private void _CloseFloatingWindow() { if (null != _wndFloating) { _wndFloating.Close(); _wndFloating = null; } }
/// <summary> /// End drag routine /// </summary> /// <param name="point">Current mouse position</param> public void EndDrag(Point point) { IDropSurface dropSufrace = null; foreach (IDropSurface surface in _surfaces) { if (!surface.SurfaceRectangle.Contains(point)) continue; if (surface.OnDrop(point)) { dropSufrace = surface; break; } } foreach (IDropSurface surface in _surfacesWithDragOver) { if (surface != dropSufrace) surface.OnDragLeave(point); } _surfacesWithDragOver.Clear(); if (null != dropSufrace) _wnd.Close(); _wnd = null; }
/// <summary> /// Start drag routine /// </summary> /// <param name="wnd">Floating window to managed</param> /// <param name="point">Current mouse position</param> /// <param name="offset">Offset to be use to set floating window screen position</param> public void StartDrag(FloatingWindow wnd, Point point, Point offset) { _wnd = wnd; _offset = offset; if (_wnd.Width <= _offset.X) _offset.X = _wnd.Width / 2; _wnd.Left = point.X - _offset.X; _wnd.Top = point.Y - _offset.Y; if (!_wnd.IsActive) _wnd.Show(); foreach (IDropSurface surface in _surfaces) { if (surface.SurfaceRectangle.Contains(point)) { _surfacesWithDragOver.Add(surface); surface.OnDragEnter(point); } } }
/// <summary> /// Unregistry floating windows to manage /// </summary> /// <param name="wnd">Floating windows to manage.</param> /// <remarks>Call this routine if system destroy\close window.</remarks> public void UnregisterFloatingWnd(FloatingWindow wnd) { Debug.Assert(_floatingWnds.Contains(wnd)); _floatingWnds.Remove(wnd); }
/// <summary> /// Registry floating windows to manage. /// </summary> /// <param name="wnd">Floating windows to manage.</param> public void RegisterFloatingWnd(FloatingWindow wnd) { Debug.Assert(!_floatingWnds.Contains(wnd)); _floatingWnds.Add(wnd); }
/// <summary> /// Begins dragging operations. /// </summary> /// <param name="floatingWindow">Floating window containing pane which is dragged by user.</param> /// <param name="point">Current mouse position.</param> /// <param name="offset">Offset to be use to set floating window screen position.</param> /// <returns>Retruns True is drag is completed, false otherwise.</returns> public bool Drag(FloatingWindow floatingWindow, Point point, Point offset) { if (IsMouseCaptured) return false; if (!CaptureMouse()) return false; DragPaneServices.StartDrag(floatingWindow, point, offset); return true; }