]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: event.h | |
e54c96f1 | 3 | // Purpose: interface of wxKeyEvent |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxKeyEvent | |
11 | @wxheader{event.h} | |
7c913512 | 12 | |
23324ae1 | 13 | This event class contains information about keypress (character) events. |
7c913512 | 14 | |
23324ae1 FM |
15 | Notice that there are three different kinds of keyboard events in wxWidgets: |
16 | key down and up events and char events. The difference between the first two | |
17 | is clear - the first corresponds to a key press and the second to a key | |
18 | release - otherwise they are identical. Just note that if the key is | |
19 | maintained in a pressed state you will typically get a lot of (automatically | |
20 | generated) down events but only one up so it is wrong to assume that there is | |
21 | one up event corresponding to each down one. | |
7c913512 | 22 | |
23324ae1 FM |
23 | Both key events provide untranslated key codes while the char event carries |
24 | the translated one. The untranslated code for alphanumeric keys is always | |
25 | an upper case value. For the other keys it is one of @c WXK_XXX values | |
26 | from the @ref overview_keycodes "keycodes table". The translated key is, in | |
27 | general, the character the user expects to appear as the result of the key | |
28 | combination when typing the text into a text entry zone, for example. | |
7c913512 | 29 | |
23324ae1 FM |
30 | A few examples to clarify this (all assume that CAPS LOCK is unpressed |
31 | and the standard US keyboard): when the @c 'A' key is pressed, the key down | |
32 | event key code is equal to @c ASCII A == 65. But the char event key code | |
33 | is @c ASCII a == 97. On the other hand, if you press both SHIFT and | |
34 | @c 'A' keys simultaneously , the key code in key down event will still be | |
35 | just @c 'A' while the char event key code parameter will now be @c 'A' | |
36 | as well. | |
7c913512 | 37 | |
23324ae1 FM |
38 | Although in this simple case it is clear that the correct key code could be |
39 | found in the key down event handler by checking the value returned by | |
40 | wxKeyEvent::ShiftDown, in general you should use | |
41 | @c EVT_CHAR for this as for non-alphanumeric keys the translation is | |
42 | keyboard-layout dependent and can only be done properly by the system itself. | |
7c913512 | 43 | |
23324ae1 FM |
44 | Another kind of translation is done when the control key is pressed: for |
45 | example, for CTRL-A key press the key down event still carries the | |
46 | same key code @c 'a' as usual but the char event will have key code of | |
47 | 1, the ASCII value of this key combination. | |
7c913512 | 48 | |
23324ae1 | 49 | You may discover how the other keys on your system behave interactively by |
e54c96f1 | 50 | running the text() wxWidgets sample and pressing some keys |
23324ae1 | 51 | in any of the text controls shown in it. |
7c913512 | 52 | |
23324ae1 FM |
53 | @b Note: If a key down (@c EVT_KEY_DOWN) event is caught and |
54 | the event handler does not call @c event.Skip() then the corresponding | |
55 | char event (@c EVT_CHAR) will not happen. This is by design and | |
56 | enables the programs that handle both types of events to be a bit | |
57 | simpler. | |
7c913512 | 58 | |
23324ae1 FM |
59 | @b Note for Windows programmers: The key and char events in wxWidgets are |
60 | similar to but slightly different from Windows @c WM_KEYDOWN and | |
61 | @c WM_CHAR events. In particular, Alt-x combination will generate a char | |
62 | event in wxWidgets (unless it is used as an accelerator). | |
7c913512 | 63 | |
23324ae1 FM |
64 | @b Tip: be sure to call @c event.Skip() for events that you don't process in |
65 | key event function, otherwise menu shortcuts may cease to work under Windows. | |
7c913512 | 66 | |
23324ae1 FM |
67 | @library{wxcore} |
68 | @category{events} | |
69 | */ | |
70 | class wxKeyEvent : public wxEvent | |
71 | { | |
72 | public: | |
73 | /** | |
74 | Constructor. Currently, the only valid event types are wxEVT_CHAR and | |
75 | wxEVT_CHAR_HOOK. | |
76 | */ | |
1d497b99 | 77 | wxKeyEvent(wxEventType keyEventType); |
23324ae1 FM |
78 | |
79 | /** | |
80 | Returns @true if the Alt key was down at the time of the key event. | |
23324ae1 FM |
81 | Notice that GetModifiers() is easier to use |
82 | correctly than this function so you should consider using it in new code. | |
83 | */ | |
328f5751 | 84 | bool AltDown() const; |
23324ae1 FM |
85 | |
86 | /** | |
87 | CMD is a pseudo key which is the same as Control for PC and Unix | |
88 | platforms but the special APPLE (a.k.a as COMMAND) key under | |
89 | Macs: it makes often sense to use it instead of, say, ControlDown() because Cmd | |
90 | key is used for the same thing under Mac as Ctrl elsewhere (but Ctrl still | |
91 | exists, just not used for this purpose under Mac). So for non-Mac platforms | |
92 | this is the same as ControlDown() and under | |
93 | Mac this is the same as MetaDown(). | |
94 | */ | |
328f5751 | 95 | bool CmdDown() const; |
23324ae1 FM |
96 | |
97 | /** | |
98 | Returns @true if the control key was down at the time of the key event. | |
23324ae1 FM |
99 | Notice that GetModifiers() is easier to use |
100 | correctly than this function so you should consider using it in new code. | |
101 | */ | |
328f5751 | 102 | bool ControlDown() const; |
23324ae1 FM |
103 | |
104 | /** | |
105 | Returns the virtual key code. ASCII events return normal ASCII values, | |
106 | while non-ASCII events return values such as @b WXK_LEFT for the | |
e54c96f1 | 107 | left cursor key. See Keycodes() for a full list of |
23324ae1 | 108 | the virtual key codes. |
23324ae1 FM |
109 | Note that in Unicode build, the returned value is meaningful only if the |
110 | user entered a character that can be represented in current locale's default | |
111 | charset. You can obtain the corresponding Unicode character using | |
112 | GetUnicodeKey(). | |
113 | */ | |
328f5751 | 114 | int GetKeyCode() const; |
23324ae1 FM |
115 | |
116 | /** | |
117 | Return the bitmask of modifier keys which were pressed when this event | |
118 | happened. See @ref overview_keymodifiers "key modifier constants" for the full | |
119 | list | |
120 | of modifiers. | |
7c913512 | 121 | Notice that this function is easier to use correctly than, for example, |
23324ae1 FM |
122 | ControlDown() because when using the latter you |
123 | also have to remember to test that none of the other modifiers is pressed: | |
3c4f71cc | 124 | |
23324ae1 FM |
125 | and forgetting to do it can result in serious program bugs (e.g. program not |
126 | working with European keyboard layout where ALTGR key which is seen by | |
127 | the program as combination of CTRL and ALT is used). On the | |
128 | other hand, you can simply write | |
3c4f71cc | 129 | |
23324ae1 FM |
130 | with this function. |
131 | */ | |
328f5751 | 132 | int GetModifiers() const; |
23324ae1 FM |
133 | |
134 | //@{ | |
135 | /** | |
136 | Obtains the position (in client coordinates) at which the key was pressed. | |
137 | */ | |
328f5751 FM |
138 | wxPoint GetPosition() const; |
139 | const void GetPosition(long* x, long* y) const; | |
23324ae1 FM |
140 | //@} |
141 | ||
142 | /** | |
143 | Returns the raw key code for this event. This is a platform-dependent scan code | |
144 | which should only be used in advanced applications. | |
23324ae1 FM |
145 | @b NB: Currently the raw key codes are not supported by all ports, use |
146 | @c #ifdef wxHAS_RAW_KEY_CODES to determine if this feature is available. | |
147 | */ | |
328f5751 | 148 | wxUint32 GetRawKeyCode() const; |
23324ae1 FM |
149 | |
150 | /** | |
151 | Returns the low level key flags for this event. The flags are | |
152 | platform-dependent and should only be used in advanced applications. | |
23324ae1 FM |
153 | @b NB: Currently the raw key flags are not supported by all ports, use |
154 | @c #ifdef wxHAS_RAW_KEY_CODES to determine if this feature is available. | |
155 | */ | |
328f5751 | 156 | wxUint32 GetRawKeyFlags() const; |
23324ae1 FM |
157 | |
158 | /** | |
159 | Returns the Unicode character corresponding to this key event. | |
23324ae1 FM |
160 | This function is only available in Unicode build, i.e. when |
161 | @c wxUSE_UNICODE is 1. | |
162 | */ | |
328f5751 | 163 | wxChar GetUnicodeKey() const; |
23324ae1 FM |
164 | |
165 | /** | |
166 | Returns the X position (in client coordinates) of the event. | |
167 | */ | |
a6052817 | 168 | wxCoord GetX() const; |
23324ae1 FM |
169 | |
170 | /** | |
171 | Returns the Y (in client coordinates) position of the event. | |
172 | */ | |
a6052817 | 173 | wxCoord GetY() const; |
23324ae1 FM |
174 | |
175 | /** | |
176 | Returns @true if either CTRL or ALT keys was down | |
177 | at the time of the key event. Note that this function does not take into | |
178 | account neither SHIFT nor META key states (the reason for ignoring | |
179 | the latter is that it is common for NUMLOCK key to be configured as | |
180 | META under X but the key presses even while NUMLOCK is on should | |
181 | be still processed normally). | |
182 | */ | |
328f5751 | 183 | bool HasModifiers() const; |
23324ae1 FM |
184 | |
185 | /** | |
186 | Returns @true if the Meta key was down at the time of the key event. | |
23324ae1 FM |
187 | Notice that GetModifiers() is easier to use |
188 | correctly than this function so you should consider using it in new code. | |
189 | */ | |
328f5751 | 190 | bool MetaDown() const; |
23324ae1 FM |
191 | |
192 | /** | |
193 | Returns @true if the shift key was down at the time of the key event. | |
23324ae1 FM |
194 | Notice that GetModifiers() is easier to use |
195 | correctly than this function so you should consider using it in new code. | |
196 | */ | |
328f5751 | 197 | bool ShiftDown() const; |
23324ae1 FM |
198 | |
199 | /** | |
200 | bool m_altDown | |
23324ae1 FM |
201 | @b Deprecated: Please use GetModifiers() |
202 | instead! | |
23324ae1 FM |
203 | @true if the Alt key is pressed down. |
204 | */ | |
205 | ||
206 | ||
207 | /** | |
208 | bool m_controlDown | |
23324ae1 FM |
209 | @b Deprecated: Please use GetModifiers() |
210 | instead! | |
23324ae1 FM |
211 | @true if control is pressed down. |
212 | */ | |
213 | ||
214 | ||
215 | /** | |
216 | long m_keyCode | |
23324ae1 FM |
217 | @b Deprecated: Please use GetKeyCode() |
218 | instead! | |
e54c96f1 | 219 | Virtual keycode. See Keycodes() for a list of identifiers. |
23324ae1 FM |
220 | */ |
221 | ||
222 | ||
223 | /** | |
224 | bool m_metaDown | |
23324ae1 FM |
225 | @b Deprecated: Please use GetModifiers() |
226 | instead! | |
23324ae1 FM |
227 | @true if the Meta key is pressed down. |
228 | */ | |
229 | ||
230 | ||
231 | /** | |
232 | bool m_shiftDown | |
23324ae1 FM |
233 | @b Deprecated: Please use GetModifiers() |
234 | instead! | |
23324ae1 FM |
235 | @true if shift is pressed down. |
236 | */ | |
237 | ||
238 | ||
239 | /** | |
240 | int m_x | |
23324ae1 | 241 | @b Deprecated: Please use GetX() instead! |
23324ae1 FM |
242 | X position of the event. |
243 | */ | |
244 | ||
245 | ||
246 | /** | |
247 | int m_y | |
23324ae1 | 248 | @b Deprecated: Please use GetY() instead! |
23324ae1 FM |
249 | Y position of the event. |
250 | */ | |
251 | }; | |
252 | ||
253 | ||
e54c96f1 | 254 | |
23324ae1 FM |
255 | /** |
256 | @class wxJoystickEvent | |
257 | @wxheader{event.h} | |
7c913512 | 258 | |
23324ae1 FM |
259 | This event class contains information about mouse events, particularly |
260 | events received by windows. | |
7c913512 | 261 | |
23324ae1 FM |
262 | @library{wxcore} |
263 | @category{events} | |
7c913512 | 264 | |
e54c96f1 | 265 | @see wxJoystick |
23324ae1 FM |
266 | */ |
267 | class wxJoystickEvent : public wxEvent | |
268 | { | |
269 | public: | |
270 | /** | |
271 | Constructor. | |
272 | */ | |
1d497b99 | 273 | wxJoystickEvent(wxEventType eventType = 0, int state = 0, |
23324ae1 FM |
274 | int joystick = wxJOYSTICK1, |
275 | int change = 0); | |
276 | ||
277 | /** | |
278 | Returns @true if the event was a down event from the specified button (or any | |
279 | button). | |
3c4f71cc | 280 | |
7c913512 | 281 | @param button |
4cc4bfaf FM |
282 | Can be wxJOY_BUTTONn where n is 1, 2, 3 or 4; or wxJOY_BUTTON_ANY to |
283 | indicate any button down event. | |
23324ae1 | 284 | */ |
328f5751 | 285 | bool ButtonDown(int button = wxJOY_BUTTON_ANY) const; |
23324ae1 FM |
286 | |
287 | /** | |
288 | Returns @true if the specified button (or any button) was in a down state. | |
3c4f71cc | 289 | |
7c913512 | 290 | @param button |
4cc4bfaf FM |
291 | Can be wxJOY_BUTTONn where n is 1, 2, 3 or 4; or wxJOY_BUTTON_ANY to |
292 | indicate any button down event. | |
23324ae1 | 293 | */ |
328f5751 | 294 | bool ButtonIsDown(int button = wxJOY_BUTTON_ANY) const; |
23324ae1 FM |
295 | |
296 | /** | |
297 | Returns @true if the event was an up event from the specified button (or any | |
298 | button). | |
3c4f71cc | 299 | |
7c913512 | 300 | @param button |
4cc4bfaf FM |
301 | Can be wxJOY_BUTTONn where n is 1, 2, 3 or 4; or wxJOY_BUTTON_ANY to |
302 | indicate any button down event. | |
23324ae1 | 303 | */ |
328f5751 | 304 | bool ButtonUp(int button = wxJOY_BUTTON_ANY) const; |
23324ae1 FM |
305 | |
306 | /** | |
307 | Returns the identifier of the button changing state. This is a wxJOY_BUTTONn | |
308 | identifier, where | |
309 | n is one of 1, 2, 3, 4. | |
310 | */ | |
328f5751 | 311 | int GetButtonChange() const; |
23324ae1 FM |
312 | |
313 | /** | |
314 | Returns the down state of the buttons. This is a bitlist of wxJOY_BUTTONn | |
315 | identifiers, where | |
316 | n is one of 1, 2, 3, 4. | |
317 | */ | |
328f5751 | 318 | int GetButtonState() const; |
23324ae1 FM |
319 | |
320 | /** | |
321 | Returns the identifier of the joystick generating the event - one of | |
322 | wxJOYSTICK1 and wxJOYSTICK2. | |
323 | */ | |
328f5751 | 324 | int GetJoystick() const; |
23324ae1 FM |
325 | |
326 | /** | |
327 | Returns the x, y position of the joystick event. | |
328 | */ | |
328f5751 | 329 | wxPoint GetPosition() const; |
23324ae1 FM |
330 | |
331 | /** | |
332 | Returns the z position of the joystick event. | |
333 | */ | |
328f5751 | 334 | int GetZPosition() const; |
23324ae1 FM |
335 | |
336 | /** | |
337 | Returns @true if this was a button up or down event (@e not 'is any button | |
338 | down?'). | |
339 | */ | |
328f5751 | 340 | bool IsButton() const; |
23324ae1 FM |
341 | |
342 | /** | |
343 | Returns @true if this was an x, y move event. | |
344 | */ | |
328f5751 | 345 | bool IsMove() const; |
23324ae1 FM |
346 | |
347 | /** | |
348 | Returns @true if this was a z move event. | |
349 | */ | |
328f5751 | 350 | bool IsZMove() const; |
23324ae1 FM |
351 | }; |
352 | ||
353 | ||
e54c96f1 | 354 | |
23324ae1 FM |
355 | /** |
356 | @class wxScrollWinEvent | |
357 | @wxheader{event.h} | |
7c913512 | 358 | |
23324ae1 | 359 | A scroll event holds information about events sent from scrolling windows. |
7c913512 | 360 | |
23324ae1 FM |
361 | @library{wxcore} |
362 | @category{events} | |
7c913512 | 363 | |
e54c96f1 | 364 | @see wxScrollEvent, @ref overview_eventhandlingoverview |
23324ae1 FM |
365 | */ |
366 | class wxScrollWinEvent : public wxEvent | |
367 | { | |
368 | public: | |
369 | /** | |
370 | Constructor. | |
371 | */ | |
1d497b99 | 372 | wxScrollWinEvent(wxEventType commandType = 0, int pos = 0, |
23324ae1 FM |
373 | int orientation = 0); |
374 | ||
375 | /** | |
376 | Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the | |
377 | scrollbar. | |
378 | */ | |
328f5751 | 379 | int GetOrientation() const; |
23324ae1 FM |
380 | |
381 | /** | |
382 | Returns the position of the scrollbar for the thumb track and release events. | |
383 | Note that this field can't be used for the other events, you need to query | |
384 | the window itself for the current position in that case. | |
385 | */ | |
328f5751 | 386 | int GetPosition() const; |
23324ae1 FM |
387 | }; |
388 | ||
389 | ||
e54c96f1 | 390 | |
23324ae1 FM |
391 | /** |
392 | @class wxSysColourChangedEvent | |
393 | @wxheader{event.h} | |
7c913512 | 394 | |
23324ae1 FM |
395 | This class is used for system colour change events, which are generated |
396 | when the user changes the colour settings using the control panel. | |
397 | This is only appropriate under Windows. | |
7c913512 | 398 | |
23324ae1 FM |
399 | @library{wxcore} |
400 | @category{events} | |
7c913512 | 401 | |
e54c96f1 | 402 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
403 | */ |
404 | class wxSysColourChangedEvent : public wxEvent | |
405 | { | |
406 | public: | |
407 | /** | |
408 | Constructor. | |
409 | */ | |
410 | wxSysColourChangedEvent(); | |
411 | }; | |
412 | ||
413 | ||
e54c96f1 | 414 | |
23324ae1 FM |
415 | /** |
416 | @class wxWindowCreateEvent | |
417 | @wxheader{event.h} | |
7c913512 | 418 | |
23324ae1 FM |
419 | This event is sent just after the actual window associated with a wxWindow |
420 | object | |
421 | has been created. Since it is derived from wxCommandEvent, the event propagates | |
422 | up | |
423 | the window hierarchy. | |
7c913512 | 424 | |
23324ae1 FM |
425 | @library{wxcore} |
426 | @category{events} | |
7c913512 | 427 | |
e54c96f1 | 428 | @see @ref overview_eventhandlingoverview, wxWindowDestroyEvent |
23324ae1 FM |
429 | */ |
430 | class wxWindowCreateEvent : public wxCommandEvent | |
431 | { | |
432 | public: | |
433 | /** | |
434 | Constructor. | |
435 | */ | |
4cc4bfaf | 436 | wxWindowCreateEvent(wxWindow* win = NULL); |
23324ae1 FM |
437 | }; |
438 | ||
439 | ||
e54c96f1 | 440 | |
23324ae1 FM |
441 | /** |
442 | @class wxPaintEvent | |
443 | @wxheader{event.h} | |
7c913512 | 444 | |
23324ae1 | 445 | A paint event is sent when a window's contents needs to be repainted. |
7c913512 | 446 | |
23324ae1 FM |
447 | Please notice that in general it is impossible to change the drawing of a |
448 | standard control (such as wxButton) and so you shouldn't | |
449 | attempt to handle paint events for them as even if it might work on some | |
450 | platforms, this is inherently not portable and won't work everywhere. | |
7c913512 | 451 | |
23324ae1 FM |
452 | @library{wxcore} |
453 | @category{events} | |
7c913512 | 454 | |
e54c96f1 | 455 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
456 | */ |
457 | class wxPaintEvent : public wxEvent | |
458 | { | |
459 | public: | |
460 | /** | |
461 | Constructor. | |
462 | */ | |
463 | wxPaintEvent(int id = 0); | |
464 | }; | |
465 | ||
466 | ||
e54c96f1 | 467 | |
23324ae1 FM |
468 | /** |
469 | @class wxMaximizeEvent | |
470 | @wxheader{event.h} | |
7c913512 | 471 | |
23324ae1 FM |
472 | An event being sent when a top level window is maximized. Notice that it is |
473 | not sent when the window is restored to its original size after it had been | |
474 | maximized, only a normal wxSizeEvent is generated in | |
475 | this case. | |
7c913512 | 476 | |
23324ae1 FM |
477 | @library{wxcore} |
478 | @category{events} | |
7c913512 | 479 | |
e54c96f1 | 480 | @see @ref overview_eventhandlingoverview, wxTopLevelWindow::Maximize, |
4cc4bfaf | 481 | wxTopLevelWindow::IsMaximized |
23324ae1 FM |
482 | */ |
483 | class wxMaximizeEvent : public wxEvent | |
484 | { | |
485 | public: | |
486 | /** | |
487 | Constructor. Only used by wxWidgets internally. | |
488 | */ | |
489 | wxMaximizeEvent(int id = 0); | |
490 | }; | |
491 | ||
492 | ||
e54c96f1 | 493 | |
23324ae1 FM |
494 | /** |
495 | @class wxUpdateUIEvent | |
496 | @wxheader{event.h} | |
7c913512 | 497 | |
23324ae1 FM |
498 | This class is used for pseudo-events which are called by wxWidgets |
499 | to give an application the chance to update various user interface elements. | |
7c913512 | 500 | |
23324ae1 FM |
501 | @library{wxcore} |
502 | @category{events} | |
7c913512 | 503 | |
e54c96f1 | 504 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
505 | */ |
506 | class wxUpdateUIEvent : public wxCommandEvent | |
507 | { | |
508 | public: | |
509 | /** | |
510 | Constructor. | |
511 | */ | |
512 | wxUpdateUIEvent(wxWindowID commandId = 0); | |
513 | ||
514 | /** | |
515 | Returns @true if it is appropriate to update (send UI update events to) | |
516 | this window. | |
23324ae1 FM |
517 | This function looks at the mode used (see wxUpdateUIEvent::SetMode), |
518 | the wxWS_EX_PROCESS_UI_UPDATES flag in @e window, | |
519 | the time update events were last sent in idle time, and | |
520 | the update interval, to determine whether events should be sent to | |
521 | this window now. By default this will always return @true because | |
522 | the update mode is initially wxUPDATE_UI_PROCESS_ALL and | |
523 | the interval is set to 0; so update events will be sent as | |
524 | often as possible. You can reduce the frequency that events | |
525 | are sent by changing the mode and/or setting an update interval. | |
3c4f71cc | 526 | |
4cc4bfaf FM |
527 | @see ResetUpdateTime(), SetUpdateInterval(), |
528 | SetMode() | |
23324ae1 FM |
529 | */ |
530 | static bool CanUpdate(wxWindow* window); | |
531 | ||
532 | /** | |
533 | Check or uncheck the UI element. | |
534 | */ | |
535 | void Check(bool check); | |
536 | ||
537 | /** | |
538 | Enable or disable the UI element. | |
539 | */ | |
540 | void Enable(bool enable); | |
541 | ||
542 | /** | |
543 | Returns @true if the UI element should be checked. | |
544 | */ | |
328f5751 | 545 | bool GetChecked() const; |
23324ae1 FM |
546 | |
547 | /** | |
548 | Returns @true if the UI element should be enabled. | |
549 | */ | |
328f5751 | 550 | bool GetEnabled() const; |
23324ae1 FM |
551 | |
552 | /** | |
553 | Static function returning a value specifying how wxWidgets | |
554 | will send update events: to all windows, or only to those which specify that | |
555 | they | |
556 | will process the events. | |
23324ae1 FM |
557 | See SetMode(). |
558 | */ | |
559 | static wxUpdateUIMode GetMode(); | |
560 | ||
561 | /** | |
562 | Returns @true if the application has called Check(). For wxWidgets internal use | |
563 | only. | |
564 | */ | |
328f5751 | 565 | bool GetSetChecked() const; |
23324ae1 FM |
566 | |
567 | /** | |
568 | Returns @true if the application has called Enable(). For wxWidgets internal use | |
569 | only. | |
570 | */ | |
328f5751 | 571 | bool GetSetEnabled() const; |
23324ae1 FM |
572 | |
573 | /** | |
574 | Returns @true if the application has called Show(). For wxWidgets internal use | |
575 | only. | |
576 | */ | |
328f5751 | 577 | bool GetSetShown() const; |
23324ae1 FM |
578 | |
579 | /** | |
580 | Returns @true if the application has called SetText(). For wxWidgets internal | |
581 | use only. | |
582 | */ | |
328f5751 | 583 | bool GetSetText() const; |
23324ae1 FM |
584 | |
585 | /** | |
586 | Returns @true if the UI element should be shown. | |
587 | */ | |
328f5751 | 588 | bool GetShown() const; |
23324ae1 FM |
589 | |
590 | /** | |
591 | Returns the text that should be set for the UI element. | |
592 | */ | |
328f5751 | 593 | wxString GetText() const; |
23324ae1 FM |
594 | |
595 | /** | |
596 | Returns the current interval between updates in milliseconds. | |
597 | -1 disables updates, 0 updates as frequently as possible. | |
23324ae1 FM |
598 | See SetUpdateInterval(). |
599 | */ | |
600 | static long GetUpdateInterval(); | |
601 | ||
602 | /** | |
603 | Used internally to reset the last-updated time to the | |
604 | current time. It is assumed that update events are | |
605 | normally sent in idle time, so this is called at the end of | |
606 | idle processing. | |
3c4f71cc | 607 | |
4cc4bfaf FM |
608 | @see CanUpdate(), SetUpdateInterval(), |
609 | SetMode() | |
23324ae1 FM |
610 | */ |
611 | static void ResetUpdateTime(); | |
612 | ||
613 | /** | |
614 | Specify how wxWidgets will send update events: to | |
615 | all windows, or only to those which specify that they | |
616 | will process the events. | |
4cc4bfaf | 617 | @a mode may be one of the following values. |
23324ae1 FM |
618 | The default is wxUPDATE_UI_PROCESS_ALL. |
619 | */ | |
620 | static void SetMode(wxUpdateUIMode mode); | |
621 | ||
622 | /** | |
623 | Sets the text for this UI element. | |
624 | */ | |
625 | void SetText(const wxString& text); | |
626 | ||
627 | /** | |
628 | Sets the interval between updates in milliseconds. | |
629 | Set to -1 to disable updates, or to 0 to update as frequently as possible. | |
630 | The default is 0. | |
23324ae1 FM |
631 | Use this to reduce the overhead of UI update events if your application |
632 | has a lot of windows. If you set the value to -1 or greater than 0, | |
7c913512 | 633 | you may also need to call wxWindow::UpdateWindowUI |
23324ae1 FM |
634 | at appropriate points in your application, such as when a dialog |
635 | is about to be shown. | |
636 | */ | |
637 | static void SetUpdateInterval(long updateInterval); | |
638 | ||
639 | /** | |
640 | Show or hide the UI element. | |
641 | */ | |
642 | void Show(bool show); | |
643 | }; | |
644 | ||
645 | ||
e54c96f1 | 646 | |
23324ae1 FM |
647 | /** |
648 | @class wxClipboardTextEvent | |
649 | @wxheader{event.h} | |
7c913512 FM |
650 | |
651 | This class represents the events generated by a control (typically a | |
23324ae1 FM |
652 | wxTextCtrl but other windows can generate these events as |
653 | well) when its content gets copied or cut to, or pasted from the clipboard. | |
654 | There are three types of corresponding events wxEVT_COMMAND_TEXT_COPY, | |
655 | wxEVT_COMMAND_TEXT_CUT and wxEVT_COMMAND_TEXT_PASTE. | |
7c913512 | 656 | |
23324ae1 | 657 | If any of these events is processed (without being skipped) by an event |
3d6c68c1 VS |
658 | handler, the corresponding operation doesn't take place which allows to |
659 | prevent the text from being copied from or pasted to a control. It is also | |
660 | possible to examine the clipboard contents in the PASTE event handler and | |
661 | transform it in some way before inserting in a control -- for example, | |
662 | changing its case or removing invalid characters. | |
7c913512 | 663 | |
23324ae1 | 664 | Finally notice that a CUT event is always preceded by the COPY event which |
3d6c68c1 VS |
665 | makes it possible to only process the latter if it doesn't matter if the |
666 | text was copied or cut. | |
667 | ||
668 | @beginEventTable | |
669 | @event{EVT_TEXT_COPY(id, func)}: | |
670 | Some or all of the controls content was copied to the clipboard. | |
671 | @event{EVT_TEXT_CUT(id, func)}: | |
672 | Some or all of the controls content was cut (i.e. copied and | |
673 | deleted). | |
674 | @event{EVT_TEXT_PASTE(id, func)}: | |
675 | Clipboard content was pasted into the control. | |
676 | @endEventTable | |
677 | ||
678 | @note | |
e2cf30aa VS |
679 | These events are currently only generated by wxTextCtrl under GTK+. They |
680 | are generated by all controls under Windows. | |
7c913512 | 681 | |
23324ae1 FM |
682 | @library{wxcore} |
683 | @category{events} | |
7c913512 | 684 | |
e54c96f1 | 685 | @see wxClipboard |
23324ae1 FM |
686 | */ |
687 | class wxClipboardTextEvent : public wxCommandEvent | |
688 | { | |
689 | public: | |
690 | /** | |
3d6c68c1 | 691 | Constructor. |
23324ae1 | 692 | */ |
3d6c68c1 | 693 | wxClipboardTextEvent(wxEventType commandType = wxEVT_NULL, int id = 0); |
23324ae1 FM |
694 | }; |
695 | ||
696 | ||
e54c96f1 | 697 | |
23324ae1 FM |
698 | /** |
699 | @class wxMouseEvent | |
700 | @wxheader{event.h} | |
7c913512 | 701 | |
23324ae1 FM |
702 | This event class contains information about the events generated by the mouse: |
703 | they include mouse buttons press and release events and mouse move events. | |
7c913512 | 704 | |
23324ae1 FM |
705 | All mouse events involving the buttons use @c wxMOUSE_BTN_LEFT for the |
706 | left mouse button, @c wxMOUSE_BTN_MIDDLE for the middle one and | |
707 | @c wxMOUSE_BTN_RIGHT for the right one. And if the system supports more | |
708 | buttons, the @c wxMOUSE_BTN_AUX1 and @c wxMOUSE_BTN_AUX2 events | |
709 | can also be generated. Note that not all mice have even a middle button so a | |
710 | portable application should avoid relying on the events from it (but the right | |
711 | button click can be emulated using the left mouse button with the control key | |
712 | under Mac platforms with a single button mouse). | |
7c913512 | 713 | |
23324ae1 FM |
714 | For the @c wxEVT_ENTER_WINDOW and @c wxEVT_LEAVE_WINDOW events |
715 | purposes, the mouse is considered to be inside the window if it is in the | |
716 | window client area and not inside one of its children. In other words, the | |
717 | parent window receives @c wxEVT_LEAVE_WINDOW event not only when the | |
718 | mouse leaves the window entirely but also when it enters one of its children. | |
7c913512 | 719 | |
23324ae1 FM |
720 | @b NB: Note that under Windows CE mouse enter and leave events are not natively |
721 | supported | |
722 | by the system but are generated by wxWidgets itself. This has several | |
723 | drawbacks: the LEAVE_WINDOW event might be received some time after the mouse | |
724 | left the window and the state variables for it may have changed during this | |
725 | time. | |
7c913512 | 726 | |
23324ae1 FM |
727 | @b NB: Note the difference between methods like |
728 | wxMouseEvent::LeftDown and | |
729 | wxMouseEvent::LeftIsDown: the former returns @true | |
730 | when the event corresponds to the left mouse button click while the latter | |
731 | returns @true if the left mouse button is currently being pressed. For | |
732 | example, when the user is dragging the mouse you can use | |
733 | wxMouseEvent::LeftIsDown to test | |
734 | whether the left mouse button is (still) depressed. Also, by convention, if | |
735 | wxMouseEvent::LeftDown returns @true, | |
736 | wxMouseEvent::LeftIsDown will also return @true in | |
737 | wxWidgets whatever the underlying GUI behaviour is (which is | |
738 | platform-dependent). The same applies, of course, to other mouse buttons as | |
739 | well. | |
7c913512 | 740 | |
23324ae1 FM |
741 | @library{wxcore} |
742 | @category{events} | |
7c913512 | 743 | |
e54c96f1 | 744 | @see wxKeyEvent::CmdDown |
23324ae1 FM |
745 | */ |
746 | class wxMouseEvent : public wxEvent | |
747 | { | |
748 | public: | |
749 | /** | |
750 | Constructor. Valid event types are: | |
3c4f71cc | 751 | |
23324ae1 FM |
752 | @b wxEVT_ENTER_WINDOW |
753 | @b wxEVT_LEAVE_WINDOW | |
754 | @b wxEVT_LEFT_DOWN | |
755 | @b wxEVT_LEFT_UP | |
756 | @b wxEVT_LEFT_DCLICK | |
757 | @b wxEVT_MIDDLE_DOWN | |
758 | @b wxEVT_MIDDLE_UP | |
759 | @b wxEVT_MIDDLE_DCLICK | |
760 | @b wxEVT_RIGHT_DOWN | |
761 | @b wxEVT_RIGHT_UP | |
762 | @b wxEVT_RIGHT_DCLICK | |
763 | @b wxEVT_MOUSE_AUX1_DOWN | |
764 | @b wxEVT_MOUSE_AUX1_UP | |
765 | @b wxEVT_MOUSE_AUX1_DCLICK | |
766 | @b wxEVT_MOUSE_AUX2_DOWN | |
767 | @b wxEVT_MOUSE_AUX2_UP | |
768 | @b wxEVT_MOUSE_AUX2_DCLICK | |
769 | @b wxEVT_MOTION | |
770 | @b wxEVT_MOUSEWHEEL | |
771 | */ | |
1d497b99 | 772 | wxMouseEvent(wxEventType mouseEventType = 0); |
23324ae1 FM |
773 | |
774 | /** | |
775 | Returns @true if the Alt key was down at the time of the event. | |
776 | */ | |
a6052817 | 777 | bool AltDown() const; |
23324ae1 FM |
778 | |
779 | /** | |
780 | Returns @true if the event was a first extra button double click. | |
781 | */ | |
328f5751 | 782 | bool Aux1DClick() const; |
23324ae1 FM |
783 | |
784 | /** | |
785 | Returns @true if the first extra button mouse button changed to down. | |
786 | */ | |
328f5751 | 787 | bool Aux1Down() const; |
23324ae1 FM |
788 | |
789 | /** | |
790 | Returns @true if the first extra button mouse button is currently down, | |
791 | independent | |
792 | of the current event type. | |
793 | */ | |
328f5751 | 794 | bool Aux1IsDown() const; |
23324ae1 FM |
795 | |
796 | /** | |
797 | Returns @true if the first extra button mouse button changed to up. | |
798 | */ | |
328f5751 | 799 | bool Aux1Up() const; |
23324ae1 FM |
800 | |
801 | /** | |
802 | Returns @true if the event was a second extra button double click. | |
803 | */ | |
328f5751 | 804 | bool Aux2DClick() const; |
23324ae1 FM |
805 | |
806 | /** | |
807 | Returns @true if the second extra button mouse button changed to down. | |
808 | */ | |
328f5751 | 809 | bool Aux2Down() const; |
23324ae1 FM |
810 | |
811 | /** | |
812 | Returns @true if the second extra button mouse button is currently down, | |
813 | independent | |
814 | of the current event type. | |
815 | */ | |
328f5751 | 816 | bool Aux2IsDown() const; |
23324ae1 FM |
817 | |
818 | /** | |
819 | Returns @true if the second extra button mouse button changed to up. | |
820 | */ | |
328f5751 | 821 | bool Aux2Up() const; |
23324ae1 FM |
822 | |
823 | /** | |
824 | Returns @true if the identified mouse button is changing state. Valid | |
4cc4bfaf | 825 | values of @a button are: |
3c4f71cc | 826 | |
23324ae1 | 827 | @c wxMOUSE_BTN_LEFT |
3c4f71cc | 828 | |
23324ae1 | 829 | check if left button was pressed |
3c4f71cc | 830 | |
23324ae1 | 831 | @c wxMOUSE_BTN_MIDDLE |
3c4f71cc | 832 | |
23324ae1 | 833 | check if middle button was pressed |
3c4f71cc | 834 | |
23324ae1 | 835 | @c wxMOUSE_BTN_RIGHT |
3c4f71cc | 836 | |
23324ae1 | 837 | check if right button was pressed |
3c4f71cc | 838 | |
23324ae1 | 839 | @c wxMOUSE_BTN_AUX1 |
3c4f71cc | 840 | |
23324ae1 | 841 | check if the first extra button was pressed |
3c4f71cc | 842 | |
23324ae1 | 843 | @c wxMOUSE_BTN_AUX2 |
3c4f71cc | 844 | |
23324ae1 | 845 | check if the second extra button was pressed |
3c4f71cc | 846 | |
23324ae1 | 847 | @c wxMOUSE_BTN_ANY |
3c4f71cc | 848 | |
23324ae1 FM |
849 | check if any button was pressed |
850 | */ | |
a6052817 | 851 | bool Button(int button) const; |
23324ae1 FM |
852 | |
853 | /** | |
854 | If the argument is omitted, this returns @true if the event was a mouse | |
855 | double click event. Otherwise the argument specifies which double click event | |
856 | was generated (see Button() for the possible | |
857 | values). | |
858 | */ | |
a6052817 | 859 | bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; |
23324ae1 FM |
860 | |
861 | /** | |
862 | If the argument is omitted, this returns @true if the event was a mouse | |
863 | button down event. Otherwise the argument specifies which button-down event | |
864 | was generated (see Button() for the possible | |
865 | values). | |
866 | */ | |
a6052817 | 867 | bool ButtonDown(int = wxMOUSE_BTN_ANY) const; |
23324ae1 FM |
868 | |
869 | /** | |
870 | If the argument is omitted, this returns @true if the event was a mouse | |
871 | button up event. Otherwise the argument specifies which button-up event | |
872 | was generated (see Button() for the possible | |
873 | values). | |
874 | */ | |
a6052817 | 875 | bool ButtonUp(int = wxMOUSE_BTN_ANY) const; |
23324ae1 FM |
876 | |
877 | /** | |
7c913512 | 878 | Same as MetaDown() under Mac, same as |
23324ae1 | 879 | ControlDown() elsewhere. |
3c4f71cc | 880 | |
4cc4bfaf | 881 | @see wxKeyEvent::CmdDown |
23324ae1 | 882 | */ |
328f5751 | 883 | bool CmdDown() const; |
23324ae1 FM |
884 | |
885 | /** | |
886 | Returns @true if the control key was down at the time of the event. | |
887 | */ | |
a6052817 | 888 | bool ControlDown() const; |
23324ae1 FM |
889 | |
890 | /** | |
891 | Returns @true if this was a dragging event (motion while a button is depressed). | |
3c4f71cc | 892 | |
4cc4bfaf | 893 | @see Moving() |
23324ae1 | 894 | */ |
a6052817 | 895 | bool Dragging() const; |
23324ae1 FM |
896 | |
897 | /** | |
898 | Returns @true if the mouse was entering the window. | |
23324ae1 FM |
899 | See also Leaving(). |
900 | */ | |
a6052817 | 901 | bool Entering() const; |
23324ae1 FM |
902 | |
903 | /** | |
7c913512 | 904 | Returns the mouse button which generated this event or @c wxMOUSE_BTN_NONE |
23324ae1 FM |
905 | if no button is involved (for mouse move, enter or leave event, for example). |
906 | Otherwise @c wxMOUSE_BTN_LEFT is returned for the left button down, up and | |
7c913512 | 907 | double click events, @c wxMOUSE_BTN_MIDDLE and @c wxMOUSE_BTN_RIGHT |
23324ae1 FM |
908 | for the same events for the middle and the right buttons respectively. |
909 | */ | |
328f5751 | 910 | int GetButton() const; |
23324ae1 FM |
911 | |
912 | /** | |
913 | Returns the number of mouse clicks for this event: 1 for a simple click, 2 | |
914 | for a double-click, 3 for a triple-click and so on. | |
23324ae1 FM |
915 | Currently this function is implemented only in wxMac and returns -1 for the |
916 | other platforms (you can still distinguish simple clicks from double-clicks as | |
917 | they generate different kinds of events however). | |
3c4f71cc | 918 | |
e54c96f1 | 919 | @wxsince{2.9.0} |
23324ae1 | 920 | */ |
328f5751 | 921 | int GetClickCount() const; |
23324ae1 FM |
922 | |
923 | /** | |
924 | Returns the configured number of lines (or whatever) to be scrolled per | |
925 | wheel action. Defaults to three. | |
926 | */ | |
328f5751 | 927 | int GetLinesPerAction() const; |
23324ae1 FM |
928 | |
929 | /** | |
930 | Returns the logical mouse position in pixels (i.e. translated according to the | |
931 | translation set for the DC, which usually indicates that the window has been | |
932 | scrolled). | |
933 | */ | |
328f5751 | 934 | wxPoint GetLogicalPosition(const wxDC& dc) const; |
23324ae1 FM |
935 | |
936 | //@{ | |
937 | /** | |
938 | Sets *x and *y to the position at which the event occurred. | |
23324ae1 | 939 | Returns the physical mouse position in pixels. |
23324ae1 FM |
940 | Note that if the mouse event has been artificially generated from a special |
941 | keyboard combination (e.g. under Windows when the "menu'' key is pressed), the | |
942 | returned position is @c wxDefaultPosition. | |
943 | */ | |
328f5751 FM |
944 | wxPoint GetPosition() const; |
945 | const void GetPosition(wxCoord* x, wxCoord* y) const; | |
946 | const void GetPosition(long* x, long* y) const; | |
23324ae1 FM |
947 | //@} |
948 | ||
949 | /** | |
950 | Get wheel delta, normally 120. This is the threshold for action to be | |
951 | taken, and one such action (for example, scrolling one increment) | |
952 | should occur for each delta. | |
953 | */ | |
328f5751 | 954 | int GetWheelDelta() const; |
23324ae1 FM |
955 | |
956 | /** | |
957 | Get wheel rotation, positive or negative indicates direction of | |
958 | rotation. Current devices all send an event when rotation is at least | |
959 | +/-WheelDelta, but finer resolution devices can be created in the future. | |
960 | Because of this you shouldn't assume that one event is equal to 1 line, but you | |
961 | should be able to either do partial line scrolling or wait until several | |
962 | events accumulate before scrolling. | |
963 | */ | |
328f5751 | 964 | int GetWheelRotation() const; |
23324ae1 FM |
965 | |
966 | /** | |
967 | Returns X coordinate of the physical mouse event position. | |
968 | */ | |
a6052817 | 969 | wxCoord GetX() const; |
23324ae1 FM |
970 | |
971 | /** | |
972 | Returns Y coordinate of the physical mouse event position. | |
973 | */ | |
a6052817 | 974 | wxCoord GetY() const; |
23324ae1 FM |
975 | |
976 | /** | |
977 | Returns @true if the event was a mouse button event (not necessarily a button | |
978 | down event - | |
979 | that may be tested using @e ButtonDown). | |
980 | */ | |
328f5751 | 981 | bool IsButton() const; |
23324ae1 FM |
982 | |
983 | /** | |
984 | Returns @true if the system has been setup to do page scrolling with | |
985 | the mouse wheel instead of line scrolling. | |
986 | */ | |
328f5751 | 987 | bool IsPageScroll() const; |
23324ae1 FM |
988 | |
989 | /** | |
990 | Returns @true if the mouse was leaving the window. | |
23324ae1 FM |
991 | See also Entering(). |
992 | */ | |
328f5751 | 993 | bool Leaving() const; |
23324ae1 FM |
994 | |
995 | /** | |
996 | Returns @true if the event was a left double click. | |
997 | */ | |
328f5751 | 998 | bool LeftDClick() const; |
23324ae1 FM |
999 | |
1000 | /** | |
1001 | Returns @true if the left mouse button changed to down. | |
1002 | */ | |
328f5751 | 1003 | bool LeftDown() const; |
23324ae1 FM |
1004 | |
1005 | /** | |
1006 | Returns @true if the left mouse button is currently down, independent | |
1007 | of the current event type. | |
7c913512 | 1008 | Please notice that it is not the same as |
23324ae1 FM |
1009 | LeftDown() which returns @true if the event was |
1010 | generated by the left mouse button being pressed. Rather, it simply describes | |
1011 | the state of the left mouse button at the time when the event was generated | |
1012 | (so while it will be @true for a left click event, it can also be @true for | |
1013 | a right click if it happened while the left mouse button was pressed). | |
23324ae1 FM |
1014 | This event is usually used in the mouse event handlers which process "move |
1015 | mouse" messages to determine whether the user is (still) dragging the mouse. | |
1016 | */ | |
328f5751 | 1017 | bool LeftIsDown() const; |
23324ae1 FM |
1018 | |
1019 | /** | |
1020 | Returns @true if the left mouse button changed to up. | |
1021 | */ | |
328f5751 | 1022 | bool LeftUp() const; |
23324ae1 FM |
1023 | |
1024 | /** | |
1025 | Returns @true if the Meta key was down at the time of the event. | |
1026 | */ | |
328f5751 | 1027 | bool MetaDown() const; |
23324ae1 FM |
1028 | |
1029 | /** | |
1030 | Returns @true if the event was a middle double click. | |
1031 | */ | |
328f5751 | 1032 | bool MiddleDClick() const; |
23324ae1 FM |
1033 | |
1034 | /** | |
1035 | Returns @true if the middle mouse button changed to down. | |
1036 | */ | |
328f5751 | 1037 | bool MiddleDown() const; |
23324ae1 FM |
1038 | |
1039 | /** | |
1040 | Returns @true if the middle mouse button is currently down, independent | |
1041 | of the current event type. | |
1042 | */ | |
328f5751 | 1043 | bool MiddleIsDown() const; |
23324ae1 FM |
1044 | |
1045 | /** | |
1046 | Returns @true if the middle mouse button changed to up. | |
1047 | */ | |
328f5751 | 1048 | bool MiddleUp() const; |
23324ae1 FM |
1049 | |
1050 | /** | |
7c913512 FM |
1051 | Returns @true if this was a motion event and no mouse buttons were pressed. |
1052 | If any mouse button is held pressed, then this method returns @false and | |
23324ae1 FM |
1053 | Dragging() returns @true. |
1054 | */ | |
328f5751 | 1055 | bool Moving() const; |
23324ae1 FM |
1056 | |
1057 | /** | |
1058 | Returns @true if the event was a right double click. | |
1059 | */ | |
328f5751 | 1060 | bool RightDClick() const; |
23324ae1 FM |
1061 | |
1062 | /** | |
1063 | Returns @true if the right mouse button changed to down. | |
1064 | */ | |
328f5751 | 1065 | bool RightDown() const; |
23324ae1 FM |
1066 | |
1067 | /** | |
1068 | Returns @true if the right mouse button is currently down, independent | |
1069 | of the current event type. | |
1070 | */ | |
328f5751 | 1071 | bool RightIsDown() const; |
23324ae1 FM |
1072 | |
1073 | /** | |
1074 | Returns @true if the right mouse button changed to up. | |
1075 | */ | |
328f5751 | 1076 | bool RightUp() const; |
23324ae1 FM |
1077 | |
1078 | /** | |
1079 | Returns @true if the shift key was down at the time of the event. | |
1080 | */ | |
328f5751 | 1081 | bool ShiftDown() const; |
23324ae1 FM |
1082 | |
1083 | /** | |
1084 | bool m_altDown | |
23324ae1 FM |
1085 | @true if the Alt key is pressed down. |
1086 | */ | |
1087 | ||
1088 | ||
1089 | /** | |
1090 | bool m_controlDown | |
23324ae1 FM |
1091 | @true if control key is pressed down. |
1092 | */ | |
1093 | ||
1094 | ||
1095 | /** | |
1096 | bool m_leftDown | |
23324ae1 FM |
1097 | @true if the left mouse button is currently pressed down. |
1098 | */ | |
1099 | ||
1100 | ||
1101 | /** | |
1102 | int m_linesPerAction | |
23324ae1 FM |
1103 | The configured number of lines (or whatever) to be scrolled per wheel |
1104 | action. | |
1105 | */ | |
1106 | ||
1107 | ||
1108 | /** | |
1109 | bool m_metaDown | |
23324ae1 FM |
1110 | @true if the Meta key is pressed down. |
1111 | */ | |
1112 | ||
1113 | ||
1114 | /** | |
1115 | bool m_middleDown | |
23324ae1 FM |
1116 | @true if the middle mouse button is currently pressed down. |
1117 | */ | |
1118 | ||
1119 | ||
1120 | /** | |
1121 | bool m_rightDown | |
23324ae1 FM |
1122 | @true if the right mouse button is currently pressed down. |
1123 | */ | |
1124 | ||
1125 | ||
1126 | /** | |
1127 | bool m_shiftDown | |
23324ae1 FM |
1128 | @true if shift is pressed down. |
1129 | */ | |
1130 | ||
1131 | ||
1132 | /** | |
1133 | int m_wheelDelta | |
23324ae1 FM |
1134 | The wheel delta, normally 120. |
1135 | */ | |
1136 | ||
1137 | ||
1138 | /** | |
1139 | int m_wheelRotation | |
23324ae1 FM |
1140 | The distance the mouse wheel is rotated. |
1141 | */ | |
1142 | ||
1143 | ||
1144 | /** | |
1145 | long m_x | |
23324ae1 FM |
1146 | X-coordinate of the event. |
1147 | */ | |
1148 | ||
1149 | ||
1150 | /** | |
1151 | long m_y | |
23324ae1 FM |
1152 | Y-coordinate of the event. |
1153 | */ | |
1154 | }; | |
1155 | ||
1156 | ||
e54c96f1 | 1157 | |
23324ae1 FM |
1158 | /** |
1159 | @class wxDropFilesEvent | |
1160 | @wxheader{event.h} | |
7c913512 | 1161 | |
23324ae1 FM |
1162 | This class is used for drop files events, that is, when files have been dropped |
1163 | onto the window. This functionality is currently only available under Windows. | |
7c913512 | 1164 | The window must have previously been enabled for dropping by calling |
23324ae1 | 1165 | wxWindow::DragAcceptFiles. |
7c913512 | 1166 | |
23324ae1 | 1167 | Important note: this is a separate implementation to the more general |
e54c96f1 | 1168 | drag and drop implementation documented here(). It uses the |
23324ae1 | 1169 | older, Windows message-based approach of dropping files. |
7c913512 | 1170 | |
23324ae1 FM |
1171 | @library{wxcore} |
1172 | @category{events} | |
7c913512 | 1173 | |
e54c96f1 | 1174 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1175 | */ |
1176 | class wxDropFilesEvent : public wxEvent | |
1177 | { | |
1178 | public: | |
1179 | /** | |
1180 | Constructor. | |
1181 | */ | |
1d497b99 | 1182 | wxDropFilesEvent(wxEventType id = 0, int noFiles = 0, |
4cc4bfaf | 1183 | wxString* files = NULL); |
23324ae1 FM |
1184 | |
1185 | /** | |
1186 | Returns an array of filenames. | |
1187 | */ | |
328f5751 | 1188 | wxString* GetFiles() const; |
23324ae1 FM |
1189 | |
1190 | /** | |
1191 | Returns the number of files dropped. | |
1192 | */ | |
328f5751 | 1193 | int GetNumberOfFiles() const; |
23324ae1 FM |
1194 | |
1195 | /** | |
1196 | Returns the position at which the files were dropped. | |
23324ae1 FM |
1197 | Returns an array of filenames. |
1198 | */ | |
328f5751 | 1199 | wxPoint GetPosition() const; |
23324ae1 FM |
1200 | |
1201 | /** | |
1202 | wxString* m_files | |
23324ae1 FM |
1203 | An array of filenames. |
1204 | */ | |
1205 | ||
1206 | ||
1207 | /** | |
1208 | int m_noFiles | |
23324ae1 FM |
1209 | The number of files dropped. |
1210 | */ | |
1211 | ||
1212 | ||
1213 | /** | |
1214 | wxPoint m_pos | |
23324ae1 FM |
1215 | The point at which the drop took place. |
1216 | */ | |
1217 | }; | |
1218 | ||
1219 | ||
e54c96f1 | 1220 | |
23324ae1 FM |
1221 | /** |
1222 | @class wxCommandEvent | |
1223 | @wxheader{event.h} | |
7c913512 | 1224 | |
23324ae1 FM |
1225 | This event class contains information about command events, which originate |
1226 | from a variety of | |
1227 | simple controls. More complex controls, such as wxTreeCtrl, have separate | |
1228 | command event classes. | |
7c913512 | 1229 | |
23324ae1 FM |
1230 | @library{wxcore} |
1231 | @category{events} | |
1232 | */ | |
1233 | class wxCommandEvent : public wxEvent | |
1234 | { | |
1235 | public: | |
1236 | /** | |
1237 | Constructor. | |
1238 | */ | |
1d497b99 | 1239 | wxCommandEvent(wxEventType commandEventType = 0, int id = 0); |
23324ae1 FM |
1240 | |
1241 | /** | |
1242 | Deprecated, use IsChecked() instead. | |
1243 | */ | |
328f5751 | 1244 | bool Checked() const; |
23324ae1 FM |
1245 | |
1246 | /** | |
1247 | Returns client data pointer for a listbox or choice selection event | |
1248 | (not valid for a deselection). | |
1249 | */ | |
a6052817 | 1250 | void* GetClientData() const; |
23324ae1 FM |
1251 | |
1252 | /** | |
1253 | Returns client object pointer for a listbox or choice selection event | |
1254 | (not valid for a deselection). | |
1255 | */ | |
a6052817 | 1256 | wxClientData* GetClientObject() const; |
23324ae1 FM |
1257 | |
1258 | /** | |
1259 | Returns extra information dependant on the event objects type. | |
1260 | If the event comes from a listbox selection, it is a boolean | |
1261 | determining whether the event was a selection (@true) or a | |
1262 | deselection (@false). A listbox deselection only occurs for | |
1263 | multiple-selection boxes, and in this case the index and string values | |
1264 | are indeterminate and the listbox must be examined by the application. | |
1265 | */ | |
a6052817 | 1266 | long GetExtraLong() const; |
23324ae1 FM |
1267 | |
1268 | /** | |
1269 | Returns the integer identifier corresponding to a listbox, choice or | |
1270 | radiobox selection (only if the event was a selection, not a | |
1271 | deselection), or a boolean value representing the value of a checkbox. | |
1272 | */ | |
a6052817 | 1273 | int GetInt() const; |
23324ae1 FM |
1274 | |
1275 | /** | |
1276 | Returns item index for a listbox or choice selection event (not valid for | |
1277 | a deselection). | |
1278 | */ | |
a6052817 | 1279 | int GetSelection() const; |
23324ae1 FM |
1280 | |
1281 | /** | |
1282 | Returns item string for a listbox or choice selection event (not valid for | |
1283 | a deselection). | |
1284 | */ | |
a6052817 | 1285 | wxString GetString() const; |
23324ae1 FM |
1286 | |
1287 | /** | |
1288 | This method can be used with checkbox and menu events: for the checkboxes, the | |
1289 | method returns @true for a selection event and @false for a | |
1290 | deselection one. For the menu events, this method indicates if the menu item | |
1291 | just has become checked or unchecked (and thus only makes sense for checkable | |
1292 | menu items). | |
7c913512 | 1293 | Notice that this method can not be used with |
23324ae1 FM |
1294 | wxCheckListBox currently. |
1295 | */ | |
328f5751 | 1296 | bool IsChecked() const; |
23324ae1 FM |
1297 | |
1298 | /** | |
1299 | For a listbox or similar event, returns @true if it is a selection, @false if it | |
1300 | is a deselection. | |
1301 | */ | |
a6052817 | 1302 | bool IsSelection() const; |
23324ae1 FM |
1303 | |
1304 | /** | |
1305 | Sets the client data for this event. | |
1306 | */ | |
1307 | void SetClientData(void* clientData); | |
1308 | ||
1309 | /** | |
1310 | Sets the client object for this event. The client object is not owned by the | |
1311 | event | |
1312 | object and the event object will not delete the client object in its destructor. | |
1313 | The client object must be owned and deleted by another object (e.g. a control) | |
1314 | that has longer life time than the event object. | |
1315 | */ | |
1316 | void SetClientObject(wxClientData* clientObject); | |
1317 | ||
1318 | /** | |
1319 | Sets the @b m_extraLong member. | |
1320 | */ | |
1321 | void SetExtraLong(long extraLong); | |
1322 | ||
1323 | /** | |
1324 | Sets the @b m_commandInt member. | |
1325 | */ | |
1326 | void SetInt(int intCommand); | |
1327 | ||
1328 | /** | |
1329 | Sets the @b m_commandString member. | |
1330 | */ | |
1331 | void SetString(const wxString& string); | |
1332 | }; | |
1333 | ||
1334 | ||
e54c96f1 | 1335 | |
23324ae1 FM |
1336 | /** |
1337 | @class wxActivateEvent | |
1338 | @wxheader{event.h} | |
7c913512 | 1339 | |
23324ae1 FM |
1340 | An activate event is sent when a window or application is being activated |
1341 | or deactivated. | |
7c913512 | 1342 | |
23324ae1 FM |
1343 | @library{wxcore} |
1344 | @category{events} | |
7c913512 | 1345 | |
e54c96f1 | 1346 | @see @ref overview_eventhandlingoverview, wxApp::IsActive |
23324ae1 FM |
1347 | */ |
1348 | class wxActivateEvent : public wxEvent | |
1349 | { | |
1350 | public: | |
1351 | /** | |
1352 | Constructor. | |
1353 | */ | |
1d497b99 | 1354 | wxActivateEvent(wxEventType eventType = wxEVT_NULL, bool active = true, |
23324ae1 FM |
1355 | int id = 0); |
1356 | ||
1357 | /** | |
1358 | Returns @true if the application or window is being activated, @false otherwise. | |
1359 | */ | |
328f5751 | 1360 | bool GetActive() const; |
23324ae1 FM |
1361 | }; |
1362 | ||
1363 | ||
e54c96f1 | 1364 | |
23324ae1 FM |
1365 | /** |
1366 | @class wxContextMenuEvent | |
1367 | @wxheader{event.h} | |
7c913512 | 1368 | |
23324ae1 FM |
1369 | This class is used for context menu events, sent to give |
1370 | the application a chance to show a context (popup) menu. | |
7c913512 | 1371 | |
23324ae1 FM |
1372 | Note that if wxContextMenuEvent::GetPosition returns wxDefaultPosition, this |
1373 | means that the event originated | |
1374 | from a keyboard context button event, and you should compute a suitable | |
1375 | position yourself, | |
e54c96f1 | 1376 | for example by calling wxGetMousePosition(). |
7c913512 | 1377 | |
23324ae1 FM |
1378 | When a keyboard context menu button is pressed on Windows, a right-click event |
1379 | with default position is sent first, | |
1380 | and if this event is not processed, the context menu event is sent. So if you | |
1381 | process mouse events and you find your context menu event handler | |
1382 | is not being called, you could call wxEvent::Skip for mouse right-down events. | |
7c913512 | 1383 | |
23324ae1 FM |
1384 | @library{wxcore} |
1385 | @category{events} | |
7c913512 | 1386 | |
e54c96f1 | 1387 | @see @ref overview_wxcommandevent "Command events", @ref |
4cc4bfaf | 1388 | overview_eventhandlingoverview |
23324ae1 FM |
1389 | */ |
1390 | class wxContextMenuEvent : public wxCommandEvent | |
1391 | { | |
1392 | public: | |
1393 | /** | |
1394 | Constructor. | |
1395 | */ | |
1d497b99 | 1396 | wxContextMenuEvent(wxEventType id = 0, int id = 0, |
4cc4bfaf | 1397 | const wxPoint& pos = wxDefaultPosition); |
23324ae1 FM |
1398 | |
1399 | /** | |
1400 | Returns the position in screen coordinates at which the menu should be shown. | |
1401 | Use wxWindow::ScreenToClient to | |
1402 | convert to client coordinates. You can also omit a position from | |
1403 | wxWindow::PopupMenu in order to use | |
1404 | the current mouse pointer position. | |
23324ae1 FM |
1405 | If the event originated from a keyboard event, the value returned from this |
1406 | function will be wxDefaultPosition. | |
1407 | */ | |
a6052817 | 1408 | const wxPoint& GetPosition() const; |
23324ae1 FM |
1409 | |
1410 | /** | |
1411 | Sets the position at which the menu should be shown. | |
1412 | */ | |
1413 | void SetPosition(const wxPoint& point); | |
1414 | }; | |
1415 | ||
1416 | ||
e54c96f1 | 1417 | |
23324ae1 FM |
1418 | /** |
1419 | @class wxEraseEvent | |
1420 | @wxheader{event.h} | |
7c913512 | 1421 | |
23324ae1 | 1422 | An erase event is sent when a window's background needs to be repainted. |
7c913512 | 1423 | |
23324ae1 FM |
1424 | On some platforms, such as GTK+, this event is simulated (simply generated just |
1425 | before the | |
1426 | paint event) and may cause flicker. It is therefore recommended that | |
1427 | you set the text background colour explicitly in order to prevent flicker. | |
1428 | The default background colour under GTK+ is grey. | |
7c913512 | 1429 | |
23324ae1 FM |
1430 | To intercept this event, use the EVT_ERASE_BACKGROUND macro in an event table |
1431 | definition. | |
7c913512 | 1432 | |
23324ae1 FM |
1433 | You must call wxEraseEvent::GetDC and use the returned device context if it is |
1434 | non-@NULL. | |
7c913512 FM |
1435 | If it is @NULL, create your own temporary wxClientDC object. |
1436 | ||
23324ae1 FM |
1437 | @library{wxcore} |
1438 | @category{events} | |
7c913512 | 1439 | |
e54c96f1 | 1440 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1441 | */ |
1442 | class wxEraseEvent : public wxEvent | |
1443 | { | |
1444 | public: | |
1445 | /** | |
1446 | Constructor. | |
1447 | */ | |
4cc4bfaf | 1448 | wxEraseEvent(int id = 0, wxDC* dc = NULL); |
23324ae1 FM |
1449 | |
1450 | /** | |
1451 | Returns the device context associated with the erase event to draw on. | |
1452 | */ | |
328f5751 | 1453 | wxDC* GetDC() const; |
23324ae1 FM |
1454 | }; |
1455 | ||
1456 | ||
e54c96f1 | 1457 | |
23324ae1 FM |
1458 | /** |
1459 | @class wxFocusEvent | |
1460 | @wxheader{event.h} | |
7c913512 | 1461 | |
23324ae1 FM |
1462 | A focus event is sent when a window's focus changes. The window losing focus |
1463 | receives a "kill focus'' event while the window gaining it gets a "set | |
1464 | focus'' one. | |
7c913512 | 1465 | |
23324ae1 FM |
1466 | Notice that the set focus event happens both when the user gives focus to the |
1467 | window (whether using the mouse or keyboard) and when it is done from the | |
1468 | program itself using wxWindow::SetFocus. | |
7c913512 | 1469 | |
23324ae1 FM |
1470 | @library{wxcore} |
1471 | @category{events} | |
7c913512 | 1472 | |
e54c96f1 | 1473 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1474 | */ |
1475 | class wxFocusEvent : public wxEvent | |
1476 | { | |
1477 | public: | |
1478 | /** | |
1479 | Constructor. | |
1480 | */ | |
1d497b99 | 1481 | wxFocusEvent(wxEventType eventType = 0, int id = 0); |
23324ae1 FM |
1482 | |
1483 | /** | |
1484 | Returns the window associated with this event, that is the window which had the | |
1485 | focus before for the @c wxEVT_SET_FOCUS event and the window which is | |
1486 | going to receive focus for the @c wxEVT_KILL_FOCUS one. | |
23324ae1 FM |
1487 | Warning: the window pointer may be @NULL! |
1488 | */ | |
1489 | }; | |
1490 | ||
1491 | ||
e54c96f1 | 1492 | |
23324ae1 FM |
1493 | /** |
1494 | @class wxChildFocusEvent | |
1495 | @wxheader{event.h} | |
7c913512 | 1496 | |
23324ae1 FM |
1497 | A child focus event is sent to a (parent-)window when one of its child windows |
1498 | gains focus, | |
1499 | so that the window could restore the focus back to its corresponding child | |
1500 | if it loses it now and regains later. | |
7c913512 | 1501 | |
23324ae1 | 1502 | Notice that child window is the direct child of the window receiving event. |
7c913512 FM |
1503 | Use wxWindow::FindFocus to retreive the window which is actually getting focus. |
1504 | ||
23324ae1 FM |
1505 | @library{wxcore} |
1506 | @category{events} | |
7c913512 | 1507 | |
e54c96f1 | 1508 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1509 | */ |
1510 | class wxChildFocusEvent : public wxCommandEvent | |
1511 | { | |
1512 | public: | |
1513 | /** | |
1514 | Constructor. | |
3c4f71cc | 1515 | |
7c913512 | 1516 | @param win |
4cc4bfaf FM |
1517 | The direct child which is (or which contains the window which is) receiving |
1518 | the focus. | |
23324ae1 | 1519 | */ |
4cc4bfaf | 1520 | wxChildFocusEvent(wxWindow* win = NULL); |
23324ae1 FM |
1521 | |
1522 | /** | |
1523 | Returns the direct child which receives the focus, or a (grand-)parent of the | |
1524 | control receiving the focus. | |
23324ae1 FM |
1525 | To get the actually focused control use wxWindow::FindFocus. |
1526 | */ | |
1527 | }; | |
1528 | ||
1529 | ||
e54c96f1 | 1530 | |
23324ae1 FM |
1531 | /** |
1532 | @class wxMouseCaptureLostEvent | |
1533 | @wxheader{event.h} | |
7c913512 | 1534 | |
23324ae1 FM |
1535 | An mouse capture lost event is sent to a window that obtained mouse capture, |
1536 | which was subsequently loss due to "external" event, for example when a dialog | |
1537 | box is shown or if another application captures the mouse. | |
7c913512 | 1538 | |
23324ae1 FM |
1539 | If this happens, this event is sent to all windows that are on capture stack |
1540 | (i.e. called CaptureMouse, but didn't call ReleaseMouse yet). The event is | |
1541 | not sent if the capture changes because of a call to CaptureMouse or | |
1542 | ReleaseMouse. | |
7c913512 | 1543 | |
23324ae1 | 1544 | This event is currently emitted under Windows only. |
7c913512 | 1545 | |
23324ae1 FM |
1546 | @library{wxcore} |
1547 | @category{events} | |
7c913512 | 1548 | |
e54c96f1 | 1549 | @see wxMouseCaptureChangedEvent, @ref overview_eventhandlingoverview, |
4cc4bfaf | 1550 | wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture |
23324ae1 FM |
1551 | */ |
1552 | class wxMouseCaptureLostEvent : public wxEvent | |
1553 | { | |
1554 | public: | |
1555 | /** | |
1556 | Constructor. | |
1557 | */ | |
1558 | wxMouseCaptureLostEvent(wxWindowID windowId = 0); | |
1559 | }; | |
1560 | ||
1561 | ||
e54c96f1 | 1562 | |
23324ae1 FM |
1563 | /** |
1564 | @class wxNotifyEvent | |
1565 | @wxheader{event.h} | |
7c913512 | 1566 | |
23324ae1 FM |
1567 | This class is not used by the event handlers by itself, but is a base class |
1568 | for other event classes (such as wxNotebookEvent). | |
7c913512 | 1569 | |
23324ae1 FM |
1570 | It (or an object of a derived class) is sent when the controls state is being |
1571 | changed and allows the program to wxNotifyEvent::Veto this | |
1572 | change if it wants to prevent it from happening. | |
7c913512 | 1573 | |
23324ae1 FM |
1574 | @library{wxcore} |
1575 | @category{events} | |
7c913512 | 1576 | |
e54c96f1 | 1577 | @see wxNotebookEvent |
23324ae1 FM |
1578 | */ |
1579 | class wxNotifyEvent : public wxCommandEvent | |
1580 | { | |
1581 | public: | |
1582 | /** | |
1583 | Constructor (used internally by wxWidgets only). | |
1584 | */ | |
4cc4bfaf | 1585 | wxNotifyEvent(wxEventType eventType = wxEVT_NULL, int id = 0); |
23324ae1 FM |
1586 | |
1587 | /** | |
1588 | This is the opposite of Veto(): it explicitly | |
1589 | allows the event to be processed. For most events it is not necessary to call | |
1590 | this method as the events are allowed anyhow but some are forbidden by default | |
1591 | (this will be mentioned in the corresponding event description). | |
1592 | */ | |
1593 | void Allow(); | |
1594 | ||
1595 | /** | |
7c913512 | 1596 | Returns @true if the change is allowed (Veto() |
23324ae1 FM |
1597 | hasn't been called) or @false otherwise (if it was). |
1598 | */ | |
328f5751 | 1599 | bool IsAllowed() const; |
23324ae1 FM |
1600 | |
1601 | /** | |
1602 | Prevents the change announced by this event from happening. | |
23324ae1 FM |
1603 | It is in general a good idea to notify the user about the reasons for vetoing |
1604 | the change because otherwise the applications behaviour (which just refuses to | |
1605 | do what the user wants) might be quite surprising. | |
1606 | */ | |
1607 | void Veto(); | |
1608 | }; | |
1609 | ||
1610 | ||
e54c96f1 | 1611 | |
23324ae1 FM |
1612 | /** |
1613 | @class wxHelpEvent | |
1614 | @wxheader{event.h} | |
7c913512 | 1615 | |
23324ae1 FM |
1616 | A help event is sent when the user has requested context-sensitive help. |
1617 | This can either be caused by the application requesting | |
1618 | context-sensitive help mode via wxContextHelp, or | |
1619 | (on MS Windows) by the system generating a WM_HELP message when the user | |
1620 | pressed F1 or clicked | |
1621 | on the query button in a dialog caption. | |
7c913512 | 1622 | |
23324ae1 FM |
1623 | A help event is sent to the window that the user clicked on, and is propagated |
1624 | up the | |
1625 | window hierarchy until the event is processed or there are no more event | |
1626 | handlers. | |
1627 | The application should call wxEvent::GetId to check the identity of the | |
1628 | clicked-on window, | |
1629 | and then either show some suitable help or call wxEvent::Skip if the identifier | |
1630 | is unrecognised. | |
1631 | Calling Skip is important because it allows wxWidgets to generate further | |
1632 | events for ancestors | |
1633 | of the clicked-on window. Otherwise it would be impossible to show help for | |
1634 | container windows, | |
1635 | since processing would stop after the first window found. | |
7c913512 | 1636 | |
23324ae1 FM |
1637 | @library{wxcore} |
1638 | @category{FIXME} | |
7c913512 | 1639 | |
e54c96f1 | 1640 | @see wxContextHelp, wxDialog, @ref overview_eventhandlingoverview |
23324ae1 FM |
1641 | */ |
1642 | class wxHelpEvent : public wxCommandEvent | |
1643 | { | |
1644 | public: | |
a6052817 FM |
1645 | // how was this help event generated? |
1646 | enum Origin | |
1647 | { | |
1648 | Origin_Unknown, // unrecognized event source | |
1649 | Origin_Keyboard, // event generated from F1 key press | |
1650 | Origin_HelpButton // event from [?] button on the title bar (Windows) | |
1651 | }; | |
1652 | ||
23324ae1 FM |
1653 | /** |
1654 | Constructor. | |
1655 | */ | |
a6052817 FM |
1656 | wxHelpEvent(wxEventType type = wxEVT_NULL, |
1657 | wxWindowID winid = 0, | |
1658 | const wxPoint& pt = wxDefaultPosition, | |
1659 | Origin origin = Origin_Unknown); | |
23324ae1 FM |
1660 | |
1661 | /** | |
1662 | Returns the origin of the help event which is one of the following values: | |
3c4f71cc | 1663 | |
23324ae1 | 1664 | @b Origin_Unknown |
3c4f71cc | 1665 | |
23324ae1 | 1666 | Unrecognized event source. |
3c4f71cc | 1667 | |
23324ae1 | 1668 | @b Origin_Keyboard |
3c4f71cc | 1669 | |
23324ae1 | 1670 | Event generated by @c F1 key press. |
3c4f71cc | 1671 | |
23324ae1 | 1672 | @b Origin_HelpButton |
3c4f71cc | 1673 | |
7c913512 | 1674 | Event generated by |
23324ae1 FM |
1675 | wxContextHelp or using the "?" title bur button under |
1676 | MS Windows. | |
3c4f71cc | 1677 | |
23324ae1 | 1678 | The application may handle events generated using the keyboard or mouse |
e54c96f1 | 1679 | differently, e.g. by using wxGetMousePosition() |
23324ae1 | 1680 | for the mouse events. |
3c4f71cc | 1681 | |
4cc4bfaf | 1682 | @see SetOrigin() |
23324ae1 | 1683 | */ |
a6052817 | 1684 | Origin GetOrigin() const; |
23324ae1 FM |
1685 | |
1686 | /** | |
1687 | Returns the left-click position of the mouse, in screen coordinates. This allows | |
1688 | the application to position the help appropriately. | |
1689 | */ | |
a6052817 | 1690 | const wxPoint& GetPosition() const; |
23324ae1 FM |
1691 | |
1692 | /** | |
1693 | Set the help event origin, only used internally by wxWidgets normally. | |
3c4f71cc | 1694 | |
4cc4bfaf | 1695 | @see GetOrigin() |
23324ae1 | 1696 | */ |
a6052817 | 1697 | void SetOrigin(Origin); |
23324ae1 FM |
1698 | |
1699 | /** | |
1700 | Sets the left-click position of the mouse, in screen coordinates. | |
1701 | */ | |
1702 | void SetPosition(const wxPoint& pt); | |
1703 | }; | |
1704 | ||
1705 | ||
e54c96f1 | 1706 | |
23324ae1 FM |
1707 | /** |
1708 | @class wxScrollEvent | |
1709 | @wxheader{event.h} | |
7c913512 | 1710 | |
23324ae1 | 1711 | A scroll event holds information about events sent from stand-alone |
e54c96f1 | 1712 | scrollbars() and sliders(). Note that |
7c913512 | 1713 | starting from wxWidgets 2.1, scrolled windows send the |
23324ae1 FM |
1714 | wxScrollWinEvent which does not derive from |
1715 | wxCommandEvent, but from wxEvent directly - don't confuse these two kinds of | |
1716 | events and use the event table macros mentioned below only for the | |
1717 | scrollbar-like controls. | |
7c913512 | 1718 | |
23324ae1 FM |
1719 | @library{wxcore} |
1720 | @category{events} | |
7c913512 | 1721 | |
e54c96f1 | 1722 | @see wxScrollBar, wxSlider, wxSpinButton, , wxScrollWinEvent, @ref |
4cc4bfaf | 1723 | overview_eventhandlingoverview |
23324ae1 FM |
1724 | */ |
1725 | class wxScrollEvent : public wxCommandEvent | |
1726 | { | |
1727 | public: | |
1728 | /** | |
1729 | Constructor. | |
1730 | */ | |
1d497b99 | 1731 | wxScrollEvent(wxEventType commandType = 0, int id = 0, int pos = 0, |
23324ae1 FM |
1732 | int orientation = 0); |
1733 | ||
1734 | /** | |
1735 | Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the | |
1736 | scrollbar. | |
1737 | */ | |
328f5751 | 1738 | int GetOrientation() const; |
23324ae1 FM |
1739 | |
1740 | /** | |
1741 | Returns the position of the scrollbar. | |
1742 | */ | |
328f5751 | 1743 | int GetPosition() const; |
23324ae1 FM |
1744 | }; |
1745 | ||
1746 | ||
e54c96f1 | 1747 | |
23324ae1 FM |
1748 | /** |
1749 | @class wxIdleEvent | |
1750 | @wxheader{event.h} | |
7c913512 | 1751 | |
23324ae1 FM |
1752 | This class is used for idle events, which are generated when the system becomes |
1753 | idle. Note that, unless you do something specifically, the idle events are not | |
1754 | sent if the system remains idle once it has become it, e.g. only a single idle | |
1755 | event will be generated until something else resulting in more normal events | |
1756 | happens and only then is the next idle event sent again. If you need to ensure | |
7c913512 FM |
1757 | a continuous stream of idle events, you can either use |
1758 | wxIdleEvent::RequestMore method in your handler or call | |
e54c96f1 | 1759 | wxWakeUpIdle() periodically (for example from timer |
23324ae1 FM |
1760 | event), but note that both of these approaches (and especially the first one) |
1761 | increase the system load and so should be avoided if possible. | |
7c913512 FM |
1762 | |
1763 | By default, idle events are sent to all windows (and also | |
23324ae1 FM |
1764 | wxApp, as usual). If this is causing a significant |
1765 | overhead in your application, you can call wxIdleEvent::SetMode with | |
1766 | the value wxIDLE_PROCESS_SPECIFIED, and set the wxWS_EX_PROCESS_IDLE extra | |
1767 | window style for every window which should receive idle events. | |
7c913512 | 1768 | |
23324ae1 FM |
1769 | @library{wxbase} |
1770 | @category{events} | |
7c913512 | 1771 | |
e54c96f1 FM |
1772 | @see @ref overview_eventhandlingoverview, wxUpdateUIEvent, |
1773 | wxWindow::OnInternalIdle | |
23324ae1 FM |
1774 | */ |
1775 | class wxIdleEvent : public wxEvent | |
1776 | { | |
1777 | public: | |
1778 | /** | |
1779 | Constructor. | |
1780 | */ | |
1781 | wxIdleEvent(); | |
1782 | ||
1783 | /** | |
1784 | Returns @true if it is appropriate to send idle events to | |
1785 | this window. | |
23324ae1 | 1786 | This function looks at the mode used (see wxIdleEvent::SetMode), |
4cc4bfaf | 1787 | and the wxWS_EX_PROCESS_IDLE style in @a window to determine whether idle |
23324ae1 FM |
1788 | events should be sent to |
1789 | this window now. By default this will always return @true because | |
1790 | the update mode is initially wxIDLE_PROCESS_ALL. You can change the mode | |
1791 | to only send idle events to windows with the wxWS_EX_PROCESS_IDLE extra window | |
1792 | style set. | |
3c4f71cc | 1793 | |
4cc4bfaf | 1794 | @see SetMode() |
23324ae1 FM |
1795 | */ |
1796 | static bool CanSend(wxWindow* window); | |
1797 | ||
1798 | /** | |
1799 | Static function returning a value specifying how wxWidgets | |
1800 | will send idle events: to all windows, or only to those which specify that they | |
1801 | will process the events. | |
23324ae1 FM |
1802 | See SetMode(). |
1803 | */ | |
1804 | static wxIdleMode GetMode(); | |
1805 | ||
1806 | /** | |
1807 | Returns @true if the OnIdle function processing this event requested more | |
1808 | processing time. | |
3c4f71cc | 1809 | |
4cc4bfaf | 1810 | @see RequestMore() |
23324ae1 | 1811 | */ |
328f5751 | 1812 | bool MoreRequested() const; |
23324ae1 FM |
1813 | |
1814 | /** | |
1815 | Tells wxWidgets that more processing is required. This function can be called | |
1816 | by an OnIdle | |
1817 | handler for a window or window event handler to indicate that wxApp::OnIdle | |
1818 | should | |
1819 | forward the OnIdle event once more to the application windows. If no window | |
1820 | calls this function | |
1821 | during OnIdle, then the application will remain in a passive event loop (not | |
1822 | calling OnIdle) until a | |
1823 | new event is posted to the application by the windowing system. | |
3c4f71cc | 1824 | |
4cc4bfaf | 1825 | @see MoreRequested() |
23324ae1 | 1826 | */ |
4cc4bfaf | 1827 | void RequestMore(bool needMore = true); |
23324ae1 FM |
1828 | |
1829 | /** | |
1830 | Static function for specifying how wxWidgets will send idle events: to | |
1831 | all windows, or only to those which specify that they | |
1832 | will process the events. | |
4cc4bfaf | 1833 | @a mode can be one of the following values. |
23324ae1 FM |
1834 | The default is wxIDLE_PROCESS_ALL. |
1835 | */ | |
1836 | static void SetMode(wxIdleMode mode); | |
1837 | }; | |
1838 | ||
1839 | ||
e54c96f1 | 1840 | |
23324ae1 FM |
1841 | /** |
1842 | @class wxInitDialogEvent | |
1843 | @wxheader{event.h} | |
7c913512 | 1844 | |
23324ae1 FM |
1845 | A wxInitDialogEvent is sent as a dialog or panel is being initialised. |
1846 | Handlers for this event can transfer data to the window. | |
1847 | The default handler calls wxWindow::TransferDataToWindow. | |
7c913512 | 1848 | |
23324ae1 FM |
1849 | @library{wxcore} |
1850 | @category{events} | |
7c913512 | 1851 | |
e54c96f1 | 1852 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1853 | */ |
1854 | class wxInitDialogEvent : public wxEvent | |
1855 | { | |
1856 | public: | |
1857 | /** | |
1858 | Constructor. | |
1859 | */ | |
1860 | wxInitDialogEvent(int id = 0); | |
1861 | }; | |
1862 | ||
1863 | ||
e54c96f1 | 1864 | |
23324ae1 FM |
1865 | /** |
1866 | @class wxWindowDestroyEvent | |
1867 | @wxheader{event.h} | |
7c913512 | 1868 | |
23324ae1 FM |
1869 | This event is sent from the wxWindow destructor wxWindow::~wxWindow() when a |
1870 | window is destroyed. | |
7c913512 | 1871 | |
23324ae1 FM |
1872 | When a class derived from wxWindow is destroyed its destructor will have |
1873 | already run by the time this event is sent. Therefore this event will not | |
1874 | usually be received at all. | |
7c913512 | 1875 | |
23324ae1 FM |
1876 | To receive this event wxEvtHandler::Connect |
1877 | must be used (using an event table macro will not work). Since it is | |
1878 | received after the destructor has run, an object should not handle its | |
1879 | own wxWindowDestroyEvent, but it can be used to get notification of the | |
1880 | destruction of another window. | |
7c913512 | 1881 | |
23324ae1 FM |
1882 | @library{wxcore} |
1883 | @category{events} | |
7c913512 | 1884 | |
e54c96f1 | 1885 | @see @ref overview_eventhandlingoverview, wxWindowCreateEvent |
23324ae1 FM |
1886 | */ |
1887 | class wxWindowDestroyEvent : public wxCommandEvent | |
1888 | { | |
1889 | public: | |
1890 | /** | |
1891 | Constructor. | |
1892 | */ | |
4cc4bfaf | 1893 | wxWindowDestroyEvent(wxWindow* win = NULL); |
23324ae1 FM |
1894 | }; |
1895 | ||
1896 | ||
e54c96f1 | 1897 | |
23324ae1 FM |
1898 | /** |
1899 | @class wxNavigationKeyEvent | |
1900 | @wxheader{event.h} | |
7c913512 FM |
1901 | |
1902 | This event class contains information about navigation events, | |
1903 | generated by navigation keys such as tab and page down. | |
1904 | ||
1905 | This event is mainly used by wxWidgets implementations. A | |
1906 | wxNavigationKeyEvent handler is automatically provided by wxWidgets | |
23324ae1 | 1907 | when you make a class into a control container with the macro |
7c913512 FM |
1908 | WX_DECLARE_CONTROL_CONTAINER. |
1909 | ||
23324ae1 FM |
1910 | @library{wxcore} |
1911 | @category{events} | |
7c913512 | 1912 | |
e54c96f1 | 1913 | @see wxWindow::Navigate, wxWindow::NavigateIn |
23324ae1 | 1914 | */ |
7c913512 | 1915 | class wxNavigationKeyEvent |
23324ae1 FM |
1916 | { |
1917 | public: | |
1918 | //@{ | |
1919 | /** | |
1920 | Constructor. | |
1921 | */ | |
1922 | wxNavigationKeyEvent(); | |
7c913512 | 1923 | wxNavigationKeyEvent(const wxNavigationKeyEvent& event); |
23324ae1 FM |
1924 | //@} |
1925 | ||
1926 | /** | |
1927 | Returns the child that has the focus, or @NULL. | |
1928 | */ | |
328f5751 | 1929 | wxWindow* GetCurrentFocus() const; |
23324ae1 FM |
1930 | |
1931 | /** | |
1932 | Returns @true if the navigation was in the forward direction. | |
1933 | */ | |
328f5751 | 1934 | bool GetDirection() const; |
23324ae1 FM |
1935 | |
1936 | /** | |
1937 | Returns @true if the navigation event was from a tab key. This is required | |
1938 | for proper navigation over radio buttons. | |
1939 | */ | |
328f5751 | 1940 | bool IsFromTab() const; |
23324ae1 FM |
1941 | |
1942 | /** | |
1943 | Returns @true if the navigation event represents a window change (for | |
7c913512 | 1944 | example, from Ctrl-Page Down |
23324ae1 FM |
1945 | in a notebook). |
1946 | */ | |
328f5751 | 1947 | bool IsWindowChange() const; |
23324ae1 FM |
1948 | |
1949 | /** | |
1950 | Sets the current focus window member. | |
1951 | */ | |
1952 | void SetCurrentFocus(wxWindow* currentFocus); | |
1953 | ||
1954 | /** | |
4cc4bfaf | 1955 | Sets the direction to forward if @a direction is @true, or backward if @c |
23324ae1 FM |
1956 | @false. |
1957 | */ | |
1958 | void SetDirection(bool direction); | |
1959 | ||
1960 | /** | |
1961 | Sets the flags. | |
1962 | */ | |
1963 | void SetFlags(long flags); | |
1964 | ||
1965 | /** | |
1966 | Marks the navigation event as from a tab key. | |
1967 | */ | |
1968 | void SetFromTab(bool fromTab); | |
1969 | ||
1970 | /** | |
1971 | Marks the event as a window change event. | |
1972 | */ | |
1973 | void SetWindowChange(bool windowChange); | |
1974 | }; | |
1975 | ||
1976 | ||
e54c96f1 | 1977 | |
23324ae1 FM |
1978 | /** |
1979 | @class wxMouseCaptureChangedEvent | |
1980 | @wxheader{event.h} | |
7c913512 | 1981 | |
23324ae1 FM |
1982 | An mouse capture changed event is sent to a window that loses its |
1983 | mouse capture. This is called even if wxWindow::ReleaseCapture | |
1984 | was called by the application code. Handling this event allows | |
1985 | an application to cater for unexpected capture releases which | |
1986 | might otherwise confuse mouse handling code. | |
7c913512 | 1987 | |
23324ae1 | 1988 | This event is implemented under Windows only. |
7c913512 | 1989 | |
23324ae1 FM |
1990 | @library{wxcore} |
1991 | @category{events} | |
7c913512 | 1992 | |
e54c96f1 | 1993 | @see wxMouseCaptureLostEvent, @ref overview_eventhandlingoverview, |
4cc4bfaf | 1994 | wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture |
23324ae1 FM |
1995 | */ |
1996 | class wxMouseCaptureChangedEvent : public wxEvent | |
1997 | { | |
1998 | public: | |
1999 | /** | |
2000 | Constructor. | |
2001 | */ | |
2002 | wxMouseCaptureChangedEvent(wxWindowID windowId = 0, | |
4cc4bfaf | 2003 | wxWindow* gainedCapture = NULL); |
23324ae1 FM |
2004 | |
2005 | /** | |
2006 | Returns the window that gained the capture, or @NULL if it was a non-wxWidgets | |
2007 | window. | |
2008 | */ | |
328f5751 | 2009 | wxWindow* GetCapturedWindow() const; |
23324ae1 FM |
2010 | }; |
2011 | ||
2012 | ||
e54c96f1 | 2013 | |
23324ae1 FM |
2014 | /** |
2015 | @class wxCloseEvent | |
2016 | @wxheader{event.h} | |
7c913512 | 2017 | |
23324ae1 | 2018 | This event class contains information about window and session close events. |
7c913512 | 2019 | |
23324ae1 FM |
2020 | The handler function for EVT_CLOSE is called when the user has tried to close a |
2021 | a frame | |
2022 | or dialog box using the window manager (X) or system menu (Windows). It can | |
2023 | also be invoked by the application itself programmatically, for example by | |
2024 | calling the wxWindow::Close function. | |
7c913512 | 2025 | |
23324ae1 FM |
2026 | You should check whether the application is forcing the deletion of the window |
2027 | using wxCloseEvent::CanVeto. If this is @false, | |
2028 | you @e must destroy the window using wxWindow::Destroy. | |
2029 | If the return value is @true, it is up to you whether you respond by destroying | |
2030 | the window. | |
7c913512 | 2031 | |
23324ae1 FM |
2032 | If you don't destroy the window, you should call wxCloseEvent::Veto to |
2033 | let the calling code know that you did not destroy the window. This allows the | |
2034 | wxWindow::Close function | |
2035 | to return @true or @false depending on whether the close instruction was | |
2036 | honoured or not. | |
7c913512 | 2037 | |
23324ae1 FM |
2038 | @library{wxcore} |
2039 | @category{events} | |
7c913512 | 2040 | |
e54c96f1 FM |
2041 | @see wxWindow::Close, @ref overview_windowdeletionoverview "Window deletion |
2042 | overview" | |
23324ae1 FM |
2043 | */ |
2044 | class wxCloseEvent : public wxEvent | |
2045 | { | |
2046 | public: | |
2047 | /** | |
2048 | Constructor. | |
2049 | */ | |
1d497b99 | 2050 | wxCloseEvent(wxEventType commandEventType = 0, int id = 0); |
23324ae1 FM |
2051 | |
2052 | /** | |
2053 | Returns @true if you can veto a system shutdown or a window close event. | |
2054 | Vetoing a window close event is not possible if the calling code wishes to | |
2055 | force the application to exit, and so this function must be called to check | |
2056 | this. | |
2057 | */ | |
a6052817 | 2058 | bool CanVeto() const; |
23324ae1 FM |
2059 | |
2060 | /** | |
2061 | Returns @true if the user is just logging off or @false if the system is | |
2062 | shutting down. This method can only be called for end session and query end | |
2063 | session events, it doesn't make sense for close window event. | |
2064 | */ | |
328f5751 | 2065 | bool GetLoggingOff() const; |
23324ae1 FM |
2066 | |
2067 | /** | |
2068 | Sets the 'can veto' flag. | |
2069 | */ | |
2070 | void SetCanVeto(bool canVeto); | |
2071 | ||
2072 | /** | |
2073 | Sets the 'force' flag. | |
2074 | */ | |
328f5751 | 2075 | void SetForce(bool force) const; |
23324ae1 FM |
2076 | |
2077 | /** | |
2078 | Sets the 'logging off' flag. | |
2079 | */ | |
a6052817 | 2080 | void SetLoggingOff(bool loggingOff); |
23324ae1 FM |
2081 | |
2082 | /** | |
2083 | Call this from your event handler to veto a system shutdown or to signal | |
2084 | to the calling application that a window close did not happen. | |
23324ae1 FM |
2085 | You can only veto a shutdown if CanVeto() returns |
2086 | @true. | |
2087 | */ | |
4cc4bfaf | 2088 | void Veto(bool veto = true); |
23324ae1 FM |
2089 | }; |
2090 | ||
2091 | ||
e54c96f1 | 2092 | |
23324ae1 FM |
2093 | /** |
2094 | @class wxMenuEvent | |
2095 | @wxheader{event.h} | |
7c913512 | 2096 | |
23324ae1 FM |
2097 | This class is used for a variety of menu-related events. Note that |
2098 | these do not include menu command events, which are | |
2099 | handled using wxCommandEvent objects. | |
7c913512 | 2100 | |
23324ae1 FM |
2101 | The default handler for wxEVT_MENU_HIGHLIGHT displays help |
2102 | text in the first field of the status bar. | |
7c913512 | 2103 | |
23324ae1 FM |
2104 | @library{wxcore} |
2105 | @category{events} | |
7c913512 | 2106 | |
e54c96f1 | 2107 | @see @ref overview_wxcommandevent "Command events", @ref |
4cc4bfaf | 2108 | overview_eventhandlingoverview |
23324ae1 FM |
2109 | */ |
2110 | class wxMenuEvent : public wxEvent | |
2111 | { | |
2112 | public: | |
2113 | /** | |
2114 | Constructor. | |
2115 | */ | |
1d497b99 | 2116 | wxMenuEvent(wxEventType id = 0, int id = 0, wxMenu* menu = NULL); |
23324ae1 FM |
2117 | |
2118 | /** | |
2119 | Returns the menu which is being opened or closed. This method should only be | |
2120 | used with the @c OPEN and @c CLOSE events and even for them the | |
2121 | returned pointer may be @NULL in some ports. | |
2122 | */ | |
328f5751 | 2123 | wxMenu* GetMenu() const; |
23324ae1 FM |
2124 | |
2125 | /** | |
2126 | Returns the menu identifier associated with the event. This method should be | |
2127 | only used with the @c HIGHLIGHT events. | |
2128 | */ | |
328f5751 | 2129 | int GetMenuId() const; |
23324ae1 FM |
2130 | |
2131 | /** | |
7c913512 | 2132 | Returns @true if the menu which is being opened or closed is a popup menu, |
23324ae1 | 2133 | @false if it is a normal one. |
23324ae1 FM |
2134 | This method should only be used with the @c OPEN and @c CLOSE events. |
2135 | */ | |
328f5751 | 2136 | bool IsPopup() const; |
23324ae1 FM |
2137 | }; |
2138 | ||
2139 | ||
e54c96f1 | 2140 | |
23324ae1 FM |
2141 | /** |
2142 | @class wxEventBlocker | |
2143 | @wxheader{event.h} | |
7c913512 | 2144 | |
23324ae1 FM |
2145 | This class is a special event handler which allows to discard |
2146 | any event (or a set of event types) directed to a specific window. | |
7c913512 | 2147 | |
23324ae1 | 2148 | Example: |
7c913512 | 2149 | |
23324ae1 FM |
2150 | @code |
2151 | { | |
2152 | // block all events directed to this window while | |
2153 | // we do the 1000 FuncWhichSendsEvents() calls | |
2154 | wxEventBlocker blocker(this); | |
7c913512 | 2155 | |
23324ae1 FM |
2156 | for ( int i = 0; i 1000; i++ ) |
2157 | FuncWhichSendsEvents(i); | |
7c913512 | 2158 | |
23324ae1 | 2159 | } // ~wxEventBlocker called, old event handler is restored |
7c913512 | 2160 | |
23324ae1 FM |
2161 | // the event generated by this call will be processed |
2162 | FuncWhichSendsEvents(0) | |
2163 | @endcode | |
7c913512 | 2164 | |
23324ae1 FM |
2165 | @library{wxcore} |
2166 | @category{FIXME} | |
7c913512 | 2167 | |
e54c96f1 | 2168 | @see @ref overview_eventhandlingoverview, wxEvtHandler |
23324ae1 FM |
2169 | */ |
2170 | class wxEventBlocker : public wxEvtHandler | |
2171 | { | |
2172 | public: | |
2173 | /** | |
2174 | Constructs the blocker for the given window and for the given event type. | |
4cc4bfaf | 2175 | If @a type is @c wxEVT_ANY, then all events for that window are |
23324ae1 FM |
2176 | blocked. You can call Block() after creation to |
2177 | add other event types to the list of events to block. | |
4cc4bfaf | 2178 | Note that the @a win window @b must remain alive until the |
23324ae1 FM |
2179 | wxEventBlocker object destruction. |
2180 | */ | |
a6052817 | 2181 | wxEventBlocker(wxWindow* win, wxEventType = -0x000000001); |
23324ae1 FM |
2182 | |
2183 | /** | |
2184 | Destructor. The blocker will remove itself from the chain of event handlers for | |
2185 | the window provided in the constructor, thus restoring normal processing of | |
2186 | events. | |
2187 | */ | |
a6052817 | 2188 | virtual ~wxEventBlocker(); |
23324ae1 FM |
2189 | |
2190 | /** | |
2191 | Adds to the list of event types which should be blocked the given @e eventType. | |
2192 | */ | |
2193 | void Block(wxEventType eventType); | |
2194 | }; | |
2195 | ||
2196 | ||
e54c96f1 | 2197 | |
23324ae1 FM |
2198 | /** |
2199 | @class wxEvtHandler | |
2200 | @wxheader{event.h} | |
7c913512 | 2201 | |
23324ae1 FM |
2202 | A class that can handle events from the windowing system. |
2203 | wxWindow (and therefore all window classes) are derived from | |
2204 | this class. | |
7c913512 | 2205 | |
23324ae1 FM |
2206 | When events are received, wxEvtHandler invokes the method listed in the |
2207 | event table using itself as the object. When using multiple inheritance | |
2208 | it is imperative that the wxEvtHandler(-derived) class be the first | |
2209 | class inherited such that the "this" pointer for the overall object | |
2210 | will be identical to the "this" pointer for the wxEvtHandler portion. | |
7c913512 | 2211 | |
23324ae1 FM |
2212 | @library{wxbase} |
2213 | @category{FIXME} | |
7c913512 | 2214 | |
e54c96f1 | 2215 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
2216 | */ |
2217 | class wxEvtHandler : public wxObject | |
2218 | { | |
2219 | public: | |
2220 | /** | |
2221 | Constructor. | |
2222 | */ | |
2223 | wxEvtHandler(); | |
2224 | ||
2225 | /** | |
2226 | Destructor. If the handler is part of a chain, the destructor will | |
2227 | unlink itself and restore the previous and next handlers so that they point to | |
2228 | each other. | |
2229 | */ | |
a6052817 | 2230 | virtual ~wxEvtHandler(); |
23324ae1 FM |
2231 | |
2232 | /** | |
2233 | This function posts an event to be processed later. | |
3c4f71cc | 2234 | |
7c913512 | 2235 | @param event |
4cc4bfaf | 2236 | Event to add to process queue. |
3c4f71cc | 2237 | |
23324ae1 | 2238 | @remarks The difference between sending an event (using the ProcessEvent |
4cc4bfaf FM |
2239 | method) and posting it is that in the first case the |
2240 | event is processed before the function returns, while | |
2241 | in the second case, the function returns immediately | |
2242 | and the event will be processed sometime later (usually | |
2243 | during the next event loop iteration). | |
23324ae1 FM |
2244 | */ |
2245 | virtual void AddPendingEvent(const wxEvent& event); | |
2246 | ||
2247 | //@{ | |
2248 | /** | |
2249 | Connects the given function dynamically with the event handler, id and event | |
2250 | type. This | |
2251 | is an alternative to the use of static event tables. See the 'event' or the old | |
2252 | 'dynamic' sample for usage. | |
3c4f71cc | 2253 | |
7c913512 | 2254 | @param id |
4cc4bfaf FM |
2255 | The identifier (or first of the identifier range) to be |
2256 | associated with the event handler function. For the version not taking this | |
2257 | argument, it defaults to wxID_ANY. | |
7c913512 | 2258 | @param lastId |
4cc4bfaf FM |
2259 | The second part of the identifier range to be associated with the event |
2260 | handler function. | |
7c913512 | 2261 | @param eventType |
4cc4bfaf | 2262 | The event type to be associated with this event handler. |
7c913512 | 2263 | @param function |
4cc4bfaf FM |
2264 | The event handler function. Note that this function should |
2265 | be explicitly converted to the correct type which can be done using a macro | |
2266 | called wxFooEventHandler for the handler for any wxFooEvent. | |
7c913512 | 2267 | @param userData |
4cc4bfaf | 2268 | Data to be associated with the event table entry. |
7c913512 | 2269 | @param eventSink |
4cc4bfaf FM |
2270 | Object whose member function should be called. If this is @NULL, |
2271 | this will be used. | |
23324ae1 FM |
2272 | */ |
2273 | void Connect(int id, int lastId, wxEventType eventType, | |
2274 | wxObjectEventFunction function, | |
4cc4bfaf FM |
2275 | wxObject* userData = NULL, |
2276 | wxEvtHandler* eventSink = NULL); | |
7c913512 FM |
2277 | void Connect(int id, wxEventType eventType, |
2278 | wxObjectEventFunction function, | |
4cc4bfaf FM |
2279 | wxObject* userData = NULL, |
2280 | wxEvtHandler* eventSink = NULL); | |
7c913512 FM |
2281 | void Connect(wxEventType eventType, |
2282 | wxObjectEventFunction function, | |
4cc4bfaf FM |
2283 | wxObject* userData = NULL, |
2284 | wxEvtHandler* eventSink = NULL); | |
23324ae1 FM |
2285 | //@} |
2286 | ||
2287 | //@{ | |
2288 | /** | |
2289 | Disconnects the given function dynamically from the event handler, using the | |
2290 | specified | |
2291 | parameters as search criteria and returning @true if a matching function has been | |
2292 | found and removed. This method can only disconnect functions which have been | |
2293 | added | |
2294 | using the Connect() method. There is no way | |
2295 | to disconnect functions connected using the (static) event tables. | |
3c4f71cc | 2296 | |
7c913512 | 2297 | @param id |
4cc4bfaf | 2298 | The identifier (or first of the identifier range) associated with the event |
23324ae1 | 2299 | handler function. |
7c913512 | 2300 | @param lastId |
4cc4bfaf | 2301 | The second part of the identifier range associated with the event handler |
23324ae1 | 2302 | function. |
7c913512 | 2303 | @param eventType |
4cc4bfaf | 2304 | The event type associated with this event handler. |
7c913512 | 2305 | @param function |
4cc4bfaf | 2306 | The event handler function. |
7c913512 | 2307 | @param userData |
4cc4bfaf | 2308 | Data associated with the event table entry. |
7c913512 | 2309 | @param eventSink |
4cc4bfaf | 2310 | Object whose member function should be called. |
23324ae1 | 2311 | */ |
4cc4bfaf FM |
2312 | bool Disconnect(wxEventType eventType = wxEVT_NULL, |
2313 | wxObjectEventFunction function = NULL, | |
2314 | wxObject* userData = NULL, | |
2315 | wxEvtHandler* eventSink = NULL); | |
7c913512 | 2316 | bool Disconnect(int id = wxID_ANY, |
4cc4bfaf FM |
2317 | wxEventType eventType = wxEVT_NULL, |
2318 | wxObjectEventFunction function = NULL, | |
2319 | wxObject* userData = NULL, | |
2320 | wxEvtHandler* eventSink = NULL); | |
7c913512 | 2321 | bool Disconnect(int id, int lastId = wxID_ANY, |
4cc4bfaf FM |
2322 | wxEventType eventType = wxEVT_NULL, |
2323 | wxObjectEventFunction function = NULL, | |
2324 | wxObject* userData = NULL, | |
2325 | wxEvtHandler* eventSink = NULL); | |
23324ae1 FM |
2326 | //@} |
2327 | ||
2328 | /** | |
2329 | Gets user-supplied client data. | |
3c4f71cc | 2330 | |
23324ae1 | 2331 | @remarks Normally, any extra data the programmer wishes to associate with |
4cc4bfaf FM |
2332 | the object should be made available by deriving a new |
2333 | class with new data members. | |
3c4f71cc | 2334 | |
4cc4bfaf | 2335 | @see SetClientData() |
23324ae1 | 2336 | */ |
a6052817 | 2337 | void* GetClientData() const; |
23324ae1 FM |
2338 | |
2339 | /** | |
2340 | Get a pointer to the user-supplied client data object. | |
3c4f71cc | 2341 | |
4cc4bfaf | 2342 | @see SetClientObject(), wxClientData |
23324ae1 | 2343 | */ |
328f5751 | 2344 | wxClientData* GetClientObject() const; |
23324ae1 FM |
2345 | |
2346 | /** | |
2347 | Returns @true if the event handler is enabled, @false otherwise. | |
3c4f71cc | 2348 | |
4cc4bfaf | 2349 | @see SetEvtHandlerEnabled() |
23324ae1 | 2350 | */ |
a6052817 | 2351 | bool GetEvtHandlerEnabled() const; |
23324ae1 FM |
2352 | |
2353 | /** | |
2354 | Gets the pointer to the next handler in the chain. | |
3c4f71cc | 2355 | |
4cc4bfaf FM |
2356 | @see SetNextHandler(), GetPreviousHandler(), |
2357 | SetPreviousHandler(), wxWindow::PushEventHandler, | |
2358 | wxWindow::PopEventHandler | |
23324ae1 | 2359 | */ |
a6052817 | 2360 | wxEvtHandler* GetNextHandler() const; |
23324ae1 FM |
2361 | |
2362 | /** | |
2363 | Gets the pointer to the previous handler in the chain. | |
3c4f71cc | 2364 | |
4cc4bfaf FM |
2365 | @see SetPreviousHandler(), GetNextHandler(), |
2366 | SetNextHandler(), wxWindow::PushEventHandler, | |
2367 | wxWindow::PopEventHandler | |
23324ae1 | 2368 | */ |
a6052817 | 2369 | wxEvtHandler* GetPreviousHandler() const; |
23324ae1 FM |
2370 | |
2371 | /** | |
2372 | Processes an event, searching event tables and calling zero or more suitable | |
2373 | event handler function(s). | |
3c4f71cc | 2374 | |
7c913512 | 2375 | @param event |
4cc4bfaf | 2376 | Event to process. |
3c4f71cc | 2377 | |
23324ae1 | 2378 | @returns @true if a suitable event handler function was found and |
4cc4bfaf | 2379 | executed, and the function did not call wxEvent::Skip. |
3c4f71cc | 2380 | |
23324ae1 | 2381 | @remarks Normally, your application would not call this function: it is |
4cc4bfaf FM |
2382 | called in the wxWidgets implementation to dispatch |
2383 | incoming user interface events to the framework (and | |
2384 | application). | |
3c4f71cc | 2385 | |
4cc4bfaf | 2386 | @see SearchEventTable() |
23324ae1 FM |
2387 | */ |
2388 | virtual bool ProcessEvent(wxEvent& event); | |
2389 | ||
2390 | /** | |
2391 | Processes an event by calling ProcessEvent() | |
2392 | and handles any exceptions that occur in the process. If an exception is | |
2393 | thrown in event handler, wxApp::OnExceptionInMainLoop | |
2394 | is called. | |
3c4f71cc | 2395 | |
7c913512 | 2396 | @param event |
4cc4bfaf | 2397 | Event to process. |
3c4f71cc | 2398 | |
23324ae1 | 2399 | @returns @true if the event was processed, @false if no handler was found |
4cc4bfaf | 2400 | or an exception was thrown. |
3c4f71cc | 2401 | |
4cc4bfaf | 2402 | @see wxWindow::HandleWindowEvent |
23324ae1 FM |
2403 | */ |
2404 | bool SafelyProcessEvent(wxEvent& event); | |
2405 | ||
2406 | /** | |
2407 | Searches the event table, executing an event handler function if an appropriate | |
2408 | one | |
2409 | is found. | |
3c4f71cc | 2410 | |
7c913512 | 2411 | @param table |
4cc4bfaf | 2412 | Event table to be searched. |
7c913512 | 2413 | @param event |
4cc4bfaf | 2414 | Event to be matched against an event table entry. |
3c4f71cc | 2415 | |
23324ae1 | 2416 | @returns @true if a suitable event handler function was found and |
4cc4bfaf | 2417 | executed, and the function did not call wxEvent::Skip. |
3c4f71cc | 2418 | |
23324ae1 | 2419 | @remarks This function looks through the object's event table and tries |
4cc4bfaf | 2420 | to find an entry that will match the event. |
3c4f71cc | 2421 | |
4cc4bfaf | 2422 | @see ProcessEvent() |
23324ae1 FM |
2423 | */ |
2424 | virtual bool SearchEventTable(wxEventTable& table, | |
2425 | wxEvent& event); | |
2426 | ||
2427 | /** | |
2428 | Sets user-supplied client data. | |
3c4f71cc | 2429 | |
7c913512 | 2430 | @param data |
4cc4bfaf | 2431 | Data to be associated with the event handler. |
3c4f71cc | 2432 | |
23324ae1 | 2433 | @remarks Normally, any extra data the programmer wishes to associate with |
4cc4bfaf FM |
2434 | the object should be made available by deriving a new |
2435 | class with new data members. You must not call this | |
2436 | method and SetClientObject on the same class - only one | |
2437 | of them. | |
3c4f71cc | 2438 | |
4cc4bfaf | 2439 | @see GetClientData() |
23324ae1 FM |
2440 | */ |
2441 | void SetClientData(void* data); | |
2442 | ||
2443 | /** | |
2444 | Set the client data object. Any previous object will be deleted. | |
3c4f71cc | 2445 | |
4cc4bfaf | 2446 | @see GetClientObject(), wxClientData |
23324ae1 FM |
2447 | */ |
2448 | void SetClientObject(wxClientData* data); | |
2449 | ||
2450 | /** | |
2451 | Enables or disables the event handler. | |
3c4f71cc | 2452 | |
7c913512 | 2453 | @param enabled |
4cc4bfaf | 2454 | @true if the event handler is to be enabled, @false if it is to be disabled. |
3c4f71cc | 2455 | |
23324ae1 | 2456 | @remarks You can use this function to avoid having to remove the event |
4cc4bfaf FM |
2457 | handler from the chain, for example when implementing a |
2458 | dialog editor and changing from edit to test mode. | |
3c4f71cc | 2459 | |
4cc4bfaf | 2460 | @see GetEvtHandlerEnabled() |
23324ae1 FM |
2461 | */ |
2462 | void SetEvtHandlerEnabled(bool enabled); | |
2463 | ||
2464 | /** | |
2465 | Sets the pointer to the next handler. | |
3c4f71cc | 2466 | |
7c913512 | 2467 | @param handler |
4cc4bfaf | 2468 | Event handler to be set as the next handler. |
3c4f71cc | 2469 | |
4cc4bfaf FM |
2470 | @see GetNextHandler(), SetPreviousHandler(), |
2471 | GetPreviousHandler(), wxWindow::PushEventHandler, | |
2472 | wxWindow::PopEventHandler | |
23324ae1 FM |
2473 | */ |
2474 | void SetNextHandler(wxEvtHandler* handler); | |
2475 | ||
2476 | /** | |
2477 | Sets the pointer to the previous handler. | |
3c4f71cc | 2478 | |
7c913512 | 2479 | @param handler |
4cc4bfaf | 2480 | Event handler to be set as the previous handler. |
23324ae1 FM |
2481 | */ |
2482 | void SetPreviousHandler(wxEvtHandler* handler); | |
2483 | }; | |
2484 | ||
2485 | ||
e54c96f1 | 2486 | |
23324ae1 FM |
2487 | /** |
2488 | @class wxIconizeEvent | |
2489 | @wxheader{event.h} | |
7c913512 | 2490 | |
23324ae1 | 2491 | An event being sent when the frame is iconized (minimized) or restored. |
7c913512 | 2492 | |
23324ae1 | 2493 | Currently only wxMSW and wxGTK generate such events. |
7c913512 | 2494 | |
23324ae1 FM |
2495 | @library{wxcore} |
2496 | @category{events} | |
7c913512 | 2497 | |
e54c96f1 | 2498 | @see @ref overview_eventhandlingoverview, wxTopLevelWindow::Iconize, |
4cc4bfaf | 2499 | wxTopLevelWindow::IsIconized |
23324ae1 FM |
2500 | */ |
2501 | class wxIconizeEvent : public wxEvent | |
2502 | { | |
2503 | public: | |
2504 | /** | |
2505 | Constructor. | |
2506 | */ | |
4cc4bfaf | 2507 | wxIconizeEvent(int id = 0, bool iconized = true); |
23324ae1 FM |
2508 | |
2509 | /** | |
2510 | Returns @true if the frame has been iconized, @false if it has been | |
2511 | restored. | |
2512 | */ | |
328f5751 | 2513 | bool Iconized() const; |
23324ae1 FM |
2514 | }; |
2515 | ||
2516 | ||
e54c96f1 | 2517 | |
23324ae1 FM |
2518 | /** |
2519 | @class wxMoveEvent | |
2520 | @wxheader{event.h} | |
7c913512 | 2521 | |
23324ae1 | 2522 | A move event holds information about move change events. |
7c913512 | 2523 | |
23324ae1 FM |
2524 | @library{wxcore} |
2525 | @category{events} | |
7c913512 | 2526 | |
e54c96f1 | 2527 | @see wxPoint, @ref overview_eventhandlingoverview |
23324ae1 FM |
2528 | */ |
2529 | class wxMoveEvent : public wxEvent | |
2530 | { | |
2531 | public: | |
2532 | /** | |
2533 | Constructor. | |
2534 | */ | |
2535 | wxMoveEvent(const wxPoint& pt, int id = 0); | |
2536 | ||
2537 | /** | |
2538 | Returns the position of the window generating the move change event. | |
2539 | */ | |
328f5751 | 2540 | wxPoint GetPosition() const; |
23324ae1 FM |
2541 | }; |
2542 | ||
2543 | ||
e54c96f1 | 2544 | |
23324ae1 FM |
2545 | /** |
2546 | @class wxEvent | |
2547 | @wxheader{event.h} | |
7c913512 | 2548 | |
23324ae1 FM |
2549 | An event is a structure holding information about an event passed to a |
2550 | callback or member function. @b wxEvent used to be a multipurpose | |
2551 | event object, and is an abstract base class for other event classes (see below). | |
7c913512 | 2552 | |
4cc4bfaf | 2553 | For more information about events, see the @ref overview_eventhandlingoverview. |
7c913512 | 2554 | |
23324ae1 FM |
2555 | @b wxPerl note: In wxPerl custom event classes should be derived from |
2556 | @c Wx::PlEvent and @c Wx::PlCommandEvent. | |
7c913512 | 2557 | |
23324ae1 FM |
2558 | @library{wxbase} |
2559 | @category{events} | |
7c913512 | 2560 | |
e54c96f1 | 2561 | @see wxCommandEvent, wxMouseEvent |
23324ae1 FM |
2562 | */ |
2563 | class wxEvent : public wxObject | |
2564 | { | |
2565 | public: | |
2566 | /** | |
2567 | Constructor. Should not need to be used directly by an application. | |
2568 | */ | |
4cc4bfaf | 2569 | wxEvent(int id = 0, wxEventType eventType = wxEVT_NULL); |
23324ae1 FM |
2570 | |
2571 | /** | |
2572 | Returns a copy of the event. | |
23324ae1 FM |
2573 | Any event that is posted to the wxWidgets event system for later action (via |
2574 | wxEvtHandler::AddPendingEvent or | |
e54c96f1 | 2575 | wxPostEvent()) must implement this method. All wxWidgets |
23324ae1 FM |
2576 | events fully implement this method, but any derived events implemented by the |
2577 | user should also implement this method just in case they (or some event | |
2578 | derived from them) are ever posted. | |
23324ae1 FM |
2579 | All wxWidgets events implement a copy constructor, so the easiest way of |
2580 | implementing the Clone function is to implement a copy constructor for | |
2581 | a new event (call it MyEvent) and then define the Clone function like this: | |
2582 | */ | |
a6052817 | 2583 | virtual wxEvent* Clone() const = 0; |
23324ae1 FM |
2584 | |
2585 | /** | |
2586 | Returns the object (usually a window) associated with the | |
2587 | event, if any. | |
2588 | */ | |
a6052817 | 2589 | wxObject* GetEventObject() const; |
23324ae1 FM |
2590 | |
2591 | /** | |
2592 | Returns the identifier of the given event type, | |
2593 | such as @c wxEVT_COMMAND_BUTTON_CLICKED. | |
2594 | */ | |
a6052817 | 2595 | wxEventType GetEventType() const; |
23324ae1 FM |
2596 | |
2597 | /** | |
2598 | Returns the identifier associated with this event, such as a button command id. | |
2599 | */ | |
328f5751 | 2600 | int GetId() const; |
23324ae1 FM |
2601 | |
2602 | /** | |
2603 | Returns @true if the event handler should be skipped, @false otherwise. | |
2604 | */ | |
328f5751 | 2605 | bool GetSkipped() const; |
23324ae1 FM |
2606 | |
2607 | /** | |
2608 | Gets the timestamp for the event. The timestamp is the time in milliseconds | |
2609 | since some fixed moment (not necessarily the standard Unix Epoch, so | |
2610 | only differences between the timestamps and not their absolute values usually | |
2611 | make sense). | |
2612 | */ | |
a6052817 | 2613 | long GetTimestamp() const; |
23324ae1 FM |
2614 | |
2615 | /** | |
2616 | Returns @true if the event is or is derived from | |
2617 | wxCommandEvent else it returns @false. | |
2618 | Note: Exists only for optimization purposes. | |
2619 | */ | |
328f5751 | 2620 | bool IsCommandEvent() const; |
23324ae1 FM |
2621 | |
2622 | /** | |
2623 | Sets the propagation level to the given value (for example returned from an | |
2624 | earlier call to wxEvent::StopPropagation). | |
2625 | */ | |
2626 | void ResumePropagation(int propagationLevel); | |
2627 | ||
2628 | /** | |
2629 | Sets the originating object. | |
2630 | */ | |
2631 | void SetEventObject(wxObject* object); | |
2632 | ||
2633 | /** | |
2634 | Sets the event type. | |
2635 | */ | |
2636 | void SetEventType(wxEventType type); | |
2637 | ||
2638 | /** | |
2639 | Sets the identifier associated with this event, such as a button command id. | |
2640 | */ | |
2641 | void SetId(int id); | |
2642 | ||
2643 | /** | |
2644 | Sets the timestamp for the event. | |
2645 | */ | |
a6052817 | 2646 | void SetTimestamp(long = 0); |
23324ae1 FM |
2647 | |
2648 | /** | |
2649 | Test if this event should be propagated or not, i.e. if the propagation level | |
2650 | is currently greater than 0. | |
2651 | */ | |
328f5751 | 2652 | bool ShouldPropagate() const; |
23324ae1 FM |
2653 | |
2654 | /** | |
2655 | This method can be used inside an event handler to control whether further | |
2656 | event handlers bound to this event will be called after the current one | |
2657 | returns. Without Skip() (or equivalently if Skip(@false) is used), | |
2658 | the event will not be processed any more. If Skip(@true) is called, the event | |
2659 | processing system continues searching for a further handler function for this | |
2660 | event, even though it has been processed already in the current handler. | |
23324ae1 FM |
2661 | In general, it is recommended to skip all non-command events to allow the |
2662 | default handling to take place. The command events are, however, normally not | |
2663 | skipped as usually a single command such as a button click or menu item | |
2664 | selection must only be processed by one handler. | |
2665 | */ | |
4cc4bfaf | 2666 | void Skip(bool skip = true); |
23324ae1 FM |
2667 | |
2668 | /** | |
2669 | Stop the event from propagating to its parent window. | |
7c913512 | 2670 | Returns the old propagation level value which may be later passed to |
23324ae1 FM |
2671 | ResumePropagation() to allow propagating the |
2672 | event again. | |
2673 | */ | |
2674 | int StopPropagation(); | |
2675 | ||
2676 | /** | |
2677 | int m_propagationLevel | |
23324ae1 FM |
2678 | Indicates how many levels the event can propagate. This member is protected and |
2679 | should typically only be set in the constructors of the derived classes. It | |
7c913512 FM |
2680 | may be temporarily changed by StopPropagation() |
2681 | and ResumePropagation() and tested with | |
23324ae1 | 2682 | ShouldPropagate(). |
23324ae1 | 2683 | The initial value is set to either @c wxEVENT_PROPAGATE_NONE (by |
7c913512 | 2684 | default) meaning that the event shouldn't be propagated at all or to |
23324ae1 FM |
2685 | @c wxEVENT_PROPAGATE_MAX (for command events) meaning that it should be |
2686 | propagated as much as necessary. | |
23324ae1 FM |
2687 | Any positive number means that the event should be propagated but no more than |
2688 | the given number of times. E.g. the propagation level may be set to 1 to | |
2689 | propagate the event to its parent only, but not to its grandparent. | |
2690 | */ | |
2691 | }; | |
2692 | ||
2693 | ||
e54c96f1 | 2694 | |
23324ae1 FM |
2695 | /** |
2696 | @class wxSizeEvent | |
2697 | @wxheader{event.h} | |
7c913512 | 2698 | |
23324ae1 | 2699 | A size event holds information about size change events. |
7c913512 | 2700 | |
23324ae1 | 2701 | The EVT_SIZE handler function will be called when the window has been resized. |
7c913512 | 2702 | |
23324ae1 FM |
2703 | You may wish to use this for frames to resize their child windows as |
2704 | appropriate. | |
7c913512 | 2705 | |
23324ae1 FM |
2706 | Note that the size passed is of |
2707 | the whole window: call wxWindow::GetClientSize for the area which may be | |
2708 | used by the application. | |
7c913512 | 2709 | |
23324ae1 FM |
2710 | When a window is resized, usually only a small part of the window is damaged |
2711 | and you | |
2712 | may only need to repaint that area. However, if your drawing depends on the | |
2713 | size of the window, | |
2714 | you may need to clear the DC explicitly and repaint the whole window. In which | |
2715 | case, you | |
2716 | may need to call wxWindow::Refresh to invalidate the entire window. | |
7c913512 | 2717 | |
23324ae1 FM |
2718 | @library{wxcore} |
2719 | @category{events} | |
7c913512 | 2720 | |
e54c96f1 | 2721 | @see wxSize, @ref overview_eventhandlingoverview |
23324ae1 FM |
2722 | */ |
2723 | class wxSizeEvent : public wxEvent | |
2724 | { | |
2725 | public: | |
2726 | /** | |
2727 | Constructor. | |
2728 | */ | |
2729 | wxSizeEvent(const wxSize& sz, int id = 0); | |
2730 | ||
2731 | /** | |
2732 | Returns the entire size of the window generating the size change event. | |
2733 | */ | |
328f5751 | 2734 | wxSize GetSize() const; |
23324ae1 FM |
2735 | }; |
2736 | ||
2737 | ||
e54c96f1 | 2738 | |
23324ae1 FM |
2739 | /** |
2740 | @class wxSetCursorEvent | |
2741 | @wxheader{event.h} | |
7c913512 | 2742 | |
23324ae1 FM |
2743 | A SetCursorEvent is generated when the mouse cursor is about to be set as a |
2744 | result of mouse motion. This event gives the application the chance to perform | |
2745 | specific mouse cursor processing based on the current position of the mouse | |
2746 | within the window. Use wxSetCursorEvent::SetCursor to | |
2747 | specify the cursor you want to be displayed. | |
7c913512 | 2748 | |
23324ae1 FM |
2749 | @library{wxcore} |
2750 | @category{FIXME} | |
7c913512 | 2751 | |
e54c96f1 | 2752 | @see ::wxSetCursor, wxWindow::wxSetCursor |
23324ae1 FM |
2753 | */ |
2754 | class wxSetCursorEvent : public wxEvent | |
2755 | { | |
2756 | public: | |
2757 | /** | |
2758 | Constructor, used by the library itself internally to initialize the event | |
2759 | object. | |
2760 | */ | |
2761 | wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0); | |
2762 | ||
2763 | /** | |
2764 | Returns a reference to the cursor specified by this event. | |
2765 | */ | |
a6052817 | 2766 | const wxCursor& GetCursor() const; |
23324ae1 FM |
2767 | |
2768 | /** | |
2769 | Returns the X coordinate of the mouse in client coordinates. | |
2770 | */ | |
328f5751 | 2771 | wxCoord GetX() const; |
23324ae1 FM |
2772 | |
2773 | /** | |
2774 | Returns the Y coordinate of the mouse in client coordinates. | |
2775 | */ | |
328f5751 | 2776 | wxCoord GetY() const; |
23324ae1 FM |
2777 | |
2778 | /** | |
2779 | Returns @true if the cursor specified by this event is a valid cursor. | |
3c4f71cc | 2780 | |
23324ae1 | 2781 | @remarks You cannot specify wxNullCursor with this event, as it is not |
4cc4bfaf | 2782 | considered a valid cursor. |
23324ae1 | 2783 | */ |
328f5751 | 2784 | bool HasCursor() const; |
23324ae1 FM |
2785 | |
2786 | /** | |
2787 | Sets the cursor associated with this event. | |
2788 | */ | |
2789 | void SetCursor(const wxCursor& cursor); | |
2790 | }; | |
e54c96f1 | 2791 | |
39fb8056 FM |
2792 | |
2793 | ||
7fa7088e BP |
2794 | // ============================================================================ |
2795 | // Global functions/macros | |
2796 | // ============================================================================ | |
2797 | ||
2798 | /** @ingroup group_funcmacro_misc */ | |
2799 | //@{ | |
2800 | ||
39fb8056 FM |
2801 | /** |
2802 | In a GUI application, this function posts @a event to the specified @e dest | |
7fa7088e BP |
2803 | object using wxEvtHandler::AddPendingEvent(). |
2804 | ||
2805 | Otherwise, it dispatches @a event immediately using | |
2806 | wxEvtHandler::ProcessEvent(). See the respective documentation for details | |
2807 | (and caveats). | |
39fb8056 | 2808 | |
7fa7088e | 2809 | @header{wx/event.h} |
39fb8056 | 2810 | */ |
3d6c68c1 | 2811 | void wxPostEvent(wxEvtHandler* dest, wxEvent& event); |
7fa7088e BP |
2812 | |
2813 | //@} | |
2814 |