internal MouseWheelEventArgs(Native.SDL_MouseWheelEvent wheel) : base(wheel.Timestamp)
 {
     _windowId = wheel.WindowId;
     IsTouch   = wheel.Which == uint.MaxValue;
     Location  = (wheel.X, wheel.Y);
     Direction = wheel.Direction;
 }
Exemple #2
0
 public async Task Wheel(int delta, MouseWheelDirection direction)
 {
     if (await WaitForName())
     {
         workspaceNetwork.Wheel(serverName !, delta, direction);
     }
 }
Exemple #3
0
 public OnWheelEvent(ModifierKeys modifierKeys, MouseButton mouseButton, MouseWheelDirection direcction, int wheel, DefinedActions definedActions)
 {
     this.ModifierKeys        = modifierKeys;
     this.MouseButton         = mouseButton;
     this.MouseWheelDirection = direcction;
     this.WheelCount          = wheel;
     this.DefinedActions      = definedActions;
 }
 public static MouseInputData GetWheelData(MouseWheelDirection direction, int amount)
 {
     return(new MouseInputData
     {
         dwFlags = MouseEventFlags.MOUSEEVENTF_WHEEL,
         mouseData = (direction == MouseWheelDirection.WheelUp ? amount : -amount) * 120
     });
 }
        public Task Wheel(int delta, MouseWheelDirection direction)
        {
            var wheel = new Native.INPUT()
            {
                Type = Native.Constants.INPUT_MOUSE,
            };

            wheel.Data.Mouse.dwFlags   = direction == MouseWheelDirection.Horizontal ? Native.MOUSEEVENTF.HWHEEL : Native.MOUSEEVENTF.WHEEL;
            wheel.Data.Mouse.mouseData = delta;
            wheel.SendSingleInput();
            return(Task.CompletedTask);
        }
Exemple #6
0
        public void MouseWheel(Point position, MouseWheelDirection direction)
        {
            switch (direction)
            {
            case MouseWheelDirection.Up:
                Zoom(ZoomDirection.In, position);
                break;

            case MouseWheelDirection.Down:
                Zoom(ZoomDirection.Out, position);
                break;
            }
        }
        /// <summary>
        /// Get if <paramref name="direction"/> si a valid value.
        /// </summary>
        /// <param name="direction"><see cref="MouseWheelDirection"/></param>
        /// <returns>True if <paramref name="direction"/> is valid</returns>
        public static bool IsDefined(MouseWheelDirection direction)
        {
            switch (direction)
            {
            case MouseWheelDirection.None:
            case MouseWheelDirection.Up:
            case MouseWheelDirection.Down:
                return(true);

            default:
                return(false);
            }
        }
        /// <summary>
        /// Get the string representation of <paramref name="direction"/>
        /// </summary>
        /// <param name="direction"><see cref="MouseWheelDirection"/></param>
        /// <returns>The string representation.</returns>
        public static string ToName(this MouseWheelDirection direction)
        {
            switch (direction)
            {
            case MouseWheelDirection.None:
                return(nameof(MouseWheelDirection.None));

            case MouseWheelDirection.Up:
                return(nameof(MouseWheelDirection.Up));

            case MouseWheelDirection.Down:
                return(nameof(MouseWheelDirection.Down));

            default:
                throw new ArgumentOutOfRangeException(nameof(direction), direction, null);
            }
        }
        private void OnMouseWheelScroll(float distance, MouseWheelDirection direction)
        {
            if (!_thisEnabled)
            {
                return;
            }

            switch (direction)
            {
            case MouseWheelDirection.Forward:
            {
                if (_activeItemIndex < _items.Count - 1)
                {
                    _activeItemIndex++;
                }
                else
                {
                    _activeItemIndex = 0;
                }

                break;
            }

            case MouseWheelDirection.Backward:
            {
                if (_activeItemIndex > 0)
                {
                    _activeItemIndex--;
                }
                else
                {
                    _activeItemIndex = _items.Count - 1;
                }

                break;
            }
            }

            _activeItem = _items.Values.ToList()[_activeItemIndex];
            UpdateActiveItemImage();
            UpdateActiveItemDesc();
            UpdateScrollbarPosition();

            GameEvents.current.FireEvent_InventoryActiveItemChanged(_activeItem);
        }
Exemple #10
0
        private static void ApplyMouseWheelDirection(this IMuteMap map, MouseWheelDirection direction)
        {
            switch (direction)
            {
            case MouseWheelDirection.Forward:
                map.MouseWheelSpeed = 0.5;
                break;

            case MouseWheelDirection.Reverse:
                map.MouseWheelSpeed = 2.0;
                break;

            // case MouseWheelDirection.None:
            default:
                map.MouseWheelSpeed = 1.0;
                break;
            }
        }
    private void ChangeThumbnailSize(MouseWheelDirection direction)
    {
        switch (direction)
        {
        case MouseWheelDirection.Up:
            if (Config.ThumbnailSize <= 260)
            {
                Config.ThumbnailSize += 8;
            }
            break;

        case MouseWheelDirection.Down:
            if (Config.ThumbnailSize >= 30)
            {
                Config.ThumbnailSize -= 8;
            }
            break;
        }
    }
