Exemple #1
0
        protected virtual void OnMouseLeftClicked(MouseConsoleState state)
        {
            if (MoveToFrontOnMouseClick && Parent != null && Parent.Children.IndexOf(this) != Parent.Children.Count - 1)
            {
                Parent.Children.MoveToTop(this);
            }

            if (FocusOnMouseClick && !IsFocused)
            {
                IsFocused = true;
            }

            MouseButtonClicked?.Invoke(this, new MouseEventArgs(state));
        }
Exemple #2
0
        private static IntPtr HookCallback(
            int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            // && MouseMessages.WM_LBUTTONDOWN == (MouseMessages)wParam)
            {
                MSLLHOOKSTRUCT hookStruct = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));
                // Console.WriteLine("Mouse move: " + hookStruct.pt.x + ", " + hookStruct.pt.y);

                MousePositionChanged?.Invoke(hookStruct.pt.x, hookStruct.pt.y);

                if (MouseMessages.WM_LBUTTONDOWN == (MouseMessages)wParam)
                {
                    MouseButtonClicked?.Invoke(0);
                }
                if (MouseMessages.WM_RBUTTONDOWN == (MouseMessages)wParam)
                {
                    MouseButtonClicked?.Invoke(1);
                }
            }
            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }
Exemple #3
0
 /// <summary>
 /// Raises the <see cref="MouseButtonClicked"/> event.
 /// </summary>
 /// <param name="state">Current mouse state in relation to this console.</param>
 protected virtual void OnRightMouseClicked(MouseConsoleState state)
 {
     MouseButtonClicked?.Invoke(this, new MouseEventArgs(state));
 }
Exemple #4
0
 /// <summary>
 /// Raises the <see cref="MouseButtonClicked"/> event.
 /// </summary>
 /// <param name="state">Current mouse state in relation to this console.</param>
 protected virtual void OnRightMouseClicked(MouseScreenObjectState state) => MouseButtonClicked?.Invoke(this, state);
Exemple #5
0
 /// <summary>
 /// Raises the <see cref="MouseButtonClicked"/> event. Possibly moves the console to the top of it's parent's children collection.
 /// </summary>
 /// <param name="state">Current mouse state in relation to this console.</param>
 protected virtual void OnMouseLeftClicked(MouseConsoleState state) => MouseButtonClicked?.Invoke(this, new MouseEventArgs(state));