.\" This is a wxWidgets manpage page generated from the XML docs .TH wxMouseEvent 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxMouseEvent \- A mouse event .SH DESCRIPTION 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 wxMOUSE_BTN_LEFT for the left mouse button, wxMOUSE_BTN_MIDDLE for the middle one and wxMOUSE_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 wxWidgets 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 LeftDown and LeftIsDown : 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 LeftIsDown to test whether the left mouse button is (still) depressed. Also, by convention, if LeftDown returns true , LeftIsDown will also return true in wxWidgets whatever the underlying GUI behaviour is (which is platform-dependent). The same applies, of course, to other mouse buttons as well. .SH "PARENTS" wxEvent .SH "INCLUDE FILES" wx/event.h .SH MEMBERS .SS wxMouseEvent (WXTYPE mouseEventType = 0) Constructor. Valid event types are: wxEVT_ENTER_WINDOW wxEVT_LEAVE_WINDOW wxEVT_LEFT_DOWN wxEVT_LEFT_UP wxEVT_LEFT_DCLICK wxEVT_MIDDLE_DOWN wxEVT_MIDDLE_UP wxEVT_MIDDLE_DCLICK wxEVT_RIGHT_DOWN wxEVT_RIGHT_UP wxEVT_RIGHT_DCLICK wxEVT_MOTION wxEVT_MOUSEWHEEL .SS bool AltDown () Returns true if the Alt key was down at the time of the event. .SS bool Button (int button) Returns true if the identified mouse button is changing state. Valid values of button are: wxMOUSE_BTN_LEFT check if left button was pressed wxMOUSE_BTN_MIDDLE check if middle button was pressed wxMOUSE_BTN_RIGHT check if right button was pressed wxMOUSE_BTN_ANY check if any button was pressed .SS bool ButtonDClick (int but = wxMOUSE_BTN_ANY) 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). .SS bool ButtonDown (int but = -1) 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). .SS bool ButtonUp (int but = -1) 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). .SS bool CmdDown () Same as MetaDown under Mac, same as ControlDown elsewhere. .SS bool ControlDown () Returns true if the control key was down at the time of the event. .SS bool Dragging () Returns true if this was a dragging event (motion while a button is depressed). .SS bool Entering () Returns true if the mouse was entering the window. See also wxMouseEvent::Leaving . .SS int GetButton () Returns the mouse button which generated this event or wxMOUSE_BTN_NONE if no button is involved (for mouse move, enter or leave event, for example). Otherwise wxMOUSE_BTN_LEFT is returned for the left button down, up and double click events, wxMOUSE_BTN_MIDDLE and wxMOUSE_BTN_RIGHT for the same events for the middle and the right buttons respectively. .SS wxPoint GetPosition () .SS void GetPosition (wxCoord* xwxCoord* y) .SS void GetPosition (long* xlong* y) 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 wxDefaultPosition . .SS wxPoint GetLogicalPosition (const wxDC& dc) 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). .SS int GetLinesPerAction () Returns the configured number of lines (or whatever) to be scrolled per wheel action. Defaults to three. .SS int GetWheelRotation () 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. .SS int GetWheelDelta () 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. .SS long GetX () Returns X coordinate of the physical mouse event position. .SS long GetY () Returns Y coordinate of the physical mouse event position. .SS bool IsButton () Returns true if the event was a mouse button event (not necessarily a button down event - that may be tested using ButtonDown ). .SS bool IsPageScroll () Returns true if the system has been setup to do page scrolling with the mouse wheel instead of line scrolling. .SS bool Leaving () Returns true if the mouse was leaving the window. See also wxMouseEvent::Entering . .SS bool LeftDClick () Returns true if the event was a left double click. .SS bool LeftDown () Returns true if the left mouse button changed to down. .SS bool LeftIsDown () 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 LeftDown 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. .SS bool LeftUp () Returns true if the left mouse button changed to up. .SS bool MetaDown () Returns true if the Meta key was down at the time of the event. .SS bool MiddleDClick () Returns true if the event was a middle double click. .SS bool MiddleDown () Returns true if the middle mouse button changed to down. .SS bool MiddleIsDown () Returns true if the middle mouse button is currently down, independent of the current event type. .SS bool MiddleUp () Returns true if the middle mouse button changed to up. .SS bool Moving () 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 false and Dragging returns true. .SS bool RightDClick () Returns true if the event was a right double click. .SS bool RightDown () Returns true if the right mouse button changed to down. .SS bool RightIsDown () Returns true if the right mouse button is currently down, independent of the current event type. .SS bool RightUp () Returns true if the right mouse button changed to up. .SS bool ShiftDown () Returns true if the shift key was down at the time of the event. .SH EVENTS .SS EVT_LEFT_DOWN(func) Process a wxEVT_LEFT_DOWN event. The handler of this event should normally call event.Skip() to allow the default processing to take place as otherwise the window under mouse wouldn't get the focus. .SS EVT_LEFT_UP(func) Process a wxEVT_LEFT_UP event. .SS EVT_LEFT_DCLICK(func) Process a wxEVT_LEFT_DCLICK event. .SS EVT_MIDDLE_DOWN(func) Process a wxEVT_MIDDLE_DOWN event. .SS EVT_MIDDLE_UP(func) Process a wxEVT_MIDDLE_UP event. .SS EVT_MIDDLE_DCLICK(func) Process a wxEVT_MIDDLE_DCLICK event. .SS EVT_RIGHT_DOWN(func) Process a wxEVT_RIGHT_DOWN event. .SS EVT_RIGHT_UP(func) Process a wxEVT_RIGHT_UP event. .SS EVT_RIGHT_DCLICK(func) Process a wxEVT_RIGHT_DCLICK event. .SS EVT_MOTION(func) Process a wxEVT_MOTION event. .SS EVT_ENTER_WINDOW(func) Process a wxEVT_ENTER_WINDOW event. .SS EVT_LEAVE_WINDOW(func) Process a wxEVT_LEAVE_WINDOW event. .SS EVT_MOUSEWHEEL(func) Process a wxEVT_MOUSEWHEEL event. .SS EVT_MOUSE_EVENTS(func) Process all mouse events. .SH "SEE ALSO" wxEvent .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.