예제 #1
0
        private void HandleButtonEvent(MouseState state, MouseButton button, ButtonState prevState, ButtonState currentState)
        {
            if (prevState != currentState)
            {
                if (_clickCooldown > 0 && currentState == ButtonState.Released)
                {
                    _clickCooldown = 0;
                    if (_lastClick == button)
                    {
                        var ev = new MouseButtonEventArgs(state, button, currentState);
                        MouseDoubleClick?.Invoke(this, ev);
                    }
                }
                else
                {
                    var ev = new MouseButtonEventArgs(state, button, currentState);

                    if (currentState == ButtonState.Pressed)
                    {
                        MouseDown?.Invoke(this, ev);
                    }
                    else
                    {
                        MouseUp?.Invoke(this, ev);
                        _lastClick     = button;
                        _clickCooldown = _clickCooldownStart;
                    }
                }
            }
        }
예제 #2
0
 static MouseInputManager()
 {
     InputHooks.MouseMove        += (o, e) => MouseMove?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseClick       += (o, e) => MouseClick?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseDown        += (o, e) => MouseDown?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseUp          += (o, e) => MouseUp?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseWheel       += (o, e) => MouseWheel?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
     InputHooks.MouseDoubleClick += (o, e) => MouseDoubleClick?.Invoke(new MouseHookEventArgs(e.X, e.Y, (e.Button), e.Delta));
 }
예제 #3
0
        internal bool PerformMouseDoubleClick(Viewport viewport, EMouseButtons button)
        {
            var handled = OnMouseDoubleClick(viewport, button);

            if (!handled)
            {
                MouseDoubleClick?.Invoke(this, viewport, button, ref handled);
            }
            return(handled);
        }
예제 #4
0
            private void ProcessMouseDown(MouseButtons button, bool doubleClick)
            {
                if (doubleClick)
                {
                    DoubleClick?.Invoke(this, new MouseEventArgs(button, 2, 0, 0, 0));
                    MouseDoubleClick?.Invoke(this, new MouseEventArgs(button, 2, 0, 0, 0));

                    _doubleClickDown = true;
                }

                MouseDown?.Invoke(this, new MouseEventArgs(button, doubleClick ? 2 : 1, 0, 0, 0));
            }
예제 #5
0
        internal void Internal_OnMouseDoubleClick(ref Float2 mousePos, MouseButton button)
        {
            var pos = mousePos / DpiScale;

            bool handled = false;

            MouseDoubleClick?.Invoke(ref pos, button, ref handled);
            if (handled)
            {
                return;
            }

            GUI.OnMouseDoubleClick(pos, button);
        }
예제 #6
0
        private void Gc_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (EnsureCurrent)
            {
                glControl.MakeCurrent();
            }
            GLMouseEventArgs.MouseButtons b = (((e.Button & System.Windows.Forms.MouseButtons.Left) != 0) ? GLMouseEventArgs.MouseButtons.Left : 0) |
                                              (((e.Button & System.Windows.Forms.MouseButtons.Middle) != 0) ? GLMouseEventArgs.MouseButtons.Middle : 0) |
                                              (((e.Button & System.Windows.Forms.MouseButtons.Right) != 0) ? GLMouseEventArgs.MouseButtons.Right : 0);
            var ev = new GLMouseEventArgs(b, e.Location, e.Clicks,
                                          Control.ModifierKeys.HasFlag(Keys.Alt), Control.ModifierKeys.HasFlag(Keys.Control), Control.ModifierKeys.HasFlag(Keys.Shift));

            MouseDoubleClick?.Invoke(this, ev);
        }
예제 #7
0
        internal void Internal_OnMouseDoubleClick(ref Vector2 mousePos, MouseButton buttons)
        {
            Vector2 pos = mousePos / _dpiScale;

            bool handled = false;

            MouseDoubleClick?.Invoke(ref pos, buttons, ref handled);
            if (handled)
            {
                return;
            }

            GUI.OnMouseDoubleClick(pos, buttons);
        }
