]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxMouseEvent}}\label{wxmouseevent} |
2 | ||
fe604ccd JS |
3 | This event class contains information about mouse events. |
4 | See \helpref{wxWindow::OnMouseEvent}{wxwindowonmouseevent}. | |
a660d684 | 5 | |
4aff28fc VZ |
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 | |
10 | time. | |
11 | ||
a660d684 KB |
12 | \wxheading{Derived from} |
13 | ||
14 | \helpref{wxEvent}{wxevent} | |
15 | ||
954b8ae6 JS |
16 | \wxheading{Include files} |
17 | ||
18 | <wx/event.h> | |
19 | ||
a660d684 KB |
20 | \wxheading{Event table macros} |
21 | ||
22 | To process a mouse event, use these event handler macros to direct input to member | |
23 | functions that take a wxMouseEvent argument. | |
24 | ||
25 | \twocolwidtha{7cm} | |
26 | \begin{twocollist}\itemsep=0pt | |
27 | \twocolitem{{\bf EVT\_LEFT\_DOWN(func)}}{Process a wxEVT\_LEFT\_DOWN event.} | |
28 | \twocolitem{{\bf EVT\_LEFT\_UP(func)}}{Process a wxEVT\_LEFT\_UP event.} | |
29 | \twocolitem{{\bf EVT\_LEFT\_DCLICK(func)}}{Process a wxEVT\_LEFT\_DCLICK event.} | |
30 | \twocolitem{{\bf EVT\_MIDDLE\_DOWN(func)}}{Process a wxEVT\_MIDDLE\_DOWN event.} | |
31 | \twocolitem{{\bf EVT\_MIDDLE\_UP(func)}}{Process a wxEVT\_MIDDLE\_UP event.} | |
32 | \twocolitem{{\bf EVT\_MIDDLE\_DCLICK(func)}}{Process a wxEVT\_MIDDLE\_DCLICK event.} | |
33 | \twocolitem{{\bf EVT\_RIGHT\_DOWN(func)}}{Process a wxEVT\_RIGHT\_DOWN event.} | |
34 | \twocolitem{{\bf EVT\_RIGHT\_UP(func)}}{Process a wxEVT\_RIGHT\_UP event.} | |
35 | \twocolitem{{\bf EVT\_RIGHT\_DCLICK(func)}}{Process a wxEVT\_RIGHT\_DCLICK event.} | |
36 | \twocolitem{{\bf EVT\_MOTION(func)}}{Process a wxEVT\_MOTION event.} | |
37 | \twocolitem{{\bf EVT\_ENTER\_WINDOW(func)}}{Process a wxEVT\_ENTER\_WINDOW event.} | |
38 | \twocolitem{{\bf EVT\_LEAVE\_WINDOW(func)}}{Process a wxEVT\_LEAVE\_WINDOW event.} | |
5de76427 | 39 | \twocolitem{{\bf EVT\_MOUSE\_EVENTS(func)}}{Process all mouse events.} |
a660d684 KB |
40 | \end{twocollist}% |
41 | ||
42 | \latexignore{\rtfignore{\wxheading{Members}}} | |
43 | ||
44 | \membersection{wxMouseEvent::m\_altDown} | |
45 | ||
46 | \member{bool}{m\_altDown} | |
47 | ||
48 | TRUE if the Alt key is pressed down. | |
49 | ||
50 | \membersection{wxMouseEvent::m\_controlDown} | |
51 | ||
52 | \member{bool}{m\_controlDown} | |
53 | ||
54 | TRUE if control key is pressed down. | |
55 | ||
56 | \membersection{wxMouseEvent::m\_leftDown} | |
57 | ||
58 | \member{bool}{m\_leftDown} | |
59 | ||
60 | TRUE if the left mouse button is currently pressed down. | |
61 | ||
62 | \membersection{wxMouseEvent::m\_middleDown} | |
63 | ||
64 | \member{bool}{m\_middleDown} | |
65 | ||
66 | TRUE if the middle mouse button is currently pressed down. | |
67 | ||
68 | \membersection{wxMouseEvent::m\_rightDown} | |
69 | ||
70 | \member{bool}{m\_rightDown} | |
71 | ||
72 | TRUE if the right mouse button is currently pressed down. | |
73 | ||
74 | \membersection{wxMouseEvent::m\_leftDown} | |
75 | ||
76 | \member{bool}{m\_leftDown} | |
77 | ||
78 | TRUE if the left mouse button is currently pressed down. | |
79 | ||
80 | \membersection{wxMouseEvent::m\_metaDown} | |
81 | ||
82 | \member{bool}{m\_metaDown} | |
83 | ||
84 | TRUE if the Meta key is pressed down. | |
85 | ||
86 | \membersection{wxMouseEvent::m\_shiftDown} | |
87 | ||
88 | \member{bool}{m\_shiftDown} | |
89 | ||
90 | TRUE if shift is pressed down. | |
91 | ||
92 | \membersection{wxMouseEvent::m\_x} | |
93 | ||
803ef874 | 94 | \member{long}{m\_x} |
a660d684 KB |
95 | |
96 | X-coordinate of the event. | |
97 | ||
98 | \membersection{wxMouseEvent::m\_y} | |
99 | ||
803ef874 | 100 | \member{long}{m\_y} |
a660d684 KB |
101 | |
102 | Y-coordinate of the event. | |
103 | ||
104 | \membersection{wxMouseEvent::wxMouseEvent} | |
105 | ||
106 | \func{}{wxMouseEvent}{\param{WXTYPE}{ mouseEventType = 0}, \param{int}{ id = 0}} | |
107 | ||
108 | Constructor. Valid event types are: | |
109 | ||
110 | \begin{itemize} | |
111 | \itemsep=0pt | |
112 | \item {\bf wxEVT\_ENTER\_WINDOW} | |
113 | \item {\bf wxEVT\_LEAVE\_WINDOW} | |
114 | \item {\bf wxEVT\_LEFT\_DOWN} | |
115 | \item {\bf wxEVT\_LEFT\_UP} | |
116 | \item {\bf wxEVT\_LEFT\_DCLICK} | |
117 | \item {\bf wxEVT\_MIDDLE\_DOWN} | |
118 | \item {\bf wxEVT\_MIDDLE\_UP} | |
119 | \item {\bf wxEVT\_MIDDLE\_DCLICK} | |
120 | \item {\bf wxEVT\_RIGHT\_DOWN} | |
121 | \item {\bf wxEVT\_RIGHT\_UP} | |
122 | \item {\bf wxEVT\_RIGHT\_DCLICK} | |
123 | \item {\bf wxEVT\_MOTION} | |
124 | \end{itemize} | |
125 | ||
126 | \membersection{wxMouseEvent::AltDown} | |
127 | ||
128 | \func{bool}{AltDown}{\void} | |
129 | ||
130 | Returns TRUE if the Alt key was down at the time of the event. | |
131 | ||
132 | \membersection{wxMouseEvent::Button} | |
133 | ||
134 | \func{bool}{Button}{\param{int}{ button}} | |
135 | ||
136 | Returns TRUE if the identified mouse button is changing state. Valid | |
137 | values of {\it button} are 1, 2 or 3 for left, middle and right | |
138 | buttons respectively. | |
139 | ||
140 | Not all mice have middle buttons so a portable application should avoid | |
141 | this one. | |
142 | ||
143 | \membersection{wxMouseEvent::ButtonDClick}\label{buttondclick} | |
144 | ||
145 | \func{bool}{ButtonDClick}{\param{int}{ but = -1}} | |
146 | ||
147 | If the argument is omitted, this returns TRUE if the event was a mouse | |
148 | double click event. Otherwise the argument specifies which double click event | |
149 | was generated (1, 2 or 3 for left, middle and right buttons respectively). | |
150 | ||
151 | \membersection{wxMouseEvent::ButtonDown} | |
152 | ||
153 | \func{bool}{ButtonDown}{\param{int}{ but = -1}} | |
154 | ||
155 | If the argument is omitted, this returns TRUE if the event was a mouse | |
156 | button down event. Otherwise the argument specifies which button-down event | |
157 | was generated (1, 2 or 3 for left, middle and right buttons respectively). | |
158 | ||
159 | \membersection{wxMouseEvent::ButtonUp} | |
160 | ||
161 | \func{bool}{ButtonUp}{\param{int}{ but = -1}} | |
162 | ||
163 | If the argument is omitted, this returns TRUE if the event was a mouse | |
164 | button up event. Otherwise the argument specifies which button-up event | |
165 | was generated (1, 2 or 3 for left, middle and right buttons respectively). | |
166 | ||
167 | \membersection{wxMouseEvent::ControlDown} | |
168 | ||
169 | \func{bool}{ControlDown}{\void} | |
170 | ||
171 | Returns TRUE if the control key was down at the time of the event. | |
172 | ||
173 | \membersection{wxMouseEvent::Dragging} | |
174 | ||
175 | \func{bool}{Dragging}{\void} | |
176 | ||
177 | Returns TRUE if this was a dragging event (motion while a button is depressed). | |
178 | ||
179 | \membersection{wxMouseEvent::Entering}\label{wxmouseevententering} | |
180 | ||
181 | \func{bool}{Entering}{\void} | |
182 | ||
ff835f50 | 183 | Returns TRUE if the mouse was entering the window. |
a660d684 KB |
184 | |
185 | See also \helpref{wxMouseEvent::Leaving}{wxmouseeventleaving}. | |
186 | ||
803ef874 JS |
187 | \membersection{wxMouseEvent::GetPosition}\label{wxmouseeventgetposition} |
188 | ||
189 | \constfunc{wxPoint}{GetPosition}{\void} | |
190 | ||
fa482912 JS |
191 | \constfunc{void}{GetPosition}{\param{wxCoord*}{ x}, \param{wxCoord*}{ y}} |
192 | ||
193 | \constfunc{void}{GetPosition}{\param{long*}{ x}, \param{long*}{ y}} | |
803ef874 JS |
194 | |
195 | Sets *x and *y to the position at which the event occurred. | |
196 | ||
197 | Returns the physical mouse position in pixels. | |
198 | ||
199 | \membersection{wxMouseEvent::GetLogicalPosition}\label{wxmouseeventgetlogicalposition} | |
200 | ||
201 | \constfunc{wxPoint}{GetLogicalPosition}{\param{const wxDC\&}{ dc}} | |
202 | ||
203 | Returns the logical mouse position in pixels (i.e. translated according to the | |
204 | translation set for the DC, which usually indicates that the window has been scrolled). | |
205 | ||
a660d684 KB |
206 | \membersection{wxMouseEvent::GetX}\label{wxmouseeventgetx} |
207 | ||
803ef874 | 208 | \constfunc{long}{GetX}{\void} |
a660d684 | 209 | |
803ef874 | 210 | Returns X coordinate of the physical mouse event position. |
a660d684 KB |
211 | |
212 | \membersection{wxMouseEvent::GetY}\label{wxmouseeventgety} | |
213 | ||
803ef874 | 214 | \func{long}{GetY}{\void} |
a660d684 | 215 | |
803ef874 | 216 | Returns Y coordinate of the physical mouse event position. |
a660d684 KB |
217 | |
218 | \membersection{wxMouseEvent::IsButton} | |
219 | ||
803ef874 | 220 | \constfunc{bool}{IsButton}{\void} |
a660d684 KB |
221 | |
222 | Returns TRUE if the event was a mouse button event (not necessarily a button down event - | |
223 | that may be tested using {\it ButtonDown}). | |
224 | ||
225 | \membersection{wxMouseEvent::Leaving}\label{wxmouseeventleaving} | |
226 | ||
803ef874 | 227 | \constfunc{bool}{Leaving}{\void} |
a660d684 | 228 | |
ff835f50 | 229 | Returns TRUE if the mouse was leaving the window. |
a660d684 KB |
230 | |
231 | See also \helpref{wxMouseEvent::Entering}{wxmouseevententering}. | |
232 | ||
233 | \membersection{wxMouseEvent::LeftDClick} | |
234 | ||
803ef874 | 235 | \constfunc{bool}{LeftDClick}{\void} |
a660d684 KB |
236 | |
237 | Returns TRUE if the event was a left double click. | |
238 | ||
2cdd0d01 | 239 | \membersection{wxMouseEvent::LeftDown}\label{wxmouseeventleftdown} |
a660d684 | 240 | |
803ef874 | 241 | \constfunc{bool}{LeftDown}{\void} |
a660d684 KB |
242 | |
243 | Returns TRUE if the left mouse button changed to down. | |
244 | ||
245 | \membersection{wxMouseEvent::LeftIsDown} | |
246 | ||
803ef874 | 247 | \constfunc{bool}{LeftIsDown}{\void} |
a660d684 KB |
248 | |
249 | Returns TRUE if the left mouse button is currently down, independent | |
250 | of the current event type. | |
251 | ||
2cdd0d01 VZ |
252 | Please notice that it is {\bf not} the same as |
253 | \helpref{LeftDown}{wxmouseeventleftdown} which returns TRUE if the left mouse | |
254 | button was just pressed. Rather, it describes the state of the mouse button | |
255 | before the event happened. | |
256 | ||
257 | This event is usually used in the mouse event handlers which process "move | |
258 | mouse" messages to determine whether the user is (still) dragging the mouse. | |
259 | ||
a660d684 KB |
260 | \membersection{wxMouseEvent::LeftUp} |
261 | ||
803ef874 | 262 | \constfunc{bool}{LeftUp}{\void} |
a660d684 KB |
263 | |
264 | Returns TRUE if the left mouse button changed to up. | |
265 | ||
266 | \membersection{wxMouseEvent::MetaDown} | |
267 | ||
803ef874 | 268 | \constfunc{bool}{MetaDown}{\void} |
a660d684 KB |
269 | |
270 | Returns TRUE if the Meta key was down at the time of the event. | |
271 | ||
272 | \membersection{wxMouseEvent::MiddleDClick} | |
273 | ||
803ef874 | 274 | \constfunc{bool}{MiddleDClick}{\void} |
a660d684 KB |
275 | |
276 | Returns TRUE if the event was a middle double click. | |
277 | ||
278 | \membersection{wxMouseEvent::MiddleDown} | |
279 | ||
803ef874 | 280 | \constfunc{bool}{MiddleDown}{\void} |
a660d684 KB |
281 | |
282 | Returns TRUE if the middle mouse button changed to down. | |
283 | ||
284 | \membersection{wxMouseEvent::MiddleIsDown} | |
285 | ||
803ef874 | 286 | \constfunc{bool}{MiddleIsDown}{\void} |
a660d684 KB |
287 | |
288 | Returns TRUE if the middle mouse button is currently down, independent | |
289 | of the current event type. | |
290 | ||
291 | \membersection{wxMouseEvent::MiddleUp} | |
292 | ||
803ef874 | 293 | \constfunc{bool}{MiddleUp}{\void} |
a660d684 KB |
294 | |
295 | Returns TRUE if the middle mouse button changed to up. | |
296 | ||
297 | \membersection{wxMouseEvent::Moving} | |
298 | ||
803ef874 | 299 | \constfunc{bool}{Moving}{\void} |
a660d684 KB |
300 | |
301 | Returns TRUE if this was a motion event (no buttons depressed). | |
302 | ||
a660d684 KB |
303 | \membersection{wxMouseEvent::RightDClick} |
304 | ||
803ef874 | 305 | \constfunc{bool}{RightDClick}{\void} |
a660d684 KB |
306 | |
307 | Returns TRUE if the event was a right double click. | |
308 | ||
309 | \membersection{wxMouseEvent::RightDown} | |
310 | ||
803ef874 | 311 | \constfunc{bool}{RightDown}{\void} |
a660d684 KB |
312 | |
313 | Returns TRUE if the right mouse button changed to down. | |
314 | ||
315 | \membersection{wxMouseEvent::RightIsDown} | |
316 | ||
803ef874 | 317 | \constfunc{bool}{RightIsDown}{\void} |
a660d684 KB |
318 | |
319 | Returns TRUE if the right mouse button is currently down, independent | |
320 | of the current event type. | |
321 | ||
322 | \membersection{wxMouseEvent::RightUp} | |
323 | ||
803ef874 | 324 | \constfunc{bool}{RightUp}{\void} |
a660d684 KB |
325 | |
326 | Returns TRUE if the right mouse button changed to up. | |
327 | ||
a660d684 KB |
328 | \membersection{wxMouseEvent::ShiftDown} |
329 | ||
803ef874 | 330 | \constfunc{bool}{ShiftDown}{\void} |
a660d684 KB |
331 | |
332 | Returns TRUE if the shift key was down at the time of the event. | |
333 |