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)); }
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)); }
/// <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)); }
/// <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);
/// <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));