예제 #8
0
        public MouseKeyHook()
        {
            _hook = Hook.GlobalEvents();

            _hook.KeyUp   += (S, E) => KeyUp?.Invoke(this, E);
            _hook.KeyDown += (S, E) => KeyDown?.Invoke(this, E);

            _hook.MouseUp          += (S, E) => MouseUp?.Invoke(this, E);
            _hook.MouseDown        += (S, E) => MouseDown?.Invoke(this, E);
            _hook.MouseClick       += (S, E) => MouseClick?.Invoke(this, E);
            _hook.MouseDoubleClick += (S, E) => MouseDoubleClick?.Invoke(this, E);
            _hook.MouseWheel       += (S, E) => MouseWheel?.Invoke(this, E);
            _hook.MouseMove        += (S, E) => MouseMove?.Invoke(this, E);

            _hook.MouseDragStarted  += (S, E) => MouseDragStarted?.Invoke(this, E);
            _hook.MouseDragFinished += (S, E) => MouseDragFinished?.Invoke(this, E);

            _hook.KeyPress += (S, E) => KeyPress?.Invoke(this, E);
        }
예제 #9
0
 /// <summary>
 /// Raise the event <see cref="MouseDoubleClick"/>.
 /// </summary>
 protected virtual void OnMouseDoubleClick(Point location, MouseButton buttons)
 {
     MouseDoubleClick?.Invoke(this, new NativeWindowMouseEventArgs(DeviceContext, GLContext, location, buttons));
 }
예제 #10
0
 public void OnMouseDoubleClick(int x, int y, MouseButton button)
 {
     MouseDoubleClick?.Invoke(this, x, y, button);
 }
예제 #11
0
 public virtual void DoMouseDoubleClick(MouseEventArgs e)
 {
     MouseDoubleClick?.Invoke(this, e);
 }
예제 #12
0
 void IEventListener.ListenMouseDoubleClick(UIMouseEventArgs e)
 {
     MouseDoubleClick?.Invoke(this, e);
 }
        public static void InputLoop()
        {
            uint        toRead            = 128;
            var         records           = new INPUT_RECORD[toRead];
            int         prevWidth         = MyConsole.Width;
            int         prevHeight        = MyConsole.Height;
            MouseButton prevMouseState    = MouseButton.None;
            COORD       prevMouseLocation = new COORD();

            while (!MyConsole.Exiting)
            {
                WinApi.ReadConsoleInput(inputHandle, records, toRead, out uint recordLen);

                for (int i = 0; i < recordLen; i++)
                {
                    var record = records[i];

                    switch (record.EventType)
                    {
                    case EventType.Mouse:
                    {
                        var mouseEvent = record.Event.MouseEvent;
                        var button     = mouseEvent.ButtonState;
                        var flags      = mouseEvent.EventFlags;
                        var location   = mouseEvent.MousePosition;

                        bool mousePressed  = prevMouseState == MouseButton.None && button != MouseButton.None;
                        bool mouseReleased = prevMouseState != MouseButton.None && button == MouseButton.None;
                        bool mouseHeld     = prevMouseState != MouseButton.None && button != MouseButton.None;

                        var args = new MouseEventArgs
                        {
                            Button          = button,
                            Location        = location,
                            ControlKeyState = mouseEvent.ControlKeyState
                        };

                        bool sameLocation = location.Equals(prevMouseLocation);

                        if (mousePressed && flags.HasFlag(MouseState.DoubleClick))
                        {
                            MouseDoubleClick?.Invoke(null, args);
                        }
                        else if (mousePressed)
                        {
                            MousePressed?.Invoke(null, args);
                        }
                        else if (mouseReleased)
                        {
                            MouseReleased?.Invoke(null, args);
                        }
                        else if (mouseHeld && flags.HasFlag(MouseState.Moved) && !sameLocation)
                        {
                            MouseDragged?.Invoke(null, args);
                        }
                        else if (flags.HasFlag(MouseState.Moved) && !sameLocation)
                        {
                            MouseMoved?.Invoke(null, args);
                        }

                        prevMouseState    = button;
                        prevMouseLocation = location;
                    }
                    break;

                    case EventType.Key:
                    {
                        var keyEvent = record.Event.KeyEvent;

                        var eventArgs = new KeyEventArgs
                        {
                            Key             = (ConsoleKey)keyEvent.VirtualKeyCode,
                            ControlKeyState = keyEvent.ControlKeyState
                        };

                        bool currState = keyEvent.KeyDown;
                        bool prevState = keyStates[keyEvent.VirtualKeyCode];

                        if (currState && !prevState)
                        {
                            KeyPressed?.Invoke(eventArgs);
                        }
                        else if (prevState && !currState)
                        {
                            KeyReleased?.Invoke(eventArgs);
                        }
                        else if (prevState && currState)
                        {
                            KeyHeld?.Invoke(eventArgs);
                        }

                        keyStates[keyEvent.VirtualKeyCode] = keyEvent.KeyDown;
                    }
                    break;

                    case EventType.Resize:
                    {
                        var clientSize = MyConsole.GetClientSize();
                        var fontSize   = MyConsole.GetFontSize();
                        int w          = clientSize.X / fontSize.X;
                        int h          = clientSize.Y / fontSize.Y;

                        if (prevWidth != w || prevHeight != h)
                        {
                            MyConsole.SetSize(w, h);
                            MyConsole.HideCursor();
                            Drawing.ConsoleRenderer.Resize(w, h);
                            Resized?.Invoke(new ResizedEventArgs
                                {
                                    Width  = w,
                                    Height = h
                                });
                            prevWidth  = w;
                            prevHeight = h;
                        }
                    }
                    break;

                    case EventType.Menu:
                    {
                        var id = record.Event.MenuEvent.dwCommandId;
                        Debug.WriteLine(id);
                    }
                    break;

                    case EventType.Focus:
                    {
                        var focused = record.Event.FocusEvent.bSetFocus;
                    }
                    break;

                    default:
                        Debug.WriteLine("Unhandled event: " + record.EventType);
                        break;
                    }
                }
            }
        }
