This event class contains information about the events generated by the mouse:
they include mouse buttons press and release events and mouse move events.
All mouse events involving the buttons use MOUSE_BTN_LEFT
for the
left mouse button, MOUSE_BTN_MIDDLE
for the middle one and
MOUSE_BTN_RIGHT
for the right one. Note that not all mice have a
middle button so a portable application should avoid relying on the events from
it.
NB: Note that under Windows CE mouse enter and leave events are not natively supported
by the system but are generated by Widgets itself. This has several
drawbacks: the LEAVE_WINDOW event might be received some time after the mouse
left the window and the state variables for it may have changed during this
time.
NB: Note the difference between methods like
left_down and
left_is_down: the former returns true
when the event corresponds to the left mouse button click while the latter
returns true
if the left mouse button is currently being pressed. For
example, when the user is dragging the mouse you can use
left_is_down to test
whether the left mouse button is (still) depressed. Also, by convention, if
left_down returns true
,
left_is_down will also return true
in
Widgets whatever the underlying GUI behaviour is (which is
platform-dependent). The same applies, of course, to other mouse buttons as
well.
To process a mouse event, use these event handler macros to direct input to member
functions that take a MouseEvent argument.
evt_left_down() { | event | … } | Process a EVT_LEFT_DOWN event. Thehandler of this event should normally call event.Skip toallow the default processing to take place as otherwise the window under mousewouldn’t get the focus. |
evt_left_up() { | event | … } | Process a EVT_LEFT_UP event. |
evt_left_dclick() { | event | … } | Process a EVT_LEFT_DCLICK event. |
evt_middle_down() { | event | … } | Process a EVT_MIDDLE_DOWN event. |
evt_middle_up() { | event | … } | Process a EVT_MIDDLE_UP event. |
evt_middle_dclick() { | event | … } | Process a EVT_MIDDLE_DCLICK event. |
evt_right_down() { | event | … } | Process a EVT_RIGHT_DOWN event. |
evt_right_up() { | event | … } | Process a EVT_RIGHT_UP event. |
evt_right_dclick() { | event | … } | Process a EVT_RIGHT_DCLICK event. |
evt_motion() { | event | … } | Process a EVT_MOTION event. |
evt_enter_window() { | event | … } | Process a EVT_ENTER_WINDOW event. |
evt_leave_window() { | event | … } | Process a EVT_LEAVE_WINDOW event. |
evt_mousewheel() { | event | … } | Process a EVT_MOUSEWHEEL event. |
evt_mouse_events() { | event | … } | Process all mouse events. |
boolm_altDown
true if the Alt key is pressed down.
boolm_controlDown
true if control key is pressed down.
boolm_leftDown
true if the left mouse button is currently pressed down.
boolm_middleDown
true if the middle mouse button is currently pressed down.
boolm_rightDown
true if the right mouse button is currently pressed down.
boolm_metaDown
true if the Meta key is pressed down.
boolm_shiftDown
true if shift is pressed down.
longm_x
X-coordinate of the event.
longm_y
Y-coordinate of the event.
intm_wheelRotation
The distance the mouse wheel is rotated.
intm_wheelDelta
The wheel delta, normally $120$.
intm_linesPerAction
The configured number of lines (or whatever) to be scrolled per wheel
action.
Constructor. Valid event types are:
Returns true if the Alt key was down at the time of the event.
Returns true if the identified mouse button is changing state. Valid
values of button are:
MOUSE_BTN_LEFT |
check if left button was pressed |
MOUSE_BTN_MIDDLE |
check if middle button was pressed |
MOUSE_BTN_RIGHT |
check if right button was pressed |
MOUSE_BTN_ANY |
check if any button was pressed |
If the argument is omitted, this returns true if the event was a mouse
double click event. Otherwise the argument specifies which double click event
was generated (see Button for the possible
values).
If the argument is omitted, this returns true if the event was a mouse
button down event. Otherwise the argument specifies which button-down event
was generated (see Button for the possible
values).
If the argument is omitted, this returns true if the event was a mouse
button up event. Otherwise the argument specifies which button-up event
was generated (see Button for the possible
values).
Same as meta_down under Mac, same as
control_down elsewhere.
Returns true if the control key was down at the time of the event.
Returns true if this was a dragging event (motion while a button is depressed).
Returns true if the mouse was entering the window.
See also MouseEvent#leaving.
Returns the mouse button which generated this event or MOUSE_BTN_NONE
if no button is involved (for mouse move, enter or leave event, for example).
Otherwise MOUSE_BTN_LEFT
is returned for the left button down, up and
double click events, MOUSE_BTN_MIDDLE
and MOUSE_BTN_RIGHT
for the same events for the middle and the right buttons respectively.
Sets *x and *y to the position at which the event occurred.
Returns the physical mouse position in pixels.
Note that if the mouse event has been artificially generated from a special
keyboard combination (e.g. under Windows when the ``menu’’ key is pressed), the
returned position is DefaultPosition
.
Returns the logical mouse position in pixels (i.e. translated according to the
translation set for the DC, which usually indicates that the window has been scrolled).
Returns the configured number of lines (or whatever) to be scrolled per
wheel action. Defaults to three.
Get wheel rotation, positive or negative indicates direction of
rotation. Current devices all send an event when rotation is equal to
+/-WheelDelta, but this allows for finer resolution devices to be
created in the future. Because of this you shouldn’t assume that one
event is equal to 1 line or whatever, but you should be able to either
do partial line scrolling or wait until +/-WheelDelta rotation values
have been accumulated before scrolling.
Get wheel delta, normally $120$. This is the threshold for action to be
taken, and one such action (for example, scrolling one increment)
should occur for each delta.
Returns X coordinate of the physical mouse event position.
Returns Y coordinate of the physical mouse event position.
Returns true if the event was a mouse button event (not necessarily a button down event -
that may be tested using ButtonDown).
Returns true if the system has been setup to do page scrolling with
the mouse wheel instead of line scrolling.
Returns true if the mouse was leaving the window.
See also MouseEvent#entering.
Returns true if the event was a left double click.
Returns true if the left mouse button changed to down.
Returns true if the left mouse button is currently down, independent
of the current event type.
Please notice that it is not the same as
left_down which returns true if the left mouse
button was just pressed. Rather, it describes the state of the mouse button
before the event happened.
This event is usually used in the mouse event handlers which process “move
mouse” messages to determine whether the user is (still) dragging the mouse.
Returns true if the left mouse button changed to up.
Returns true if the Meta key was down at the time of the event.
Returns true if the event was a middle double click.
Returns true if the middle mouse button changed to down.
Returns true if the middle mouse button is currently down, independent
of the current event type.
Returns true if the middle mouse button changed to up.
Returns true if this was a motion event and no mouse buttons were pressed.
If any mouse button is held pressed, then this method returns and
Dragging returns .
Returns true if the event was a right double click.
Returns true if the right mouse button changed to down.
Returns true if the right mouse button is currently down, independent
of the current event type.
Returns true if the right mouse button changed to up.
Returns true if the shift key was down at the time of the event.
[This page automatically generated from the Textile source at 2023-06-13 21:31:31 +0000]