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 \wxheading{Derived from
}
14 \helpref{wxEvent
}{wxevent
}
16 \wxheading{Include files
}
20 \wxheading{Event table macros
}
22 To process a mouse event, use these event handler macros to direct input to member
23 functions that take a wxMouseEvent argument.
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.
}
39 \twocolitem{{\bf EVT
\_MOUSE\_EVENTS(func)
}}{Process all mouse events.
}
42 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxMouseEvent::m
\_altDown}
46 \member{bool
}{m
\_altDown}
48 TRUE if the Alt key is pressed down.
50 \membersection{wxMouseEvent::m
\_controlDown}
52 \member{bool
}{m
\_controlDown}
54 TRUE if control key is pressed down.
56 \membersection{wxMouseEvent::m
\_leftDown}
58 \member{bool
}{m
\_leftDown}
60 TRUE if the left mouse button is currently pressed down.
62 \membersection{wxMouseEvent::m
\_middleDown}
64 \member{bool
}{m
\_middleDown}
66 TRUE if the middle mouse button is currently pressed down.
68 \membersection{wxMouseEvent::m
\_rightDown}
70 \member{bool
}{m
\_rightDown}
72 TRUE if the right mouse button is currently pressed down.
74 \membersection{wxMouseEvent::m
\_leftDown}
76 \member{bool
}{m
\_leftDown}
78 TRUE if the left mouse button is currently pressed down.
80 \membersection{wxMouseEvent::m
\_metaDown}
82 \member{bool
}{m
\_metaDown}
84 TRUE if the Meta key is pressed down.
86 \membersection{wxMouseEvent::m
\_shiftDown}
88 \member{bool
}{m
\_shiftDown}
90 TRUE if shift is pressed down.
92 \membersection{wxMouseEvent::m
\_x}
96 X-coordinate of the event.
98 \membersection{wxMouseEvent::m
\_y}
102 Y-coordinate of the event.
104 \membersection{wxMouseEvent::wxMouseEvent
}
106 \func{}{wxMouseEvent
}{\param{WXTYPE
}{ mouseEventType =
0},
\param{int
}{ id =
0}}
108 Constructor. Valid event types are:
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}
126 \membersection{wxMouseEvent::AltDown
}
128 \func{bool
}{AltDown
}{\void}
130 Returns TRUE if the Alt key was down at the time of the event.
132 \membersection{wxMouseEvent::Button
}
134 \func{bool
}{Button
}{\param{int
}{ button
}}
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.
140 Not all mice have middle buttons so a portable application should avoid
143 \membersection{wxMouseEvent::ButtonDClick
}\label{buttondclick
}
145 \func{bool
}{ButtonDClick
}{\param{int
}{ but = -
1}}
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).
151 \membersection{wxMouseEvent::ButtonDown
}
153 \func{bool
}{ButtonDown
}{\param{int
}{ but = -
1}}
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).
159 \membersection{wxMouseEvent::ButtonUp
}
161 \func{bool
}{ButtonUp
}{\param{int
}{ but = -
1}}
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).
167 \membersection{wxMouseEvent::ControlDown
}
169 \func{bool
}{ControlDown
}{\void}
171 Returns TRUE if the control key was down at the time of the event.
173 \membersection{wxMouseEvent::Dragging
}
175 \func{bool
}{Dragging
}{\void}
177 Returns TRUE if this was a dragging event (motion while a button is depressed).
179 \membersection{wxMouseEvent::Entering
}\label{wxmouseevententering
}
181 \func{bool
}{Entering
}{\void}
183 Returns TRUE if the mouse was entering the window.
185 See also
\helpref{wxMouseEvent::Leaving
}{wxmouseeventleaving
}.
187 \membersection{wxMouseEvent::GetPosition
}\label{wxmouseeventgetposition
}
189 \constfunc{wxPoint
}{GetPosition
}{\void}
191 \constfunc{void
}{GetPosition
}{\param{long *
}{x
},
\param{long *
}{y
}}
193 Sets *x and *y to the position at which the event occurred.
195 Returns the physical mouse position in pixels.
197 \membersection{wxMouseEvent::GetLogicalPosition
}\label{wxmouseeventgetlogicalposition
}
199 \constfunc{wxPoint
}{GetLogicalPosition
}{\param{const wxDC\&
}{ dc
}}
201 Returns the logical mouse position in pixels (i.e. translated according to the
202 translation set for the DC, which usually indicates that the window has been scrolled).
204 \membersection{wxMouseEvent::GetX
}\label{wxmouseeventgetx
}
206 \constfunc{long
}{GetX
}{\void}
208 Returns X coordinate of the physical mouse event position.
210 \membersection{wxMouseEvent::GetY
}\label{wxmouseeventgety
}
212 \func{long
}{GetY
}{\void}
214 Returns Y coordinate of the physical mouse event position.
216 \membersection{wxMouseEvent::IsButton
}
218 \constfunc{bool
}{IsButton
}{\void}
220 Returns TRUE if the event was a mouse button event (not necessarily a button down event -
221 that may be tested using
{\it ButtonDown
}).
223 \membersection{wxMouseEvent::Leaving
}\label{wxmouseeventleaving
}
225 \constfunc{bool
}{Leaving
}{\void}
227 Returns TRUE if the mouse was leaving the window.
229 See also
\helpref{wxMouseEvent::Entering
}{wxmouseevententering
}.
231 \membersection{wxMouseEvent::LeftDClick
}
233 \constfunc{bool
}{LeftDClick
}{\void}
235 Returns TRUE if the event was a left double click.
237 \membersection{wxMouseEvent::LeftDown
}\label{wxmouseeventleftdown
}
239 \constfunc{bool
}{LeftDown
}{\void}
241 Returns TRUE if the left mouse button changed to down.
243 \membersection{wxMouseEvent::LeftIsDown
}
245 \constfunc{bool
}{LeftIsDown
}{\void}
247 Returns TRUE if the left mouse button is currently down, independent
248 of the current event type.
250 Please notice that it is
{\bf not
} the same as
251 \helpref{LeftDown
}{wxmouseeventleftdown
} which returns TRUE if the left mouse
252 button was just pressed. Rather, it describes the state of the mouse button
253 before the event happened.
255 This event is usually used in the mouse event handlers which process "move
256 mouse" messages to determine whether the user is (still) dragging the mouse.
258 \membersection{wxMouseEvent::LeftUp
}
260 \constfunc{bool
}{LeftUp
}{\void}
262 Returns TRUE if the left mouse button changed to up.
264 \membersection{wxMouseEvent::MetaDown
}
266 \constfunc{bool
}{MetaDown
}{\void}
268 Returns TRUE if the Meta key was down at the time of the event.
270 \membersection{wxMouseEvent::MiddleDClick
}
272 \constfunc{bool
}{MiddleDClick
}{\void}
274 Returns TRUE if the event was a middle double click.
276 \membersection{wxMouseEvent::MiddleDown
}
278 \constfunc{bool
}{MiddleDown
}{\void}
280 Returns TRUE if the middle mouse button changed to down.
282 \membersection{wxMouseEvent::MiddleIsDown
}
284 \constfunc{bool
}{MiddleIsDown
}{\void}
286 Returns TRUE if the middle mouse button is currently down, independent
287 of the current event type.
289 \membersection{wxMouseEvent::MiddleUp
}
291 \constfunc{bool
}{MiddleUp
}{\void}
293 Returns TRUE if the middle mouse button changed to up.
295 \membersection{wxMouseEvent::Moving
}
297 \constfunc{bool
}{Moving
}{\void}
299 Returns TRUE if this was a motion event (no buttons depressed).
301 \membersection{wxMouseEvent::RightDClick
}
303 \constfunc{bool
}{RightDClick
}{\void}
305 Returns TRUE if the event was a right double click.
307 \membersection{wxMouseEvent::RightDown
}
309 \constfunc{bool
}{RightDown
}{\void}
311 Returns TRUE if the right mouse button changed to down.
313 \membersection{wxMouseEvent::RightIsDown
}
315 \constfunc{bool
}{RightIsDown
}{\void}
317 Returns TRUE if the right mouse button is currently down, independent
318 of the current event type.
320 \membersection{wxMouseEvent::RightUp
}
322 \constfunc{bool
}{RightUp
}{\void}
324 Returns TRUE if the right mouse button changed to up.
326 \membersection{wxMouseEvent::ShiftDown
}
328 \constfunc{bool
}{ShiftDown
}{\void}
330 Returns TRUE if the shift key was down at the time of the event.