예제 #14
0
        private void Handle(DateTime time, RawMouseButtons state, InputMouse data)
        {
            IPoint coords = new Point(data.X, data.Y, !data.Flags.HasFlag(RawMouseFlags.MoveAbsolute));
            int    delta  = data.Data.WheelDelta;

            switch (state)
            {
            case RawMouseButtons.None when data.X != 0 || data.Y != 0 || !coords.IsRelative:
            {
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Movement, coords, delta, MouseButtons.None, KeyState.None, false, time, false);
                OnEvent?.Invoke(this, eventArgs);
                MouseMove?.Invoke(this, eventArgs);
                break;
            }

            case RawMouseButtons.LeftDown:
            {
                int  currentTime   = (int)Kernel32.DateTimeToTicks(time);
                bool isDoubleClick = currentTime - LastLeftClick <= User32.DoubleClickTime;
                Interlocked.Exchange(ref LastLeftClick, currentTime - (isDoubleClick ? User32.DoubleClickTime + 1 : 0));

                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Key, coords, delta, MouseButtons.Left, KeyState.Down, isDoubleClick, time, false);
                OnEvent?.Invoke(this, eventArgs);
                MouseDown?.Invoke(this, eventArgs);
                MouseClick?.Invoke(this, eventArgs);
                if (isDoubleClick)
                {
                    MouseDoubleClick?.Invoke(this, eventArgs);
                }
                break;
            }

            case RawMouseButtons.MiddleDown:
            case RawMouseButtons.RightDown:
            case RawMouseButtons.Button4Down:
            case RawMouseButtons.Button5Down:
            {
                MouseButtons button = state switch
                {
                    RawMouseButtons.MiddleDown => MouseButtons.Middle,
                    RawMouseButtons.RightDown => MouseButtons.Right,
                    RawMouseButtons.Button4Down => MouseButtons.XButton1,
                    RawMouseButtons.Button5Down => MouseButtons.XButton2,
                    _ => MouseButtons.None
                };
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Key, coords, delta, button, KeyState.Down, false, time, false);
                OnEvent?.Invoke(this, eventArgs);
                MouseDown?.Invoke(this, eventArgs);
                MouseClick?.Invoke(this, eventArgs);
                break;
            }

            case RawMouseButtons.LeftUp:
            case RawMouseButtons.MiddleUp:
            case RawMouseButtons.RightUp:
            case RawMouseButtons.Button4Up:
            case RawMouseButtons.Button5Up:
            {
                MouseButtons button = state switch
                {
                    RawMouseButtons.LeftUp => MouseButtons.Left,
                    RawMouseButtons.MiddleUp => MouseButtons.Middle,
                    RawMouseButtons.RightUp => MouseButtons.Right,
                    RawMouseButtons.Button4Up => MouseButtons.XButton1,
                    RawMouseButtons.Button5Up => MouseButtons.XButton2,
                    _ => MouseButtons.None
                };
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Key, coords, delta, button, KeyState.Up, false, time, false);
                OnEvent?.Invoke(this, eventArgs);
                MouseUp?.Invoke(this, eventArgs);
                break;
            }

            case RawMouseButtons.Wheel:
            {
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Wheel, coords, delta, MouseButtons.Wheel, delta > 0 ? KeyState.Up : KeyState.Down, false, time, false);
                OnEvent?.Invoke(this, eventArgs);
                MouseWheel?.Invoke(this, eventArgs);
                break;
            }

            case RawMouseButtons.HWheel:
            {
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.HorizontalWheel, coords, delta, MouseButtons.Wheel, delta > 0 ? KeyState.Up : KeyState.Down, false, time, false);
                OnEvent?.Invoke(this, eventArgs);
                MouseHorizontalWheel?.Invoke(this, eventArgs);
                break;
            }

            default:
                break;
            }
        }
