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