Exemple #12
0
 public void FireEvent_MouseWheelScroll(float distance, MouseWheelDirection direction)
 {
     Event_OnMouseWheelScroll?.Invoke(distance, direction);
 }
 public abstract void WheelMouse(MouseWheelDirection direction, int amount);
 public override void WheelMouse(MouseWheelDirection direction, int amount) => NativeMethods.DoEverything();
Exemple #15
0
 public MouseWheelEvent(MouseStatus previous, MouseStatus status, MouseWheelDirection direction) : base(previous, status)
 {
     Direction = direction;
 }
Exemple #16
0
        public void OnMouseWheel(MouseWheelDirection direction, MouseStatus nextStatus)
        {
            MouseWheel?.Invoke(sender, new MouseWheelEvent(LastMouseStatus, nextStatus, direction));

            OnMouseChange(nextStatus);
        }
Exemple #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseWheelEventArgs"/> class.
 /// </summary>
 /// <param name="position">
 /// The <see cref="Coord"/> in the input-space at which the event occurred.
 /// </param>
 /// <param name="direction">
 /// The <see cref="MouseWheelDirection"/> the mouse was scrolled in.
 /// </param>
 public MouseWheelEventArgs(Coord position, MouseWheelDirection direction)
 {
     this.Position  = position;
     this.Direction = direction;
 }
        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;
            }
        }
Exemple #19
0
 public MouseWheelEventArgs(int delta, MouseWheelDirection direction)
 {
     Delta     = delta;
     Direction = direction;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseWheelGesture"/> class.
 /// </summary>
 /// <param name="direction">The <see cref="MouseWheelDirection"/></param>
 /// <param name="modifiers">Modifiers</param>
 public MouseWheelGesture(MouseWheelDirection direction, ModifierKeys modifiers)
     : base(MouseAction.WheelClick, modifiers)
 {
     this.Direction = direction;
 }
Exemple #21
0
 /// <summary>
 /// Add the mouse wheel to the Button.
 /// </summary>
 /// <param name="direction">The mouse wheel direction to add.</param>
 /// <returns>The Button.</returns>
 public Button AddMouseWheel(MouseWheelDirection direction)
 {
     MouseWheel.Add(direction);
     return(this);
 }
Exemple #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseWheelExtension"/> class.
 /// </summary>
 /// <param name="direction"><see cref="MouseWheelDirection"/></param>
 /// <param name="modifiers"><see cref="ModifierKeys"/></param>
 public MouseWheelExtension(ModifierKeys modifiers, MouseWheelDirection direction)
     : this(new MouseWheelGesture(direction, modifiers))
 {
 }
Exemple #23
0
 /// <summary>
 /// Add the mouse wheel to the Button.
 /// </summary>
 /// <param name="direction">The mouse wheel direction to add.</param>
 /// <returns>The Button.</returns>
 public Button AddMouseWheel(MouseWheelDirection direction)
 {
     MouseWheel.Add(direction);
     return this;
 }
Exemple #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseWheelExtension"/> class.
 /// </summary>
 /// <param name="direction"><see cref="MouseWheelDirection"/></param>
 public MouseWheelExtension(MouseWheelDirection direction)
     : this(ModifierKeys.None, direction)
 {
 }
            public static void MouseWheel(MouseWheelDirection direction, int amount)
            {
                var wheelInput = new INPUT(MouseInputData.GetWheelData(direction, amount));

                SendInput(1, ref wheelInput, Marshal.SizeOf <INPUT>());
            }
 public override void WheelMouse(MouseWheelDirection direction, int amount) => NativeMethods.MouseWheel(direction, amount);
Exemple #27
0
 public EventKey(EventType t, MouseWheelDirection val)
 {
     this._Val = ((int)t << 24) | ((int)val & 0x00ffffff);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MouseWheelGesture"/> class.
 /// </summary>
 /// <param name="direction">The <see cref="MouseWheelDirection"/></param>
 public MouseWheelGesture(MouseWheelDirection direction)
 //// ReSharper disable once IntroduceOptionalParameters.Global
     : this(direction, ModifierKeys.None)
 {
 }
Exemple #29
0
 public bool Equals(MouseWheelDirection other)
 {
     return((this.KeyType == EventType.MouseWheel) && (this.ValueAsMouseWheelDirection == other));
 }
Exemple #30
0
 public MouseWheelGesture(ModifierKeys keys, MouseWheelDirection direction)
     : base(MouseAction.WheelClick, keys)
 {
     Direction = direction;
 }
Exemple #31
0
 public MouseWheelReceivedEventArgs(string from, int delta, MouseWheelDirection direction)
 {
     From      = from;
     Delta     = delta;
     Direction = direction;
 }