예제 #15
0
 internal void InvokeMouseDoubleClick(S sender, T state, UIMouseEventArgs e) => MouseDoubleClick.Invoke(new SenderInfo(sender, state), e);
예제 #16
0
 protected virtual void OnMouseDoubleClick(GLMouseEventArgs e)
 {
     //System.Diagnostics.Debug.WriteLine("doubleclick " + Name + " " + e.Button + " " + e.Clicks + " " + e.Location);
     MouseDoubleClick?.Invoke(this, e);
 }
 /// <summary>
 /// Raises the MouseDoubleClick event.
 /// </summary>
 /// <param name="e">An EventArgs containing the event data.</param>
 protected virtual void OnMouseDoubleClick(EventArgs e)
 {
     MouseDoubleClick?.Invoke(this, e);
 }
예제 #18
0
        protected override void WndProc(ref Message message)
        {
            switch (message.Msg)
            {
            case WM_COMMAND:
            {
                // need to dispatch the message for the context menu
                if (message.LParam == IntPtr.Zero)
                {
                    _commandDispatch.Invoke(null, new object[] { message.WParam.ToInt32()& 0xFFFF });
                }
            }
            break;

            case WM_NCHITTEST:
            {
                message.Result = (IntPtr)HitResult.Caption;
                if (HitTest != null)
                {
                    Point p = new Point(
                        Macros.GET_X_LPARAM(message.LParam) - _location.X,
                        Macros.GET_Y_LPARAM(message.LParam) - _location.Y
                        );
                    HitTestEventArgs e = new HitTestEventArgs(p, HitResult.Caption);
                    HitTest(this, e);
                    message.Result = (IntPtr)e.HitResult;
                }
            }
            break;

            case WM_NCLBUTTONDBLCLK:
            {
                MouseDoubleClick?.Invoke(this, new MouseEventArgs(MouseButtons.Left, 2, Macros.GET_X_LPARAM(message.LParam) - _location.X, Macros.GET_Y_LPARAM(message.LParam) - _location.Y, 0));
                message.Result = IntPtr.Zero;
            }
            break;

            case WM_NCRBUTTONDOWN:
            {
                message.Result = IntPtr.Zero;
            }
            break;

            case WM_NCRBUTTONUP:
            {
                ContextMenuStrip?.Show(new Point(Macros.GET_X_LPARAM(message.LParam), Macros.GET_Y_LPARAM(message.LParam)));
                message.Result = IntPtr.Zero;
            }
            break;

            case WM_WINDOWPOSCHANGING:
            {
                WINDOWPOS wp = (WINDOWPOS)Marshal.PtrToStructure(message.LParam, typeof(WINDOWPOS));
                if (!LockPositionAndSize)
                {
                    // prevent the window from leaving the screen
                    if ((wp.flags & SWP_NOMOVE) == 0)
                    {
                        Rectangle rect   = Screen.GetWorkingArea(new Rectangle(wp.x, wp.y, wp.cx, wp.cy));
                        const int margin = 16;
                        wp.x = Math.Max(wp.x, rect.Left - wp.cx + margin);
                        wp.x = Math.Min(wp.x, rect.Right - margin);
                        wp.y = Math.Max(wp.y, rect.Top - wp.cy + margin);
                        wp.y = Math.Min(wp.y, rect.Bottom - margin);
                    }

                    // update location and fire event
                    if ((wp.flags & SWP_NOMOVE) == 0)
                    {
                        if (_location.X != wp.x || _location.Y != wp.y)
                        {
                            _location = new Point(wp.x, wp.y);
                            LocationChanged?.Invoke(this, EventArgs.Empty);
                        }
                    }

                    // update size and fire event
                    if ((wp.flags & SWP_NOSIZE) == 0)
                    {
                        if (_size.Width != wp.cx || _size.Height != wp.cy)
                        {
                            _size = new Size(wp.cx, wp.cy);
                            SizeChanged?.Invoke(this, EventArgs.Empty);
                        }
                    }

                    // update the size of the layered window
                    if ((wp.flags & SWP_NOSIZE) == 0)
                    {
                        NativeMethods.UpdateLayeredWindow(Handle, IntPtr.Zero, IntPtr.Zero, ref _size, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, 0);
                    }

                    // update the position of the layered window
                    if ((wp.flags & SWP_NOMOVE) == 0)
                    {
                        NativeMethods.SetWindowPos(Handle, IntPtr.Zero, _location.X, _location.Y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING);
                    }
                }

                // do not forward any move or size messages
                wp.flags |= SWP_NOSIZE | SWP_NOMOVE;

                // suppress any frame changed events
                wp.flags &= ~SWP_FRAMECHANGED;

                Marshal.StructureToPtr(wp, message.LParam, false);
                message.Result = IntPtr.Zero;
            }
            break;

            default:
            {
                base.WndProc(ref message);
            }
            break;
            }
        }
