コード例 #1
0
ファイル: RawPointingDevice.cs プロジェクト: tmp7701/Gorgon
        /// <summary>
        /// Function to reset the buttons.
        /// </summary>
        public override void ResetButtons()
        {
            base.ResetButtons();

            // Ensure that the double clicking functionality is turned off.
            _doubleClickButton = PointingDeviceButtons.None;
            _doubleClicker.Reset();
            _clickCount = 0;
        }
コード例 #2
0
ファイル: GorgonInputEvents.cs プロジェクト: tmp7701/Gorgon
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="buttons">Buttons that are pressed during mouse event.</param>
 /// <param name="shiftButtons">Buttons that are held down during the mouse evnet.</param>
 /// <param name="position">Position of the mouse.</param>
 /// <param name="wheelPosition">Position of the wheel.</param>
 /// <param name="relativePosition">Relative position of the mouse.</param>
 /// <param name="wheelDelta">Relative position of the wheel.</param>
 /// <param name="clickCount">Number of clicks in a timed period.</param>
 public PointingDeviceEventArgs(PointingDeviceButtons buttons, PointingDeviceButtons shiftButtons, PointF position, int wheelPosition, PointF relativePosition, int wheelDelta, int clickCount)
 {
     _button        = buttons;
     _shiftButtons  = shiftButtons;
     _position      = position;
     _wheelPosition = wheelPosition;
     _relative      = relativePosition;
     _wheelDelta    = wheelDelta;
     _clickCount    = clickCount;
 }
コード例 #3
0
ファイル: RawPointingDevice.cs プロジェクト: tmp7701/Gorgon
        /// <summary>
        /// Function to return whether a pointing device click is a double click or not.
        /// </summary>
        /// <param name="button">Button used for double click.</param>
        /// <returns>TRUE if it is a double click, FALSE if not.</returns>
        private bool IsDoubleClick(PointingDeviceButtons button)
        {
            if ((button != _doubleClickButton) ||
                (_doubleClicker.Milliseconds > DoubleClickDelay))
            {
                return(false);
            }

            return((!((Position.X - _doubleClickPosition.X).Abs() > DoubleClickRange.X)) &&
                   (!((Position.Y - _doubleClickPosition.Y).Abs() > DoubleClickRange.Y)));
        }
コード例 #4
0
ファイル: RawPointingDevice.cs プロジェクト: tmp7701/Gorgon
        /// <summary>
        /// Function to begin a double click.
        /// </summary>
        /// <param name="button">Button used for double click.</param>
        private void BeginDoubleClick(PointingDeviceButtons button)
        {
            if (_clickCount >= 1)
            {
                return;
            }

            _doubleClickPosition = Position;
            _doubleClickButton   = button;
            _doubleClicker.Reset();
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonPointingDevice"/> class.
        /// </summary>
        /// <param name="owner">The control that owns this device.</param>
        /// <param name="deviceName">Name of the input device.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="owner"/> parameter is NULL (or Nothing in VB.NET).</exception>
        protected GorgonPointingDevice(GorgonInputFactory owner, string deviceName)
            : base(owner, deviceName)
        {
            _position           = PointF.Empty;
            Button              = PointingDeviceButtons.None;
            _positionConstraint = RectangleF.Empty;
            _wheelConstraint    = Point.Empty;

            ResetCursor();
            ShowCursor();

            DoubleClickDelay = SystemInformation.DoubleClickTime;
            DoubleClickRange = new PointF(SystemInformation.DoubleClickSize.Width, SystemInformation.DoubleClickSize.Height);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }
コード例 #8
0
        /// <summary>
        /// Function to update the mouse information.
        /// </summary>
        /// <param name="position">The position of the mouse cursor.</param>
        /// <param name="button">The current button being held down.</param>
        private void UpdateMouseLabel(PointF position, PointingDeviceButtons button)
        {
            if ((button & PointingDeviceButtons.Button1) == PointingDeviceButtons.Button1)
            {
                _spray.SprayPoint(Point.Round(position));
                _currentCursor = Resources.hand_pointer_icon;
            }
            else
            {
                _currentCursor = Resources.hand_icon;
            }

            _mousePosition = new Point((int)position.X, (int)_mouse.Position.Y);

            labelMouse.Text = string.Format("{0}: {1}x{2}.  Button: {3}.  Using {4} for data retrieval.",
                                            _mouse.Name,
                                            position.X.ToString("0.#"),
                                            position.Y.ToString("0.#"),
                                            button,
                                            (_usePolling ? "Polling" : "Events"));
        }
コード例 #9
0
 /// <summary>
 /// Function to reset the buttons.
 /// </summary>
 public virtual void ResetButtons()
 {
     Button = PointingDeviceButtons.None;
 }