wxmouseeventthis 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. derived from include files <wx/event.h> event table macros to process a mouse event, use these event handler macros to direct input to member functions that take a wxmouseevent argument.
wxmouseevent::m_altdown
wxmouseevent::m_altdownbool m_altdown true if the alt key is pressed down.
wxmouseevent::m_controldownbool m_controldown true if control key is pressed down.
wxmouseevent::m_leftdownbool m_leftdown true if the left mouse button is currently pressed down.
wxmouseevent::m_middledownbool m_middledown true if the middle mouse button is currently pressed down.
wxmouseevent::m_rightdownbool m_rightdown true if the right mouse button is currently pressed down.
wxmouseevent::m_metadownbool m_metadown true if the meta key is pressed down.
wxmouseevent::m_shiftdownbool m_shiftdown true if shift is pressed down.
wxmouseevent::m_xlong m_x x-coordinate of the event.
wxmouseevent::m_ylong m_y y-coordinate of the event.
wxmouseevent::m_wheelrotationint m_wheelrotation the distance the mouse wheel is rotated.
wxmouseevent::m_wheeldeltaint m_wheeldelta the wheel delta, normally 120.
wxmouseevent::m_linesperactionint m_linesperaction the configured number of lines (or whatever) to be scrolled per wheel action.
wxmouseevent::wxmouseeventwxmouseevent(wxtype mouseeventtype = 0) constructor. valid event types are:
wxmouseevent::altdownbool altdown() returns true if the alt key was down at the time of the event.
wxmouseevent::buttonbool button(int button) returns true if the identified mouse button is changing state. valid values of button are:
wxmouseevent::buttondclickbool 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).
wxmouseevent::buttondownbool 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).
wxmouseevent::buttonupbool 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).
wxmouseevent::cmddownbool cmddown() const same as metadown under mac, same as controldown elsewhere. see also
wxmouseevent::controldownbool controldown() returns true if the control key was down at the time of the event.
wxmouseevent::draggingbool dragging() returns true if this was a dragging event (motion while a button is depressed). see also
wxmouseevent::enteringbool entering() returns true if the mouse was entering the window. see also wxmouseevent::leaving.
wxmouseevent::getbuttonint getbutton() const 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.
wxmouseevent::getpositionwxpoint getposition() const void getposition(wxcoord* x, wxcoord* y) const void getposition(long* x, long* y) const 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.
wxmouseevent::getlogicalpositionwxpoint getlogicalposition(const wxdc& dc) const 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).
wxmouseevent::getlinesperactionint getlinesperaction() const returns the configured number of lines (or whatever) to be scrolled per wheel action. defaults to three.
wxmouseevent::getwheelrotationint getwheelrotation() const get wheel rotation, positive or negative indicates direction of rotation. current devices all send an event when rotation is at least +/-wheeldelta, but finer resolution devices can be created in the future. because of this you shouldn't assume that one event is equal to 1 line, but you should be able to either do partial line scrolling or wait until several events accumulate before scrolling.
wxmouseevent::getwheeldeltaint getwheeldelta() const 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.
wxmouseevent::getxlong getx() const returns x coordinate of the physical mouse event position.
wxmouseevent::getylong gety() returns y coordinate of the physical mouse event position.
wxmouseevent::isbuttonbool isbutton() const returns true if the event was a mouse button event (not necessarily a button down event - that may be tested using buttondown).
wxmouseevent::ispagescrollbool ispagescroll() const returns true if the system has been setup to do page scrolling with the mouse wheel instead of line scrolling.
wxmouseevent::leavingbool leaving() const returns true if the mouse was leaving the window. see also wxmouseevent::entering.
wxmouseevent::leftdclickbool leftdclick() const returns true if the event was a left double click.
wxmouseevent::leftdownbool leftdown() const returns true if the left mouse button changed to down.
wxmouseevent::leftisdownbool leftisdown() const 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 event was generated by the left mouse button being pressed. rather, it simply describes the state of the left mouse button at the time when the event was generated (so while it will be true for a left click event, it can also be true for a right click if it happened while the left mouse button was pressed). 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.
wxmouseevent::leftupbool leftup() const returns true if the left mouse button changed to up.
wxmouseevent::metadownbool metadown() const returns true if the meta key was down at the time of the event.
wxmouseevent::middledclickbool middledclick() const returns true if the event was a middle double click.
wxmouseevent::middledownbool middledown() const returns true if the middle mouse button changed to down.
wxmouseevent::middleisdownbool middleisdown() const returns true if the middle mouse button is currently down, independent of the current event type.
wxmouseevent::middleupbool middleup() const returns true if the middle mouse button changed to up.
wxmouseevent::movingbool moving() const 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.
wxmouseevent::rightdclickbool rightdclick() const returns true if the event was a right double click.
wxmouseevent::rightdownbool rightdown() const returns true if the right mouse button changed to down.
wxmouseevent::rightisdownbool rightisdown() const returns true if the right mouse button is currently down, independent of the current event type.
wxmouseevent::rightupbool rightup() const returns true if the right mouse button changed to up.
wxmouseevent::shiftdownbool shiftdown() const returns true if the shift key was down at the time of the event.
|