예제 #19
0
 internal void OnMouseDoubleClick(Model model, MouseEventArgs e) => MouseDoubleClick?.Invoke(model, e);
예제 #20
0
 private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) => MouseDoubleClick?.Invoke(sender, e);
예제 #21
0
 public virtual void OnMouseDoubleClick(MouseButtons mb)
 {
     MouseDoubleClick?.Invoke(this, new GenericEventArgs <MouseButtons>(mb));
 }
예제 #22
0
        private void Update()
        {
            if (IsLocked)
            {
                return;
            }

            var mousePosition = Input.mousePosition;

            if (IsOverGui())
            {
                _isMouseDown           = false;
                _isMouseMove           = false;
                _isOneClick            = false;
                _previousMousePosition = null;
                return;
            }

            float mouseWheel = Input.GetAxis("Mouse ScrollWheel");

            if (mouseWheel != 0)
            {
                MouseWheel?.Invoke(mouseWheel);
            }

            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                _isMouseDown           = true;
                _isMouseMove           = false;
                _buttonDownPosition    = mousePosition;
                _previousMousePosition = null;

                if (!_isOneClick)
                {
                    _isOneClick      = true;
                    _doubleClickTime = Time.time;
                    MouseDown?.Invoke(mousePosition);
                    IsOverGui();
                }
                else
                {
                    _isOneClick = false;
                    MouseDoubleClick?.Invoke(mousePosition);
                    _buttonDownPosition = mousePosition;
                    return;
                }
            }

            if (_isOneClick && Time.time - _doubleClickTime > Delay)
            {
                _isOneClick = false;
            }

            if (!_isMouseDown)
            {
                return;
            }

            if (Input.GetKeyUp(KeyCode.Mouse0))
            {
                _isMouseDown = false;
                MouseUp?.Invoke(mousePosition);
                if (!_isMouseMove)
                {
                    MouseClick?.Invoke(mousePosition);
                    _isMouseMove = false;
                }
                _buttonDownPosition    = null;
                _previousMousePosition = null;
                return;
            }

            if (_buttonDownPosition != null)
            {
                if (_previousMousePosition != null)
                {
                    if (Vector3.Distance(_previousMousePosition.Value, mousePosition) > DeltaRegistration)
                    {
                        _isOneClick  = false;
                        _isMouseMove = true;
                        MouseMove?.Invoke(mousePosition, _previousMousePosition.Value);
                        _previousMousePosition = mousePosition;
                    }
                }
                else
                {
                    if (Vector3.Distance(_buttonDownPosition.Value, mousePosition) > DeltaRegistration)
                    {
                        _isOneClick  = false;
                        _isMouseMove = true;
                        MouseMove?.Invoke(mousePosition, _buttonDownPosition.Value);
                        _previousMousePosition = mousePosition;
                    }
                }
            }
        }
