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