1 \section{\class{wxMouseEvent
}}\label{wxmouseevent
}
3 This event class contains information about mouse events.
4 See
\helpref{wxWindow::OnMouseEvent
}{wxwindowonmouseevent
}.
6 {\bf NB:
} Note that under Windows mouse enter and leave events are not natively supported
7 by the system but are generated by wxWindows itself. This has several
8 drawbacks: the LEAVE
\_WINDOW event might be received some time after the mouse
9 left the window and the state variables for it may have changed during this
12 {\bf NB:
} Note the difference between methods like
13 \helpref{LeftDown
}{wxmouseeventleftdown
} and
14 \helpref{LeftIsDown
}{wxmouseeventleftisdown
}: the formet returns
{\tt TRUE
}
15 when the event corresponds to the left mouse button click while the latter
16 returns
{\tt TRUE
} if the left mouse button is currently being pressed. For
17 example, when the user is dragging the mouse you can use
18 \helpref{LeftIsDown
}{wxmouseeventleftisdown
} to test
19 whether the left mouse button is (still) depressed. Also, by convention, if
20 \helpref{LeftDown
}{wxmouseeventleftdown
} returns
{\tt TRUE
},
21 \helpref{LeftIsDown
}{wxmouseeventleftisdown
} will also return
{\tt TRUE
} in
22 wxWindows whatever the underlying GUI behaviour is (which is
23 platform-dependent). The same applies, of course, to other mouse buttons as
26 \wxheading{Derived from
}
28 \helpref{wxEvent
}{wxevent
}
30 \wxheading{Include files
}
34 \wxheading{Event table macros
}
36 To process a mouse event, use these event handler macros to direct input to member
37 functions that take a wxMouseEvent argument.
40 \begin{twocollist
}\itemsep=
0pt
41 \twocolitem{{\bf EVT
\_LEFT\_DOWN(func)
}}{Process a wxEVT
\_LEFT\_DOWN event.
}
42 \twocolitem{{\bf EVT
\_LEFT\_UP(func)
}}{Process a wxEVT
\_LEFT\_UP event.
}
43 \twocolitem{{\bf EVT
\_LEFT\_DCLICK(func)
}}{Process a wxEVT
\_LEFT\_DCLICK event.
}
44 \twocolitem{{\bf EVT
\_MIDDLE\_DOWN(func)
}}{Process a wxEVT
\_MIDDLE\_DOWN event.
}
45 \twocolitem{{\bf EVT
\_MIDDLE\_UP(func)
}}{Process a wxEVT
\_MIDDLE\_UP event.
}
46 \twocolitem{{\bf EVT
\_MIDDLE\_DCLICK(func)
}}{Process a wxEVT
\_MIDDLE\_DCLICK event.
}
47 \twocolitem{{\bf EVT
\_RIGHT\_DOWN(func)
}}{Process a wxEVT
\_RIGHT\_DOWN event.
}
48 \twocolitem{{\bf EVT
\_RIGHT\_UP(func)
}}{Process a wxEVT
\_RIGHT\_UP event.
}
49 \twocolitem{{\bf EVT
\_RIGHT\_DCLICK(func)
}}{Process a wxEVT
\_RIGHT\_DCLICK event.
}
50 \twocolitem{{\bf EVT
\_MOTION(func)
}}{Process a wxEVT
\_MOTION event.
}
51 \twocolitem{{\bf EVT
\_ENTER\_WINDOW(func)
}}{Process a wxEVT
\_ENTER\_WINDOW event.
}
52 \twocolitem{{\bf EVT
\_LEAVE\_WINDOW(func)
}}{Process a wxEVT
\_LEAVE\_WINDOW event.
}
53 \twocolitem{{\bf EVT
\_MOUSE\_EVENTS(func)
}}{Process all mouse events.
}
56 \latexignore{\rtfignore{\wxheading{Members
}}}
58 \membersection{wxMouseEvent::m
\_altDown}
60 \member{bool
}{m
\_altDown}
62 TRUE if the Alt key is pressed down.
64 \membersection{wxMouseEvent::m
\_controlDown}
66 \member{bool
}{m
\_controlDown}
68 TRUE if control key is pressed down.
70 \membersection{wxMouseEvent::m
\_leftDown}
72 \member{bool
}{m
\_leftDown}
74 TRUE if the left mouse button is currently pressed down.
76 \membersection{wxMouseEvent::m
\_middleDown}
78 \member{bool
}{m
\_middleDown}
80 TRUE if the middle mouse button is currently pressed down.
82 \membersection{wxMouseEvent::m
\_rightDown}
84 \member{bool
}{m
\_rightDown}
86 TRUE if the right mouse button is currently pressed down.
88 \membersection{wxMouseEvent::m
\_leftDown}
90 \member{bool
}{m
\_leftDown}
92 TRUE if the left mouse button is currently pressed down.
94 \membersection{wxMouseEvent::m
\_metaDown}
96 \member{bool
}{m
\_metaDown}
98 TRUE if the Meta key is pressed down.
100 \membersection{wxMouseEvent::m
\_shiftDown}
102 \member{bool
}{m
\_shiftDown}
104 TRUE if shift is pressed down.
106 \membersection{wxMouseEvent::m
\_x}
110 X-coordinate of the event.
112 \membersection{wxMouseEvent::m
\_y}
116 Y-coordinate of the event.
118 \membersection{wxMouseEvent::wxMouseEvent
}
120 \func{}{wxMouseEvent
}{\param{WXTYPE
}{ mouseEventType =
0},
\param{int
}{ id =
0}}
122 Constructor. Valid event types are:
126 \item {\bf wxEVT
\_ENTER\_WINDOW}
127 \item {\bf wxEVT
\_LEAVE\_WINDOW}
128 \item {\bf wxEVT
\_LEFT\_DOWN}
129 \item {\bf wxEVT
\_LEFT\_UP}
130 \item {\bf wxEVT
\_LEFT\_DCLICK}
131 \item {\bf wxEVT
\_MIDDLE\_DOWN}
132 \item {\bf wxEVT
\_MIDDLE\_UP}
133 \item {\bf wxEVT
\_MIDDLE\_DCLICK}
134 \item {\bf wxEVT
\_RIGHT\_DOWN}
135 \item {\bf wxEVT
\_RIGHT\_UP}
136 \item {\bf wxEVT
\_RIGHT\_DCLICK}
137 \item {\bf wxEVT
\_MOTION}
140 \membersection{wxMouseEvent::AltDown
}
142 \func{bool
}{AltDown
}{\void}
144 Returns TRUE if the Alt key was down at the time of the event.
146 \membersection{wxMouseEvent::Button
}
148 \func{bool
}{Button
}{\param{int
}{ button
}}
150 Returns TRUE if the identified mouse button is changing state. Valid
151 values of
{\it button
} are
1,
2 or
3 for left, middle and right
152 buttons respectively.
154 Not all mice have middle buttons so a portable application should avoid
157 \membersection{wxMouseEvent::ButtonDClick
}\label{buttondclick
}
159 \func{bool
}{ButtonDClick
}{\param{int
}{ but = -
1}}
161 If the argument is omitted, this returns TRUE if the event was a mouse
162 double click event. Otherwise the argument specifies which double click event
163 was generated (
1,
2 or
3 for left, middle and right buttons respectively).
165 \membersection{wxMouseEvent::ButtonDown
}
167 \func{bool
}{ButtonDown
}{\param{int
}{ but = -
1}}
169 If the argument is omitted, this returns TRUE if the event was a mouse
170 button down event. Otherwise the argument specifies which button-down event
171 was generated (
1,
2 or
3 for left, middle and right buttons respectively).
173 \membersection{wxMouseEvent::ButtonUp
}
175 \func{bool
}{ButtonUp
}{\param{int
}{ but = -
1}}
177 If the argument is omitted, this returns TRUE if the event was a mouse
178 button up event. Otherwise the argument specifies which button-up event
179 was generated (
1,
2 or
3 for left, middle and right buttons respectively).
181 \membersection{wxMouseEvent::ControlDown
}
183 \func{bool
}{ControlDown
}{\void}
185 Returns TRUE if the control key was down at the time of the event.
187 \membersection{wxMouseEvent::Dragging
}
189 \func{bool
}{Dragging
}{\void}
191 Returns TRUE if this was a dragging event (motion while a button is depressed).
193 \membersection{wxMouseEvent::Entering
}\label{wxmouseevententering
}
195 \func{bool
}{Entering
}{\void}
197 Returns TRUE if the mouse was entering the window.
199 See also
\helpref{wxMouseEvent::Leaving
}{wxmouseeventleaving
}.
201 \membersection{wxMouseEvent::GetPosition
}\label{wxmouseeventgetposition
}
203 \constfunc{wxPoint
}{GetPosition
}{\void}
205 \constfunc{void
}{GetPosition
}{\param{wxCoord*
}{ x
},
\param{wxCoord*
}{ y
}}
207 \constfunc{void
}{GetPosition
}{\param{long*
}{ x
},
\param{long*
}{ y
}}
209 Sets *x and *y to the position at which the event occurred.
211 Returns the physical mouse position in pixels.
213 \membersection{wxMouseEvent::GetLogicalPosition
}\label{wxmouseeventgetlogicalposition
}
215 \constfunc{wxPoint
}{GetLogicalPosition
}{\param{const wxDC\&
}{ dc
}}
217 Returns the logical mouse position in pixels (i.e. translated according to the
218 translation set for the DC, which usually indicates that the window has been scrolled).
220 \membersection{wxMouseEvent::GetX
}\label{wxmouseeventgetx
}
222 \constfunc{long
}{GetX
}{\void}
224 Returns X coordinate of the physical mouse event position.
226 \membersection{wxMouseEvent::GetY
}\label{wxmouseeventgety
}
228 \func{long
}{GetY
}{\void}
230 Returns Y coordinate of the physical mouse event position.
232 \membersection{wxMouseEvent::IsButton
}
234 \constfunc{bool
}{IsButton
}{\void}
236 Returns TRUE if the event was a mouse button event (not necessarily a button down event -
237 that may be tested using
{\it ButtonDown
}).
239 \membersection{wxMouseEvent::Leaving
}\label{wxmouseeventleaving
}
241 \constfunc{bool
}{Leaving
}{\void}
243 Returns TRUE if the mouse was leaving the window.
245 See also
\helpref{wxMouseEvent::Entering
}{wxmouseevententering
}.
247 \membersection{wxMouseEvent::LeftDClick
}
249 \constfunc{bool
}{LeftDClick
}{\void}
251 Returns TRUE if the event was a left double click.
253 \membersection{wxMouseEvent::LeftDown
}\label{wxmouseeventleftdown
}
255 \constfunc{bool
}{LeftDown
}{\void}
257 Returns TRUE if the left mouse button changed to down.
259 \membersection{wxMouseEvent::LeftIsDown
}\label{wxmouseeventleftisdown
}
261 \constfunc{bool
}{LeftIsDown
}{\void}
263 Returns TRUE if the left mouse button is currently down, independent
264 of the current event type.
266 Please notice that it is
{\bf not
} the same as
267 \helpref{LeftDown
}{wxmouseeventleftdown
} which returns TRUE if the left mouse
268 button was just pressed. Rather, it describes the state of the mouse button
269 before the event happened.
271 This event is usually used in the mouse event handlers which process "move
272 mouse" messages to determine whether the user is (still) dragging the mouse.
274 \membersection{wxMouseEvent::LeftUp
}
276 \constfunc{bool
}{LeftUp
}{\void}
278 Returns TRUE if the left mouse button changed to up.
280 \membersection{wxMouseEvent::MetaDown
}
282 \constfunc{bool
}{MetaDown
}{\void}
284 Returns TRUE if the Meta key was down at the time of the event.
286 \membersection{wxMouseEvent::MiddleDClick
}
288 \constfunc{bool
}{MiddleDClick
}{\void}
290 Returns TRUE if the event was a middle double click.
292 \membersection{wxMouseEvent::MiddleDown
}
294 \constfunc{bool
}{MiddleDown
}{\void}
296 Returns TRUE if the middle mouse button changed to down.
298 \membersection{wxMouseEvent::MiddleIsDown
}\label{wxmouseeventmiddleisdown
}
300 \constfunc{bool
}{MiddleIsDown
}{\void}
302 Returns TRUE if the middle mouse button is currently down, independent
303 of the current event type.
305 \membersection{wxMouseEvent::MiddleUp
}
307 \constfunc{bool
}{MiddleUp
}{\void}
309 Returns TRUE if the middle mouse button changed to up.
311 \membersection{wxMouseEvent::Moving
}
313 \constfunc{bool
}{Moving
}{\void}
315 Returns TRUE if this was a motion event (no buttons depressed).
317 \membersection{wxMouseEvent::RightDClick
}
319 \constfunc{bool
}{RightDClick
}{\void}
321 Returns TRUE if the event was a right double click.
323 \membersection{wxMouseEvent::RightDown
}
325 \constfunc{bool
}{RightDown
}{\void}
327 Returns TRUE if the right mouse button changed to down.
329 \membersection{wxMouseEvent::RightIsDown
}\label{wxmouseeventrightisdown
}
331 \constfunc{bool
}{RightIsDown
}{\void}
333 Returns TRUE if the right mouse button is currently down, independent
334 of the current event type.
336 \membersection{wxMouseEvent::RightUp
}
338 \constfunc{bool
}{RightUp
}{\void}
340 Returns TRUE if the right mouse button changed to up.
342 \membersection{wxMouseEvent::ShiftDown
}
344 \constfunc{bool
}{ShiftDown
}{\void}
346 Returns TRUE if the shift key was down at the time of the event.