Example #1
0
        /// <summary>
        /// Function to fire the pointing device move event.
        /// </summary>
        /// <param name="newPosition">New position for the pointing device.</param>
        /// <param name="setRelative">TRUE to calculate the relative motion of the device, FALSE to have the plug-in set it.</param>
        /// <remarks>Some plug-ins provide their own relative position data, which is likely to be more accurate, so we can tell the library to not calculate in that instance.</remarks>
        protected void OnPointingDeviceMove(PointF newPosition, bool setRelative)
        {
            if (newPosition != _position)
            {
                if (setRelative)
                {
                    RelativePosition = new PointF(RelativePosition.X + (newPosition.X - _position.X), RelativePosition.Y + (newPosition.Y - _position.Y));
                }

                _position = newPosition;
            }
            else
            {
                if (setRelative)
                {
                    RelativePosition = PointF.Empty;
                }

                return;
            }

            ConstrainData();

            if (PointingDeviceMove == null)
            {
                return;
            }

            var e = new PointingDeviceEventArgs(Button, PointingDeviceButtons.None, _position, _wheel, RelativePosition, WheelDelta, 0);

            PointingDeviceMove(this, e);
        }
Example #2
0
        /// <summary>
        /// Function to fire the pointing device button up event.
        /// </summary>
        /// <param name="button">Button that's being pressed.</param>
        /// <param name="clickCount">Number of full clicks in a timed period.</param>
        protected void OnPointingDeviceUp(PointingDeviceButtons button, int clickCount)
        {
            ConstrainData();
            Button &= ~button;

            if (PointingDeviceUp == null)
            {
                return;
            }

            var e = new PointingDeviceEventArgs(button, Button, _position, _wheel, RelativePosition, WheelDelta, clickCount);

            PointingDeviceUp(this, e);
        }
Example #3
0
        /// <summary>
        /// Function to fire the pointing device button down event.
        /// </summary>
        /// <param name="button">Button that's being pressed.</param>
        protected void OnPointingDeviceDown(PointingDeviceButtons button)
        {
            ConstrainData();
            Button |= button;

            if (PointingDeviceDown == null)
            {
                return;
            }

            var e = new PointingDeviceEventArgs(button, Button, _position, _wheel, RelativePosition, WheelDelta, 0);

            PointingDeviceDown(this, e);
        }
Example #4
0
        /// <summary>
        /// Function to fire the pointing device wheel move event.
        /// </summary>
        protected void OnPointingDeviceWheelMove(int newDelta)
        {
            if (newDelta != WheelDelta)
            {
                WheelDelta = newDelta;
                Wheel     += newDelta;
            }
            else
            {
                WheelDelta = 0;
                return;
            }

            ConstrainData();

            if (PointingDeviceWheelMove == null)
            {
                return;
            }

            var e = new PointingDeviceEventArgs(Button, PointingDeviceButtons.None, _position, _wheel, RelativePosition, WheelDelta, 0);

            PointingDeviceWheelMove(this, e);
        }