예제 #23
0
 private void listView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     MouseDoubleClick?.Invoke(sender, e);
 }
예제 #24
0
파일: Control.cs 프로젝트: ShawnM427/MonUX
 protected virtual void OnMouseDoubleClicked(DeltaMouseState mouseState)
 {
     MouseDoubleClick?.Invoke(this, mouseState);
 }
예제 #25
0
 public virtual void DoMouseDoubleClick(GeoMouseButtonEventArgs e)
 {
     MouseDoubleClick?.Invoke(this, e);
 }
예제 #26
0
 /// <summary>
 /// is call by a double click of the mouse. See also <see cref="MouseDoubleClick"/>
 /// </summary>
 /// <param name="e"></param>
 /// <returns><b>true</b> interupt the <see cref="OpenGlDevice.EventServer"/> in the sense of "handled". </returns>
 public void OnMouseDoubleClick(HandledMouseEventArgs e)
 {
     MouseDoubleClick?.Invoke(this, e);
 }
예제 #27
0
        private bool Handle(RawMouseMessages state, MouseState data)
        {
            bool prevented = false;

            IPoint   coords = new Point(data.Point.X, data.Point.Y);
            int      delta  = data.WheelDelta;
            DateTime time   = data.DateTime;

            switch (state)
            {
            case RawMouseMessages.Move:
            {
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Movement, coords, delta, MouseButtons.None, KeyState.None, false, time);
                InvokeOnEvent(this, eventArgs);
                MouseMove?.Invoke(this, eventArgs);
                prevented = eventArgs.DefaultPrevented;
                break;
            }

            case RawMouseMessages.LeftDown:
            {
                bool isDoubleClick = (data.Time - LastLeftClick) <= User32.DoubleClickTime;
                Interlocked.Exchange(ref LastLeftClick, data.Time - (isDoubleClick ? User32.DoubleClickTime + 1 : 0));

                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Key, coords, delta, MouseButtons.Left, KeyState.Down, isDoubleClick, time);
                InvokeOnEvent(this, eventArgs);
                MouseDown?.Invoke(this, eventArgs);
                MouseClick?.Invoke(this, eventArgs);
                if (isDoubleClick)
                {
                    MouseDoubleClick?.Invoke(this, eventArgs);
                }
                prevented = eventArgs.DefaultPrevented;
                break;
            }

            case RawMouseMessages.MiddleDown:
            case RawMouseMessages.RightDown:
            {
                MouseButtons    button    = state == RawMouseMessages.RightDown ? MouseButtons.Right : MouseButtons.Middle;
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Key, coords, delta, button, KeyState.Down, false, time);
                InvokeOnEvent(this, eventArgs);
                MouseDown?.Invoke(this, eventArgs);
                MouseClick?.Invoke(this, eventArgs);
                prevented = eventArgs.DefaultPrevented;
                break;
            }

            case RawMouseMessages.LeftUp:
            case RawMouseMessages.MiddleUp:
            case RawMouseMessages.RightUp:
            {
                MouseButtons    button    = state == RawMouseMessages.LeftUp ? MouseButtons.Left : state == RawMouseMessages.MiddleUp ? MouseButtons.Middle : MouseButtons.Right;
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Key, coords, delta, button, KeyState.Up, false, time);
                InvokeOnEvent(this, eventArgs);
                MouseUp?.Invoke(this, eventArgs);
                prevented = eventArgs.DefaultPrevented;
                break;
            }

            case RawMouseMessages.Wheel:
            {
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.Wheel, coords, delta, MouseButtons.Wheel, delta > 0 ? KeyState.Up : KeyState.Down, false, time);
                InvokeOnEvent(this, eventArgs);
                MouseWheel?.Invoke(this, eventArgs);
                prevented = eventArgs.DefaultPrevented;
                break;
            }

            case RawMouseMessages.HWheel:
            {
                IMouseEventArgs eventArgs = new MouseEventArgs(MouseEventType.HorizontalWheel, coords, delta, MouseButtons.Wheel, delta > 0 ? KeyState.Up : KeyState.Down, false, time);
                InvokeOnEvent(this, eventArgs);
                MouseHorizontalWheel?.Invoke(this, eventArgs);
                prevented = eventArgs.DefaultPrevented;
                break;
            }

            default:
                break;
            }

            return(prevented);
        }