Exemple #1
0
        private IEnumerable <Window> SortWindowsTopToBottom(IEnumerable <Window> unsorted)
        {
            var byHandle = unsorted.ToDictionary(win =>
                                                 ((new WindowInteropHelper(win)).Handle));

            for (IntPtr hWnd = Win32Helper.GetTopWindow(IntPtr.Zero); hWnd != IntPtr.Zero; hWnd = Win32Helper.GetWindow(hWnd, Win32Helper.GW_HWNDNEXT))
            {
                if (byHandle.ContainsKey(hWnd))
                {
                    yield return(byHandle[hWnd]);
                }
            }
        }
Exemple #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.FloatWindows)
            {
                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;
                        }
                    }

                    if (wnd != DockManager.FloatWindows.First())
                    {
                        DockManager.MoveFloatTo(wnd);
                        Application.Current.Dispatcher.InvokeAsync(() =>
                        {
                            Win32Helper.BringWindowToTop(wnd.Handle);
                            Win32Helper.BringWindowToTop(_dragWnd.Handle);
                        }, DispatcherPriority.Background);
                    }
                    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;
                }
            }
        }
Exemple #3
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;
                }
            }
        }
Exemple #4
0
 public static Point GetMousePosition(FrameworkElement relativeTo)
 {
     return(relativeTo.TransformToDeviceDPI(Win32Helper.GetMousePosition()));
 }