Esempio n. 1
0
        /// <summary>
        /// Creates the new dragging hit window.
        /// </summary>
        /// <param name="toMove">Floating dock panel to move.</param>
        /// <returns>The dock hint window object.</returns>
        public static DockHintWindow Create(FloatWindowDockPanel toMove)
        {
            if (toMove == null)
            {
                throw new ArgumentNullException();
            }

            return(new DockHintWindow(toMove));
        }
Esempio n. 2
0
        private DockHintWindow(FloatWindowDockPanel toMove)
        {
            _toMove = toMove;
            _toSet  = DockState.Float;
            var window = toMove.Window.NativeWindow;

            // Remove focus from drag target
            _toMove.Focus();
            _toMove.Defocus();

            // Focus window
            window.Focus();

            // Calculate dragging offset and move window to the destination position
            Vector2 mouse      = Application.MousePosition;
            Vector2 baseWinPos = window.Position;

            _dragOffset = mouse - baseWinPos;

            // Get initial size
            _defaultWindowSize = window.Size;

            // Init proxy window
            Proxy.Init(ref _defaultWindowSize);

            // Bind events
            Proxy.Window.OnMouseUp   += onMouseUp;
            Proxy.Window.OnMouseMove += onMouseMove;
            Proxy.Window.OnLostFocus += onLostFocus;

            // Start tracking mouse
            Proxy.Window.StartTrackingMouse(false);

            // Update window GUI
            Proxy.Window.GUI.PerformLayout();

            // Update rectangles
            updateRects();

            // Hide base window
            window.Hide();

            // Enable hit window presentation
            Proxy.Window.RenderingEnabled = true;
        }
Esempio n. 3
0
        /// <summary>
        /// Performs hit test over dock panel.
        /// </summary>
        /// <param name="position">Screen space position to test.</param>
        /// <param name="excluded">Floating window to ommit during searching (and all docked to that one).</param>
        /// <returns>Dock panel that has been hitted or null if nothing found.</returns>
        public DockPanel HitTest(ref Vector2 position, FloatWindowDockPanel excluded)
        {
            // Check all floating windows
            // TODO: gather windows order and take it into account when performing test
            for (int i = 0; i < FloatingPanels.Count; i++)
            {
                var win = FloatingPanels[i];
                if (win.Visible && win != excluded)
                {
                    var result = win.HitTest(ref position);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            // Base
            return(base.HitTest(ref position));
        }