Skip to main content

Mouse Class

Package: GHIElectronics.Endpoint.Devices.UsbHost
Namespace: GHIElectronics.Endpoint.Devices.UsbHost

Allows a usb device to be used a mouse.

class Mouse : public BaseDevice {};

Remarks​

By default, the reported range for position is between 0 and 512, as on TinyCLR: set it to the screen with SetCursorBounds. The events come on the mouse's own thread.

Nested Types​

TypeKindSummary
Mouse.ButtonChangedEventArgsClassThe events args for the ButtonPressed and ButtonReleased events.
Mouse.ButtonChangedEventHandlerDelegateThe delegate for when one of the mouse's button is pressed or released.
Mouse.CursorMovedEventArgsClassThe events args for the CursorMoved event.
Mouse.CursorMovedEventHandlerDelegateThe delegate for when the mouse's cursor moves.
Mouse.WheelMovedEventArgsClassThe events args for the WheelMoved event.
Mouse.WheelMovedEventHandlerDelegateThe delegate for when the mouse's wheel moves.

Constructors​

Mouse(string deviceName)​

Mouse(const std::string& deviceName);

Opens the mouse that UsbHostController reported ("/dev/input/event2").

Properties​

AbsolutePosition​

bool AbsolutePosition() const;

Return true for absolute, false for relative mode (a USB mouse moves relative).

Returns bool

CursorPosition​

Position CursorPosition() const;

The current position of the cursor.

Returns Position

Extended1ButtonState​

ButtonState Extended1ButtonState() const;

The current state of the mouse's first extended button.

Returns ButtonState

Extended2ButtonState​

ButtonState Extended2ButtonState() const;

The current state of the mouse's second extended button.

Returns ButtonState

LeftButtonState​

ButtonState LeftButtonState() const;

The current state of the mouse's left button.

Returns ButtonState

MiddleButtonState​

ButtonState MiddleButtonState() const;

The current state of the mouse's middle button.

Returns ButtonState

RightButtonState​

ButtonState RightButtonState() const;

The current state of the mouse's right button.

Returns ButtonState

WheelPosition​

int32_t WheelPosition() const;

The current position of the mouse wheel.

Returns int

Methods​

SetCursorBounds(Position minimum, Position maximum)​

void SetCursorBounds(Position minimum, Position maximum);

Sets the cursor bounds.

ParameterTypeDescription
minimumPositionThe minimum bound.
maximumPositionThe maximum bound.

SetCursorPosition(Position newPosition)​

void SetCursorPosition(Position newPosition);

Sets the cursor position.

ParameterTypeDescription
newPositionPositionThe new position of the cursor.

SetScale(float scale)​

void SetScale(float scale);

Scales the x, y, and wheel delta values.

ParameterTypeDescription
scalefloatThe value by which to scale the data.

Events​

ButtonChanged​

Core::Event<...> ButtonChanged;

The event fired when one of the mouse's buttons is pressed or released.

CursorMoved​

Core::Event<...> CursorMoved;

The event fired when the mouse's cursor has moved.

WheelMoved​

Core::Event<...> WheelMoved;

The event fired when the mouse's wheel has moved.