void button_MouseButtonReleased(Widget source, EventArgs e) { if (MouseButtonReleased != null) { MouseButtonReleased.Invoke(this, (MouseEventArgs)e); } }
public bool injectMouseRelease(int absx, int absy, MouseButtonCode id) { mouseX = absx; mouseY = absy; bool handled = InputManager_injectMouseRelease(inputManager, absx, absy, id); if (MouseButtonReleased != null) { MouseButtonReleased.Invoke(absx, absy, id); } return(handled); }
public InputEvents(RenderWindow window) { // if dummy don't attach events if (window == null) { return; } _window = window; _window.KeyPressed += (sender, args) => KeyPressed?.Invoke(sender, args); _window.KeyReleased += (sender, args) => KeyReleased?.Invoke(sender, args); _window.MouseButtonPressed += (sender, args) => MouseButtonPressed?.Invoke(sender, args); _window.MouseButtonReleased += (sender, args) => MouseButtonReleased?.Invoke(sender, args); _window.MouseMoved += (sender, args) => MouseMoved?.Invoke(sender, args); _window.MouseWheelMoved += (sender, args) => MouseWheelMoved?.Invoke(sender, args); _window.MouseEntered += (sender, args) => MouseEntered?.Invoke(sender, args); _window.MouseLeft += (sender, args) => MouseLeft?.Invoke(sender, args); _window.TextEntered += (sender, args) => TextEntered?.Invoke(sender, args); }
public InputEvents(CluwneWindow window) { // if dummy don't attach events if (window == null) { return; } SFML.Graphics.RenderWindow SWindow = window.SFMLWindow; SWindow.KeyPressed += (sender, args) => KeyPressed?.Invoke(sender, (KeyEventArgs)args); SWindow.KeyReleased += (sender, args) => KeyReleased?.Invoke(sender, (KeyEventArgs)args); SWindow.MouseButtonPressed += (sender, args) => MouseButtonPressed?.Invoke(sender, (MouseButtonEventArgs)args); SWindow.MouseButtonReleased += (sender, args) => MouseButtonReleased?.Invoke(sender, (MouseButtonEventArgs)args); SWindow.MouseMoved += (sender, args) => MouseMoved?.Invoke(sender, (MouseMoveEventArgs)args); SWindow.MouseWheelScrolled += (sender, args) => MouseWheelMoved?.Invoke(sender, (MouseWheelScrollEventArgs)args); SWindow.MouseEntered += (sender, args) => MouseEntered?.Invoke(sender, args); SWindow.MouseLeft += (sender, args) => MouseLeft?.Invoke(sender, args); SWindow.TextEntered += (sender, args) => TextEntered?.Invoke(sender, (TextEventArgs)args); }
private void OnMouseUp(object sender, MouseButtonEventArgs e) { MouseButtonReleased?.Invoke(this, e); }
/// <summary> /// Protected overridable handler that raises MouseButtonReleased event. /// </summary> protected virtual void OnMouseButtonReleased(MouseButtonEventArgs args) { MouseButtonReleased?.Invoke(this, args); }
private void ProcessMessage(Native.MouseChannelMessage message) { if (message.lParam.dwExtraInfo.IsMarionetInstancePointer()) { return; } switch (message.wParam) { case Native.LowLevelMouseProc_wParam.WM_LBUTTONDOWN: MouseButtonPressed?.Invoke(this, new MouseButtonActionEventArgs(MouseButton.Left)); break; case Native.LowLevelMouseProc_wParam.WM_LBUTTONUP: MouseButtonReleased?.Invoke(this, new MouseButtonActionEventArgs(MouseButton.Left)); break; case Native.LowLevelMouseProc_wParam.WM_MBUTTONDOWN: MouseButtonPressed?.Invoke(this, new MouseButtonActionEventArgs(MouseButton.Middle)); break; case Native.LowLevelMouseProc_wParam.WM_MBUTTONUP: MouseButtonReleased?.Invoke(this, new MouseButtonActionEventArgs(MouseButton.Middle)); break; case Native.LowLevelMouseProc_wParam.WM_RBUTTONDOWN: MouseButtonPressed?.Invoke(this, new MouseButtonActionEventArgs(MouseButton.Right)); break; case Native.LowLevelMouseProc_wParam.WM_RBUTTONUP: MouseButtonReleased?.Invoke(this, new MouseButtonActionEventArgs(MouseButton.Right)); break; case Native.LowLevelMouseProc_wParam.WM_MOUSEMOVE: MouseMoved?.Invoke(this, new MouseMoveEventArgs(new Point(message.lParam.pt.x, message.lParam.pt.y), inputBlocking.IsInputBlocked)); break; case Native.LowLevelMouseProc_wParam.WM_MOUSEWHEEL: case Native.LowLevelMouseProc_wParam.WM_MOUSEHWHEEL: int delta = message.lParam.mouseData >> 16; // delta is in the high word MouseWheelDirection direction = message.wParam switch { Native.LowLevelMouseProc_wParam.WM_MOUSEWHEEL => MouseWheelDirection.Vertical, Native.LowLevelMouseProc_wParam.WM_MOUSEHWHEEL => MouseWheelDirection.Horizontal, _ => throw new NotImplementedException("This error should never occur."), }; MouseWheel?.Invoke(this, new MouseWheelEventArgs(delta, direction)); break; case Native.LowLevelMouseProc_wParam.WM_XBUTTONDOWN: case Native.LowLevelMouseProc_wParam.WM_XBUTTONUP: int xButton = message.lParam.mouseData >> 16; // button is in the high word MouseButton button; if (xButton == Native.Constants.XBUTTON1) { button = MouseButton.XButton1; } else if (xButton == Native.Constants.XBUTTON2) { button = MouseButton.XButton2; } else { break; } EventHandler <MouseButtonActionEventArgs>?eventHandler = message.wParam switch { Native.LowLevelMouseProc_wParam.WM_XBUTTONDOWN => MouseButtonPressed, Native.LowLevelMouseProc_wParam.WM_XBUTTONUP => MouseButtonReleased, _ => throw new NotImplementedException("This error should never occur."), }; eventHandler?.Invoke(this, new MouseButtonActionEventArgs(button)); break; } }