Esempio n. 1
0
        internal void IntoDragAction(DragItem dragItem, bool _isInvokeByFloatWnd = false)
        {
            DockManager.UpdateWindowZOrder();

            _dragItem = dragItem;
            //被浮动窗口调用则不需要调用BeforeDrag()
            if (_isInvokeByFloatWnd)
            {
                IsDragging = true;
                if (_dragWnd == null)
                {
                    _dragWnd = _dragItem.RelativeObj as BaseFloatWindow;
                }
            }
            else
            {
                BeforeDrag();
            }

            //初始化最外层的_rootTarget
            _rootSize = DockManager.LayoutRootPanel.RootGroupPanel.TransformActualSizeToAncestor();

            if (!_isInvokeByFloatWnd && _dragWnd is DocumentGroupWindow)
            {
                _dragWnd.Recreate();
            }
        }
Esempio n. 2
0
        internal void OnMouseMove()
        {
            if (Keyboard.Modifiers == ModifierKeys.Control)
            {
                DockManager.LayoutRootPanel.RootGroupPanel?.HideDropWindow();
                DragTarget = null;
                return;
            }
            bool flag = false;

            _mouseP = DockHelper.GetMousePosition(DockManager);
            foreach (var wnd in DockManager.Windows.Where(w => w is BaseFloatWindow).Cast <BaseFloatWindow>())
            {
                if (wnd != _dragWnd &&
                    wnd.RestoreBounds.Contains(_mouseP) &&
                    !(wnd is DocumentGroupWindow && _dragItem.DragMode == DragMode.Anchor) &&
                    !(wnd is AnchorGroupWindow && _dragItem.DragMode == DragMode.Document))
                {
                    //if (wnd is DocumentGroupWindow)
                    //    if (DockManager.IsBehindToMainWindow(wnd))
                    //        continue;

                    var lflag = false;
                    if (!DockManager.IsAtWindowsIndex(wnd, 1))
                    {
                        //DockManager.MoveFloatTo(wnd);
                        lflag = true;
                    }
                    else if (DockManager.IsBehindToMainWindow(wnd))
                    {
                        lflag = true;
                    }

                    if (lflag)
                    {
                        Win32Helper.BringWindowToTop(wnd.Handle);
                        Win32Helper.BringWindowToTop(_dragWnd.Handle);
                        DockManager.UpdateWindowZOrder();
                    }

                    wnd.HitTest(_mouseP);

                    DockManager.LayoutRootPanel.RootGroupPanel.HideDropWindow();
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                var p = DockHelper.GetMousePositionRelativeTo(DockManager.LayoutRootPanel.RootGroupPanel);
                if (p.X >= 0 && p.Y >= 0 &&
                    p.X <= _rootSize.Width &&
                    p.Y <= _rootSize.Height)
                {
                    if (_dragItem.DragMode != DragMode.Document)
                    {
                        DockManager.LayoutRootPanel.RootGroupPanel?.ShowDropWindow();
                        DockManager.LayoutRootPanel.RootGroupPanel?.Update(_mouseP);
                    }
                    VisualTreeHelper.HitTest(DockManager.LayoutRootPanel.RootGroupPanel, _HitFilter, _HitRessult, new PointHitTestParameters(p));
                }
                else
                {
                    if (_dragItem.DragMode != DragMode.Document)
                    {
                        DockManager.LayoutRootPanel.RootGroupPanel?.HideDropWindow();
                    }
                    DragTarget = null;
                }
            }
        }