]>
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 | */ | |
77 | wxKeyEvent(WXTYPE keyEventType); | |
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: | |
4cc4bfaf | 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 | |
4cc4bfaf | 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 | */ | |
328f5751 | 168 | long GetX() const; |
23324ae1 FM |
169 | |
170 | /** | |
171 | Returns the Y (in client coordinates) position of the event. | |
172 | */ | |
328f5751 | 173 | long 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 | */ | |
273 | wxJoystickEvent(WXTYPE eventType = 0, int state = 0, | |
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). | |
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. | |
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). | |
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 | */ | |
372 | wxScrollWinEvent(WXTYPE commandType = 0, int pos = 0, | |
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. | |
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. | |
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 FM |
657 | If any of these events is processed (without being skipped) by an event |
658 | handler, the corresponding operation doesn't take place which allows to prevent | |
659 | the text from being copied from or pasted to a control. It is also possible to | |
660 | examine the clipboard contents in the PASTE event handler and transform it in | |
661 | some way before inserting in a control -- for example, changing its case or | |
662 | removing invalid characters. | |
7c913512 | 663 | |
23324ae1 FM |
664 | Finally notice that a CUT event is always preceded by the COPY event which |
665 | makes it possible to only process the latter if it doesn't matter if the text | |
666 | was copied or cut. | |
7c913512 | 667 | |
23324ae1 FM |
668 | @library{wxcore} |
669 | @category{events} | |
7c913512 | 670 | |
e54c96f1 | 671 | @see wxClipboard |
23324ae1 FM |
672 | */ |
673 | class wxClipboardTextEvent : public wxCommandEvent | |
674 | { | |
675 | public: | |
676 | /** | |
677 | ||
678 | */ | |
4cc4bfaf | 679 | wxClipboardTextEvent(wxEventType commandType = wxEVT_NULL, |
23324ae1 FM |
680 | int id = 0); |
681 | }; | |
682 | ||
683 | ||
e54c96f1 | 684 | |
23324ae1 FM |
685 | /** |
686 | @class wxMouseEvent | |
687 | @wxheader{event.h} | |
7c913512 | 688 | |
23324ae1 FM |
689 | This event class contains information about the events generated by the mouse: |
690 | they include mouse buttons press and release events and mouse move events. | |
7c913512 | 691 | |
23324ae1 FM |
692 | All mouse events involving the buttons use @c wxMOUSE_BTN_LEFT for the |
693 | left mouse button, @c wxMOUSE_BTN_MIDDLE for the middle one and | |
694 | @c wxMOUSE_BTN_RIGHT for the right one. And if the system supports more | |
695 | buttons, the @c wxMOUSE_BTN_AUX1 and @c wxMOUSE_BTN_AUX2 events | |
696 | can also be generated. Note that not all mice have even a middle button so a | |
697 | portable application should avoid relying on the events from it (but the right | |
698 | button click can be emulated using the left mouse button with the control key | |
699 | under Mac platforms with a single button mouse). | |
7c913512 | 700 | |
23324ae1 FM |
701 | For the @c wxEVT_ENTER_WINDOW and @c wxEVT_LEAVE_WINDOW events |
702 | purposes, the mouse is considered to be inside the window if it is in the | |
703 | window client area and not inside one of its children. In other words, the | |
704 | parent window receives @c wxEVT_LEAVE_WINDOW event not only when the | |
705 | mouse leaves the window entirely but also when it enters one of its children. | |
7c913512 | 706 | |
23324ae1 FM |
707 | @b NB: Note that under Windows CE mouse enter and leave events are not natively |
708 | supported | |
709 | by the system but are generated by wxWidgets itself. This has several | |
710 | drawbacks: the LEAVE_WINDOW event might be received some time after the mouse | |
711 | left the window and the state variables for it may have changed during this | |
712 | time. | |
7c913512 | 713 | |
23324ae1 FM |
714 | @b NB: Note the difference between methods like |
715 | wxMouseEvent::LeftDown and | |
716 | wxMouseEvent::LeftIsDown: the former returns @true | |
717 | when the event corresponds to the left mouse button click while the latter | |
718 | returns @true if the left mouse button is currently being pressed. For | |
719 | example, when the user is dragging the mouse you can use | |
720 | wxMouseEvent::LeftIsDown to test | |
721 | whether the left mouse button is (still) depressed. Also, by convention, if | |
722 | wxMouseEvent::LeftDown returns @true, | |
723 | wxMouseEvent::LeftIsDown will also return @true in | |
724 | wxWidgets whatever the underlying GUI behaviour is (which is | |
725 | platform-dependent). The same applies, of course, to other mouse buttons as | |
726 | well. | |
7c913512 | 727 | |
23324ae1 FM |
728 | @library{wxcore} |
729 | @category{events} | |
7c913512 | 730 | |
e54c96f1 | 731 | @see wxKeyEvent::CmdDown |
23324ae1 FM |
732 | */ |
733 | class wxMouseEvent : public wxEvent | |
734 | { | |
735 | public: | |
736 | /** | |
737 | Constructor. Valid event types are: | |
738 | ||
739 | @b wxEVT_ENTER_WINDOW | |
740 | @b wxEVT_LEAVE_WINDOW | |
741 | @b wxEVT_LEFT_DOWN | |
742 | @b wxEVT_LEFT_UP | |
743 | @b wxEVT_LEFT_DCLICK | |
744 | @b wxEVT_MIDDLE_DOWN | |
745 | @b wxEVT_MIDDLE_UP | |
746 | @b wxEVT_MIDDLE_DCLICK | |
747 | @b wxEVT_RIGHT_DOWN | |
748 | @b wxEVT_RIGHT_UP | |
749 | @b wxEVT_RIGHT_DCLICK | |
750 | @b wxEVT_MOUSE_AUX1_DOWN | |
751 | @b wxEVT_MOUSE_AUX1_UP | |
752 | @b wxEVT_MOUSE_AUX1_DCLICK | |
753 | @b wxEVT_MOUSE_AUX2_DOWN | |
754 | @b wxEVT_MOUSE_AUX2_UP | |
755 | @b wxEVT_MOUSE_AUX2_DCLICK | |
756 | @b wxEVT_MOTION | |
757 | @b wxEVT_MOUSEWHEEL | |
758 | */ | |
759 | wxMouseEvent(WXTYPE mouseEventType = 0); | |
760 | ||
761 | /** | |
762 | Returns @true if the Alt key was down at the time of the event. | |
763 | */ | |
764 | bool AltDown(); | |
765 | ||
766 | /** | |
767 | Returns @true if the event was a first extra button double click. | |
768 | */ | |
328f5751 | 769 | bool Aux1DClick() const; |
23324ae1 FM |
770 | |
771 | /** | |
772 | Returns @true if the first extra button mouse button changed to down. | |
773 | */ | |
328f5751 | 774 | bool Aux1Down() const; |
23324ae1 FM |
775 | |
776 | /** | |
777 | Returns @true if the first extra button mouse button is currently down, | |
778 | independent | |
779 | of the current event type. | |
780 | */ | |
328f5751 | 781 | bool Aux1IsDown() const; |
23324ae1 FM |
782 | |
783 | /** | |
784 | Returns @true if the first extra button mouse button changed to up. | |
785 | */ | |
328f5751 | 786 | bool Aux1Up() const; |
23324ae1 FM |
787 | |
788 | /** | |
789 | Returns @true if the event was a second extra button double click. | |
790 | */ | |
328f5751 | 791 | bool Aux2DClick() const; |
23324ae1 FM |
792 | |
793 | /** | |
794 | Returns @true if the second extra button mouse button changed to down. | |
795 | */ | |
328f5751 | 796 | bool Aux2Down() const; |
23324ae1 FM |
797 | |
798 | /** | |
799 | Returns @true if the second extra button mouse button is currently down, | |
800 | independent | |
801 | of the current event type. | |
802 | */ | |
328f5751 | 803 | bool Aux2IsDown() const; |
23324ae1 FM |
804 | |
805 | /** | |
806 | Returns @true if the second extra button mouse button changed to up. | |
807 | */ | |
328f5751 | 808 | bool Aux2Up() const; |
23324ae1 FM |
809 | |
810 | /** | |
811 | Returns @true if the identified mouse button is changing state. Valid | |
4cc4bfaf | 812 | values of @a button are: |
23324ae1 FM |
813 | |
814 | @c wxMOUSE_BTN_LEFT | |
815 | ||
23324ae1 FM |
816 | check if left button was pressed |
817 | ||
818 | @c wxMOUSE_BTN_MIDDLE | |
819 | ||
23324ae1 FM |
820 | check if middle button was pressed |
821 | ||
822 | @c wxMOUSE_BTN_RIGHT | |
823 | ||
23324ae1 FM |
824 | check if right button was pressed |
825 | ||
826 | @c wxMOUSE_BTN_AUX1 | |
827 | ||
23324ae1 FM |
828 | check if the first extra button was pressed |
829 | ||
830 | @c wxMOUSE_BTN_AUX2 | |
831 | ||
23324ae1 FM |
832 | check if the second extra button was pressed |
833 | ||
834 | @c wxMOUSE_BTN_ANY | |
835 | ||
23324ae1 FM |
836 | check if any button was pressed |
837 | */ | |
838 | bool Button(int button); | |
839 | ||
840 | /** | |
841 | If the argument is omitted, this returns @true if the event was a mouse | |
842 | double click event. Otherwise the argument specifies which double click event | |
843 | was generated (see Button() for the possible | |
844 | values). | |
845 | */ | |
846 | bool ButtonDClick(int but = wxMOUSE_BTN_ANY); | |
847 | ||
848 | /** | |
849 | If the argument is omitted, this returns @true if the event was a mouse | |
850 | button down event. Otherwise the argument specifies which button-down event | |
851 | was generated (see Button() for the possible | |
852 | values). | |
853 | */ | |
854 | bool ButtonDown(int but = -1); | |
855 | ||
856 | /** | |
857 | If the argument is omitted, this returns @true if the event was a mouse | |
858 | button up event. Otherwise the argument specifies which button-up event | |
859 | was generated (see Button() for the possible | |
860 | values). | |
861 | */ | |
862 | bool ButtonUp(int but = -1); | |
863 | ||
864 | /** | |
7c913512 | 865 | Same as MetaDown() under Mac, same as |
23324ae1 FM |
866 | ControlDown() elsewhere. |
867 | ||
4cc4bfaf | 868 | @see wxKeyEvent::CmdDown |
23324ae1 | 869 | */ |
328f5751 | 870 | bool CmdDown() const; |
23324ae1 FM |
871 | |
872 | /** | |
873 | Returns @true if the control key was down at the time of the event. | |
874 | */ | |
875 | bool ControlDown(); | |
876 | ||
877 | /** | |
878 | Returns @true if this was a dragging event (motion while a button is depressed). | |
879 | ||
4cc4bfaf | 880 | @see Moving() |
23324ae1 FM |
881 | */ |
882 | bool Dragging(); | |
883 | ||
884 | /** | |
885 | Returns @true if the mouse was entering the window. | |
23324ae1 FM |
886 | See also Leaving(). |
887 | */ | |
888 | bool Entering(); | |
889 | ||
890 | /** | |
7c913512 | 891 | Returns the mouse button which generated this event or @c wxMOUSE_BTN_NONE |
23324ae1 FM |
892 | if no button is involved (for mouse move, enter or leave event, for example). |
893 | Otherwise @c wxMOUSE_BTN_LEFT is returned for the left button down, up and | |
7c913512 | 894 | double click events, @c wxMOUSE_BTN_MIDDLE and @c wxMOUSE_BTN_RIGHT |
23324ae1 FM |
895 | for the same events for the middle and the right buttons respectively. |
896 | */ | |
328f5751 | 897 | int GetButton() const; |
23324ae1 FM |
898 | |
899 | /** | |
900 | Returns the number of mouse clicks for this event: 1 for a simple click, 2 | |
901 | for a double-click, 3 for a triple-click and so on. | |
23324ae1 FM |
902 | Currently this function is implemented only in wxMac and returns -1 for the |
903 | other platforms (you can still distinguish simple clicks from double-clicks as | |
904 | they generate different kinds of events however). | |
e54c96f1 FM |
905 | |
906 | @wxsince{2.9.0} | |
23324ae1 | 907 | */ |
328f5751 | 908 | int GetClickCount() const; |
23324ae1 FM |
909 | |
910 | /** | |
911 | Returns the configured number of lines (or whatever) to be scrolled per | |
912 | wheel action. Defaults to three. | |
913 | */ | |
328f5751 | 914 | int GetLinesPerAction() const; |
23324ae1 FM |
915 | |
916 | /** | |
917 | Returns the logical mouse position in pixels (i.e. translated according to the | |
918 | translation set for the DC, which usually indicates that the window has been | |
919 | scrolled). | |
920 | */ | |
328f5751 | 921 | wxPoint GetLogicalPosition(const wxDC& dc) const; |
23324ae1 FM |
922 | |
923 | //@{ | |
924 | /** | |
925 | Sets *x and *y to the position at which the event occurred. | |
23324ae1 | 926 | Returns the physical mouse position in pixels. |
23324ae1 FM |
927 | Note that if the mouse event has been artificially generated from a special |
928 | keyboard combination (e.g. under Windows when the "menu'' key is pressed), the | |
929 | returned position is @c wxDefaultPosition. | |
930 | */ | |
328f5751 FM |
931 | wxPoint GetPosition() const; |
932 | const void GetPosition(wxCoord* x, wxCoord* y) const; | |
933 | const void GetPosition(long* x, long* y) const; | |
23324ae1 FM |
934 | //@} |
935 | ||
936 | /** | |
937 | Get wheel delta, normally 120. This is the threshold for action to be | |
938 | taken, and one such action (for example, scrolling one increment) | |
939 | should occur for each delta. | |
940 | */ | |
328f5751 | 941 | int GetWheelDelta() const; |
23324ae1 FM |
942 | |
943 | /** | |
944 | Get wheel rotation, positive or negative indicates direction of | |
945 | rotation. Current devices all send an event when rotation is at least | |
946 | +/-WheelDelta, but finer resolution devices can be created in the future. | |
947 | Because of this you shouldn't assume that one event is equal to 1 line, but you | |
948 | should be able to either do partial line scrolling or wait until several | |
949 | events accumulate before scrolling. | |
950 | */ | |
328f5751 | 951 | int GetWheelRotation() const; |
23324ae1 FM |
952 | |
953 | /** | |
954 | Returns X coordinate of the physical mouse event position. | |
955 | */ | |
328f5751 | 956 | long GetX() const; |
23324ae1 FM |
957 | |
958 | /** | |
959 | Returns Y coordinate of the physical mouse event position. | |
960 | */ | |
4cc4bfaf | 961 | long GetY(); |
23324ae1 FM |
962 | |
963 | /** | |
964 | Returns @true if the event was a mouse button event (not necessarily a button | |
965 | down event - | |
966 | that may be tested using @e ButtonDown). | |
967 | */ | |
328f5751 | 968 | bool IsButton() const; |
23324ae1 FM |
969 | |
970 | /** | |
971 | Returns @true if the system has been setup to do page scrolling with | |
972 | the mouse wheel instead of line scrolling. | |
973 | */ | |
328f5751 | 974 | bool IsPageScroll() const; |
23324ae1 FM |
975 | |
976 | /** | |
977 | Returns @true if the mouse was leaving the window. | |
23324ae1 FM |
978 | See also Entering(). |
979 | */ | |
328f5751 | 980 | bool Leaving() const; |
23324ae1 FM |
981 | |
982 | /** | |
983 | Returns @true if the event was a left double click. | |
984 | */ | |
328f5751 | 985 | bool LeftDClick() const; |
23324ae1 FM |
986 | |
987 | /** | |
988 | Returns @true if the left mouse button changed to down. | |
989 | */ | |
328f5751 | 990 | bool LeftDown() const; |
23324ae1 FM |
991 | |
992 | /** | |
993 | Returns @true if the left mouse button is currently down, independent | |
994 | of the current event type. | |
7c913512 | 995 | Please notice that it is not the same as |
23324ae1 FM |
996 | LeftDown() which returns @true if the event was |
997 | generated by the left mouse button being pressed. Rather, it simply describes | |
998 | the state of the left mouse button at the time when the event was generated | |
999 | (so while it will be @true for a left click event, it can also be @true for | |
1000 | a right click if it happened while the left mouse button was pressed). | |
23324ae1 FM |
1001 | This event is usually used in the mouse event handlers which process "move |
1002 | mouse" messages to determine whether the user is (still) dragging the mouse. | |
1003 | */ | |
328f5751 | 1004 | bool LeftIsDown() const; |
23324ae1 FM |
1005 | |
1006 | /** | |
1007 | Returns @true if the left mouse button changed to up. | |
1008 | */ | |
328f5751 | 1009 | bool LeftUp() const; |
23324ae1 FM |
1010 | |
1011 | /** | |
1012 | Returns @true if the Meta key was down at the time of the event. | |
1013 | */ | |
328f5751 | 1014 | bool MetaDown() const; |
23324ae1 FM |
1015 | |
1016 | /** | |
1017 | Returns @true if the event was a middle double click. | |
1018 | */ | |
328f5751 | 1019 | bool MiddleDClick() const; |
23324ae1 FM |
1020 | |
1021 | /** | |
1022 | Returns @true if the middle mouse button changed to down. | |
1023 | */ | |
328f5751 | 1024 | bool MiddleDown() const; |
23324ae1 FM |
1025 | |
1026 | /** | |
1027 | Returns @true if the middle mouse button is currently down, independent | |
1028 | of the current event type. | |
1029 | */ | |
328f5751 | 1030 | bool MiddleIsDown() const; |
23324ae1 FM |
1031 | |
1032 | /** | |
1033 | Returns @true if the middle mouse button changed to up. | |
1034 | */ | |
328f5751 | 1035 | bool MiddleUp() const; |
23324ae1 FM |
1036 | |
1037 | /** | |
7c913512 FM |
1038 | Returns @true if this was a motion event and no mouse buttons were pressed. |
1039 | If any mouse button is held pressed, then this method returns @false and | |
23324ae1 FM |
1040 | Dragging() returns @true. |
1041 | */ | |
328f5751 | 1042 | bool Moving() const; |
23324ae1 FM |
1043 | |
1044 | /** | |
1045 | Returns @true if the event was a right double click. | |
1046 | */ | |
328f5751 | 1047 | bool RightDClick() const; |
23324ae1 FM |
1048 | |
1049 | /** | |
1050 | Returns @true if the right mouse button changed to down. | |
1051 | */ | |
328f5751 | 1052 | bool RightDown() const; |
23324ae1 FM |
1053 | |
1054 | /** | |
1055 | Returns @true if the right mouse button is currently down, independent | |
1056 | of the current event type. | |
1057 | */ | |
328f5751 | 1058 | bool RightIsDown() const; |
23324ae1 FM |
1059 | |
1060 | /** | |
1061 | Returns @true if the right mouse button changed to up. | |
1062 | */ | |
328f5751 | 1063 | bool RightUp() const; |
23324ae1 FM |
1064 | |
1065 | /** | |
1066 | Returns @true if the shift key was down at the time of the event. | |
1067 | */ | |
328f5751 | 1068 | bool ShiftDown() const; |
23324ae1 FM |
1069 | |
1070 | /** | |
1071 | bool m_altDown | |
23324ae1 FM |
1072 | @true if the Alt key is pressed down. |
1073 | */ | |
1074 | ||
1075 | ||
1076 | /** | |
1077 | bool m_controlDown | |
23324ae1 FM |
1078 | @true if control key is pressed down. |
1079 | */ | |
1080 | ||
1081 | ||
1082 | /** | |
1083 | bool m_leftDown | |
23324ae1 FM |
1084 | @true if the left mouse button is currently pressed down. |
1085 | */ | |
1086 | ||
1087 | ||
1088 | /** | |
1089 | int m_linesPerAction | |
23324ae1 FM |
1090 | The configured number of lines (or whatever) to be scrolled per wheel |
1091 | action. | |
1092 | */ | |
1093 | ||
1094 | ||
1095 | /** | |
1096 | bool m_metaDown | |
23324ae1 FM |
1097 | @true if the Meta key is pressed down. |
1098 | */ | |
1099 | ||
1100 | ||
1101 | /** | |
1102 | bool m_middleDown | |
23324ae1 FM |
1103 | @true if the middle mouse button is currently pressed down. |
1104 | */ | |
1105 | ||
1106 | ||
1107 | /** | |
1108 | bool m_rightDown | |
23324ae1 FM |
1109 | @true if the right mouse button is currently pressed down. |
1110 | */ | |
1111 | ||
1112 | ||
1113 | /** | |
1114 | bool m_shiftDown | |
23324ae1 FM |
1115 | @true if shift is pressed down. |
1116 | */ | |
1117 | ||
1118 | ||
1119 | /** | |
1120 | int m_wheelDelta | |
23324ae1 FM |
1121 | The wheel delta, normally 120. |
1122 | */ | |
1123 | ||
1124 | ||
1125 | /** | |
1126 | int m_wheelRotation | |
23324ae1 FM |
1127 | The distance the mouse wheel is rotated. |
1128 | */ | |
1129 | ||
1130 | ||
1131 | /** | |
1132 | long m_x | |
23324ae1 FM |
1133 | X-coordinate of the event. |
1134 | */ | |
1135 | ||
1136 | ||
1137 | /** | |
1138 | long m_y | |
23324ae1 FM |
1139 | Y-coordinate of the event. |
1140 | */ | |
1141 | }; | |
1142 | ||
1143 | ||
e54c96f1 | 1144 | |
23324ae1 FM |
1145 | /** |
1146 | @class wxDropFilesEvent | |
1147 | @wxheader{event.h} | |
7c913512 | 1148 | |
23324ae1 FM |
1149 | This class is used for drop files events, that is, when files have been dropped |
1150 | onto the window. This functionality is currently only available under Windows. | |
7c913512 | 1151 | The window must have previously been enabled for dropping by calling |
23324ae1 | 1152 | wxWindow::DragAcceptFiles. |
7c913512 | 1153 | |
23324ae1 | 1154 | Important note: this is a separate implementation to the more general |
e54c96f1 | 1155 | drag and drop implementation documented here(). It uses the |
23324ae1 | 1156 | older, Windows message-based approach of dropping files. |
7c913512 | 1157 | |
23324ae1 FM |
1158 | @library{wxcore} |
1159 | @category{events} | |
7c913512 | 1160 | |
e54c96f1 | 1161 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1162 | */ |
1163 | class wxDropFilesEvent : public wxEvent | |
1164 | { | |
1165 | public: | |
1166 | /** | |
1167 | Constructor. | |
1168 | */ | |
1169 | wxDropFilesEvent(WXTYPE id = 0, int noFiles = 0, | |
4cc4bfaf | 1170 | wxString* files = NULL); |
23324ae1 FM |
1171 | |
1172 | /** | |
1173 | Returns an array of filenames. | |
1174 | */ | |
328f5751 | 1175 | wxString* GetFiles() const; |
23324ae1 FM |
1176 | |
1177 | /** | |
1178 | Returns the number of files dropped. | |
1179 | */ | |
328f5751 | 1180 | int GetNumberOfFiles() const; |
23324ae1 FM |
1181 | |
1182 | /** | |
1183 | Returns the position at which the files were dropped. | |
23324ae1 FM |
1184 | Returns an array of filenames. |
1185 | */ | |
328f5751 | 1186 | wxPoint GetPosition() const; |
23324ae1 FM |
1187 | |
1188 | /** | |
1189 | wxString* m_files | |
23324ae1 FM |
1190 | An array of filenames. |
1191 | */ | |
1192 | ||
1193 | ||
1194 | /** | |
1195 | int m_noFiles | |
23324ae1 FM |
1196 | The number of files dropped. |
1197 | */ | |
1198 | ||
1199 | ||
1200 | /** | |
1201 | wxPoint m_pos | |
23324ae1 FM |
1202 | The point at which the drop took place. |
1203 | */ | |
1204 | }; | |
1205 | ||
1206 | ||
e54c96f1 | 1207 | |
23324ae1 FM |
1208 | /** |
1209 | @class wxCommandEvent | |
1210 | @wxheader{event.h} | |
7c913512 | 1211 | |
23324ae1 FM |
1212 | This event class contains information about command events, which originate |
1213 | from a variety of | |
1214 | simple controls. More complex controls, such as wxTreeCtrl, have separate | |
1215 | command event classes. | |
7c913512 | 1216 | |
23324ae1 FM |
1217 | @library{wxcore} |
1218 | @category{events} | |
1219 | */ | |
1220 | class wxCommandEvent : public wxEvent | |
1221 | { | |
1222 | public: | |
1223 | /** | |
1224 | Constructor. | |
1225 | */ | |
1226 | wxCommandEvent(WXTYPE commandEventType = 0, int id = 0); | |
1227 | ||
1228 | /** | |
1229 | Deprecated, use IsChecked() instead. | |
1230 | */ | |
328f5751 | 1231 | bool Checked() const; |
23324ae1 FM |
1232 | |
1233 | /** | |
1234 | Returns client data pointer for a listbox or choice selection event | |
1235 | (not valid for a deselection). | |
1236 | */ | |
1237 | void* GetClientData(); | |
1238 | ||
1239 | /** | |
1240 | Returns client object pointer for a listbox or choice selection event | |
1241 | (not valid for a deselection). | |
1242 | */ | |
4cc4bfaf | 1243 | wxClientData* GetClientObject(); |
23324ae1 FM |
1244 | |
1245 | /** | |
1246 | Returns extra information dependant on the event objects type. | |
1247 | If the event comes from a listbox selection, it is a boolean | |
1248 | determining whether the event was a selection (@true) or a | |
1249 | deselection (@false). A listbox deselection only occurs for | |
1250 | multiple-selection boxes, and in this case the index and string values | |
1251 | are indeterminate and the listbox must be examined by the application. | |
1252 | */ | |
1253 | long GetExtraLong(); | |
1254 | ||
1255 | /** | |
1256 | Returns the integer identifier corresponding to a listbox, choice or | |
1257 | radiobox selection (only if the event was a selection, not a | |
1258 | deselection), or a boolean value representing the value of a checkbox. | |
1259 | */ | |
1260 | int GetInt(); | |
1261 | ||
1262 | /** | |
1263 | Returns item index for a listbox or choice selection event (not valid for | |
1264 | a deselection). | |
1265 | */ | |
1266 | int GetSelection(); | |
1267 | ||
1268 | /** | |
1269 | Returns item string for a listbox or choice selection event (not valid for | |
1270 | a deselection). | |
1271 | */ | |
1272 | wxString GetString(); | |
1273 | ||
1274 | /** | |
1275 | This method can be used with checkbox and menu events: for the checkboxes, the | |
1276 | method returns @true for a selection event and @false for a | |
1277 | deselection one. For the menu events, this method indicates if the menu item | |
1278 | just has become checked or unchecked (and thus only makes sense for checkable | |
1279 | menu items). | |
7c913512 | 1280 | Notice that this method can not be used with |
23324ae1 FM |
1281 | wxCheckListBox currently. |
1282 | */ | |
328f5751 | 1283 | bool IsChecked() const; |
23324ae1 FM |
1284 | |
1285 | /** | |
1286 | For a listbox or similar event, returns @true if it is a selection, @false if it | |
1287 | is a deselection. | |
1288 | */ | |
1289 | bool IsSelection(); | |
1290 | ||
1291 | /** | |
1292 | Sets the client data for this event. | |
1293 | */ | |
1294 | void SetClientData(void* clientData); | |
1295 | ||
1296 | /** | |
1297 | Sets the client object for this event. The client object is not owned by the | |
1298 | event | |
1299 | object and the event object will not delete the client object in its destructor. | |
1300 | The client object must be owned and deleted by another object (e.g. a control) | |
1301 | that has longer life time than the event object. | |
1302 | */ | |
1303 | void SetClientObject(wxClientData* clientObject); | |
1304 | ||
1305 | /** | |
1306 | Sets the @b m_extraLong member. | |
1307 | */ | |
1308 | void SetExtraLong(long extraLong); | |
1309 | ||
1310 | /** | |
1311 | Sets the @b m_commandInt member. | |
1312 | */ | |
1313 | void SetInt(int intCommand); | |
1314 | ||
1315 | /** | |
1316 | Sets the @b m_commandString member. | |
1317 | */ | |
1318 | void SetString(const wxString& string); | |
1319 | }; | |
1320 | ||
1321 | ||
e54c96f1 | 1322 | |
23324ae1 FM |
1323 | /** |
1324 | @class wxActivateEvent | |
1325 | @wxheader{event.h} | |
7c913512 | 1326 | |
23324ae1 FM |
1327 | An activate event is sent when a window or application is being activated |
1328 | or deactivated. | |
7c913512 | 1329 | |
23324ae1 FM |
1330 | @library{wxcore} |
1331 | @category{events} | |
7c913512 | 1332 | |
e54c96f1 | 1333 | @see @ref overview_eventhandlingoverview, wxApp::IsActive |
23324ae1 FM |
1334 | */ |
1335 | class wxActivateEvent : public wxEvent | |
1336 | { | |
1337 | public: | |
1338 | /** | |
1339 | Constructor. | |
1340 | */ | |
4cc4bfaf | 1341 | wxActivateEvent(WXTYPE eventType = 0, bool active = true, |
23324ae1 FM |
1342 | int id = 0); |
1343 | ||
1344 | /** | |
1345 | Returns @true if the application or window is being activated, @false otherwise. | |
1346 | */ | |
328f5751 | 1347 | bool GetActive() const; |
23324ae1 FM |
1348 | }; |
1349 | ||
1350 | ||
e54c96f1 | 1351 | |
23324ae1 FM |
1352 | /** |
1353 | @class wxContextMenuEvent | |
1354 | @wxheader{event.h} | |
7c913512 | 1355 | |
23324ae1 FM |
1356 | This class is used for context menu events, sent to give |
1357 | the application a chance to show a context (popup) menu. | |
7c913512 | 1358 | |
23324ae1 FM |
1359 | Note that if wxContextMenuEvent::GetPosition returns wxDefaultPosition, this |
1360 | means that the event originated | |
1361 | from a keyboard context button event, and you should compute a suitable | |
1362 | position yourself, | |
e54c96f1 | 1363 | for example by calling wxGetMousePosition(). |
7c913512 | 1364 | |
23324ae1 FM |
1365 | When a keyboard context menu button is pressed on Windows, a right-click event |
1366 | with default position is sent first, | |
1367 | and if this event is not processed, the context menu event is sent. So if you | |
1368 | process mouse events and you find your context menu event handler | |
1369 | is not being called, you could call wxEvent::Skip for mouse right-down events. | |
7c913512 | 1370 | |
23324ae1 FM |
1371 | @library{wxcore} |
1372 | @category{events} | |
7c913512 | 1373 | |
e54c96f1 | 1374 | @see @ref overview_wxcommandevent "Command events", @ref |
4cc4bfaf | 1375 | overview_eventhandlingoverview |
23324ae1 FM |
1376 | */ |
1377 | class wxContextMenuEvent : public wxCommandEvent | |
1378 | { | |
1379 | public: | |
1380 | /** | |
1381 | Constructor. | |
1382 | */ | |
1383 | wxContextMenuEvent(WXTYPE id = 0, int id = 0, | |
4cc4bfaf | 1384 | const wxPoint& pos = wxDefaultPosition); |
23324ae1 FM |
1385 | |
1386 | /** | |
1387 | Returns the position in screen coordinates at which the menu should be shown. | |
1388 | Use wxWindow::ScreenToClient to | |
1389 | convert to client coordinates. You can also omit a position from | |
1390 | wxWindow::PopupMenu in order to use | |
1391 | the current mouse pointer position. | |
23324ae1 FM |
1392 | If the event originated from a keyboard event, the value returned from this |
1393 | function will be wxDefaultPosition. | |
1394 | */ | |
328f5751 | 1395 | wxPoint GetPosition() const; |
23324ae1 FM |
1396 | |
1397 | /** | |
1398 | Sets the position at which the menu should be shown. | |
1399 | */ | |
1400 | void SetPosition(const wxPoint& point); | |
1401 | }; | |
1402 | ||
1403 | ||
e54c96f1 | 1404 | |
23324ae1 FM |
1405 | /** |
1406 | @class wxEraseEvent | |
1407 | @wxheader{event.h} | |
7c913512 | 1408 | |
23324ae1 | 1409 | An erase event is sent when a window's background needs to be repainted. |
7c913512 | 1410 | |
23324ae1 FM |
1411 | On some platforms, such as GTK+, this event is simulated (simply generated just |
1412 | before the | |
1413 | paint event) and may cause flicker. It is therefore recommended that | |
1414 | you set the text background colour explicitly in order to prevent flicker. | |
1415 | The default background colour under GTK+ is grey. | |
7c913512 | 1416 | |
23324ae1 FM |
1417 | To intercept this event, use the EVT_ERASE_BACKGROUND macro in an event table |
1418 | definition. | |
7c913512 | 1419 | |
23324ae1 FM |
1420 | You must call wxEraseEvent::GetDC and use the returned device context if it is |
1421 | non-@NULL. | |
7c913512 FM |
1422 | If it is @NULL, create your own temporary wxClientDC object. |
1423 | ||
23324ae1 FM |
1424 | @library{wxcore} |
1425 | @category{events} | |
7c913512 | 1426 | |
e54c96f1 | 1427 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1428 | */ |
1429 | class wxEraseEvent : public wxEvent | |
1430 | { | |
1431 | public: | |
1432 | /** | |
1433 | Constructor. | |
1434 | */ | |
4cc4bfaf | 1435 | wxEraseEvent(int id = 0, wxDC* dc = NULL); |
23324ae1 FM |
1436 | |
1437 | /** | |
1438 | Returns the device context associated with the erase event to draw on. | |
1439 | */ | |
328f5751 | 1440 | wxDC* GetDC() const; |
23324ae1 FM |
1441 | }; |
1442 | ||
1443 | ||
e54c96f1 | 1444 | |
23324ae1 FM |
1445 | /** |
1446 | @class wxFocusEvent | |
1447 | @wxheader{event.h} | |
7c913512 | 1448 | |
23324ae1 FM |
1449 | A focus event is sent when a window's focus changes. The window losing focus |
1450 | receives a "kill focus'' event while the window gaining it gets a "set | |
1451 | focus'' one. | |
7c913512 | 1452 | |
23324ae1 FM |
1453 | Notice that the set focus event happens both when the user gives focus to the |
1454 | window (whether using the mouse or keyboard) and when it is done from the | |
1455 | program itself using wxWindow::SetFocus. | |
7c913512 | 1456 | |
23324ae1 FM |
1457 | @library{wxcore} |
1458 | @category{events} | |
7c913512 | 1459 | |
e54c96f1 | 1460 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1461 | */ |
1462 | class wxFocusEvent : public wxEvent | |
1463 | { | |
1464 | public: | |
1465 | /** | |
1466 | Constructor. | |
1467 | */ | |
1468 | wxFocusEvent(WXTYPE eventType = 0, int id = 0); | |
1469 | ||
1470 | /** | |
1471 | Returns the window associated with this event, that is the window which had the | |
1472 | focus before for the @c wxEVT_SET_FOCUS event and the window which is | |
1473 | going to receive focus for the @c wxEVT_KILL_FOCUS one. | |
23324ae1 FM |
1474 | Warning: the window pointer may be @NULL! |
1475 | */ | |
1476 | }; | |
1477 | ||
1478 | ||
e54c96f1 | 1479 | |
23324ae1 FM |
1480 | /** |
1481 | @class wxChildFocusEvent | |
1482 | @wxheader{event.h} | |
7c913512 | 1483 | |
23324ae1 FM |
1484 | A child focus event is sent to a (parent-)window when one of its child windows |
1485 | gains focus, | |
1486 | so that the window could restore the focus back to its corresponding child | |
1487 | if it loses it now and regains later. | |
7c913512 | 1488 | |
23324ae1 | 1489 | Notice that child window is the direct child of the window receiving event. |
7c913512 FM |
1490 | Use wxWindow::FindFocus to retreive the window which is actually getting focus. |
1491 | ||
23324ae1 FM |
1492 | @library{wxcore} |
1493 | @category{events} | |
7c913512 | 1494 | |
e54c96f1 | 1495 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1496 | */ |
1497 | class wxChildFocusEvent : public wxCommandEvent | |
1498 | { | |
1499 | public: | |
1500 | /** | |
1501 | Constructor. | |
1502 | ||
7c913512 | 1503 | @param win |
4cc4bfaf FM |
1504 | The direct child which is (or which contains the window which is) receiving |
1505 | the focus. | |
23324ae1 | 1506 | */ |
4cc4bfaf | 1507 | wxChildFocusEvent(wxWindow* win = NULL); |
23324ae1 FM |
1508 | |
1509 | /** | |
1510 | Returns the direct child which receives the focus, or a (grand-)parent of the | |
1511 | control receiving the focus. | |
23324ae1 FM |
1512 | To get the actually focused control use wxWindow::FindFocus. |
1513 | */ | |
1514 | }; | |
1515 | ||
1516 | ||
e54c96f1 | 1517 | |
23324ae1 FM |
1518 | /** |
1519 | @class wxMouseCaptureLostEvent | |
1520 | @wxheader{event.h} | |
7c913512 | 1521 | |
23324ae1 FM |
1522 | An mouse capture lost event is sent to a window that obtained mouse capture, |
1523 | which was subsequently loss due to "external" event, for example when a dialog | |
1524 | box is shown or if another application captures the mouse. | |
7c913512 | 1525 | |
23324ae1 FM |
1526 | If this happens, this event is sent to all windows that are on capture stack |
1527 | (i.e. called CaptureMouse, but didn't call ReleaseMouse yet). The event is | |
1528 | not sent if the capture changes because of a call to CaptureMouse or | |
1529 | ReleaseMouse. | |
7c913512 | 1530 | |
23324ae1 | 1531 | This event is currently emitted under Windows only. |
7c913512 | 1532 | |
23324ae1 FM |
1533 | @library{wxcore} |
1534 | @category{events} | |
7c913512 | 1535 | |
e54c96f1 | 1536 | @see wxMouseCaptureChangedEvent, @ref overview_eventhandlingoverview, |
4cc4bfaf | 1537 | wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture |
23324ae1 FM |
1538 | */ |
1539 | class wxMouseCaptureLostEvent : public wxEvent | |
1540 | { | |
1541 | public: | |
1542 | /** | |
1543 | Constructor. | |
1544 | */ | |
1545 | wxMouseCaptureLostEvent(wxWindowID windowId = 0); | |
1546 | }; | |
1547 | ||
1548 | ||
e54c96f1 | 1549 | |
23324ae1 FM |
1550 | /** |
1551 | @class wxNotifyEvent | |
1552 | @wxheader{event.h} | |
7c913512 | 1553 | |
23324ae1 FM |
1554 | This class is not used by the event handlers by itself, but is a base class |
1555 | for other event classes (such as wxNotebookEvent). | |
7c913512 | 1556 | |
23324ae1 FM |
1557 | It (or an object of a derived class) is sent when the controls state is being |
1558 | changed and allows the program to wxNotifyEvent::Veto this | |
1559 | change if it wants to prevent it from happening. | |
7c913512 | 1560 | |
23324ae1 FM |
1561 | @library{wxcore} |
1562 | @category{events} | |
7c913512 | 1563 | |
e54c96f1 | 1564 | @see wxNotebookEvent |
23324ae1 FM |
1565 | */ |
1566 | class wxNotifyEvent : public wxCommandEvent | |
1567 | { | |
1568 | public: | |
1569 | /** | |
1570 | Constructor (used internally by wxWidgets only). | |
1571 | */ | |
4cc4bfaf | 1572 | wxNotifyEvent(wxEventType eventType = wxEVT_NULL, int id = 0); |
23324ae1 FM |
1573 | |
1574 | /** | |
1575 | This is the opposite of Veto(): it explicitly | |
1576 | allows the event to be processed. For most events it is not necessary to call | |
1577 | this method as the events are allowed anyhow but some are forbidden by default | |
1578 | (this will be mentioned in the corresponding event description). | |
1579 | */ | |
1580 | void Allow(); | |
1581 | ||
1582 | /** | |
7c913512 | 1583 | Returns @true if the change is allowed (Veto() |
23324ae1 FM |
1584 | hasn't been called) or @false otherwise (if it was). |
1585 | */ | |
328f5751 | 1586 | bool IsAllowed() const; |
23324ae1 FM |
1587 | |
1588 | /** | |
1589 | Prevents the change announced by this event from happening. | |
23324ae1 FM |
1590 | It is in general a good idea to notify the user about the reasons for vetoing |
1591 | the change because otherwise the applications behaviour (which just refuses to | |
1592 | do what the user wants) might be quite surprising. | |
1593 | */ | |
1594 | void Veto(); | |
1595 | }; | |
1596 | ||
1597 | ||
e54c96f1 | 1598 | |
23324ae1 FM |
1599 | /** |
1600 | @class wxHelpEvent | |
1601 | @wxheader{event.h} | |
7c913512 | 1602 | |
23324ae1 FM |
1603 | A help event is sent when the user has requested context-sensitive help. |
1604 | This can either be caused by the application requesting | |
1605 | context-sensitive help mode via wxContextHelp, or | |
1606 | (on MS Windows) by the system generating a WM_HELP message when the user | |
1607 | pressed F1 or clicked | |
1608 | on the query button in a dialog caption. | |
7c913512 | 1609 | |
23324ae1 FM |
1610 | A help event is sent to the window that the user clicked on, and is propagated |
1611 | up the | |
1612 | window hierarchy until the event is processed or there are no more event | |
1613 | handlers. | |
1614 | The application should call wxEvent::GetId to check the identity of the | |
1615 | clicked-on window, | |
1616 | and then either show some suitable help or call wxEvent::Skip if the identifier | |
1617 | is unrecognised. | |
1618 | Calling Skip is important because it allows wxWidgets to generate further | |
1619 | events for ancestors | |
1620 | of the clicked-on window. Otherwise it would be impossible to show help for | |
1621 | container windows, | |
1622 | since processing would stop after the first window found. | |
7c913512 | 1623 | |
23324ae1 FM |
1624 | @library{wxcore} |
1625 | @category{FIXME} | |
7c913512 | 1626 | |
e54c96f1 | 1627 | @see wxContextHelp, wxDialog, @ref overview_eventhandlingoverview |
23324ae1 FM |
1628 | */ |
1629 | class wxHelpEvent : public wxCommandEvent | |
1630 | { | |
1631 | public: | |
1632 | /** | |
1633 | Constructor. | |
1634 | */ | |
1635 | wxHelpEvent(WXTYPE eventType = 0, wxWindowID id = 0, | |
1636 | const wxPoint& point); | |
1637 | ||
1638 | /** | |
1639 | Returns the origin of the help event which is one of the following values: | |
1640 | ||
23324ae1 FM |
1641 | @b Origin_Unknown |
1642 | ||
23324ae1 FM |
1643 | Unrecognized event source. |
1644 | ||
1645 | @b Origin_Keyboard | |
1646 | ||
23324ae1 FM |
1647 | Event generated by @c F1 key press. |
1648 | ||
1649 | @b Origin_HelpButton | |
1650 | ||
7c913512 | 1651 | Event generated by |
23324ae1 FM |
1652 | wxContextHelp or using the "?" title bur button under |
1653 | MS Windows. | |
1654 | ||
1655 | The application may handle events generated using the keyboard or mouse | |
e54c96f1 | 1656 | differently, e.g. by using wxGetMousePosition() |
23324ae1 FM |
1657 | for the mouse events. |
1658 | ||
4cc4bfaf | 1659 | @see SetOrigin() |
23324ae1 | 1660 | */ |
328f5751 | 1661 | wxHelpEvent::Origin GetOrigin() const; |
23324ae1 FM |
1662 | |
1663 | /** | |
1664 | Returns the left-click position of the mouse, in screen coordinates. This allows | |
1665 | the application to position the help appropriately. | |
1666 | */ | |
328f5751 | 1667 | const wxPoint GetPosition() const; |
23324ae1 FM |
1668 | |
1669 | /** | |
1670 | Set the help event origin, only used internally by wxWidgets normally. | |
1671 | ||
4cc4bfaf | 1672 | @see GetOrigin() |
23324ae1 FM |
1673 | */ |
1674 | void SetOrigin(wxHelpEvent::Origin origin); | |
1675 | ||
1676 | /** | |
1677 | Sets the left-click position of the mouse, in screen coordinates. | |
1678 | */ | |
1679 | void SetPosition(const wxPoint& pt); | |
1680 | }; | |
1681 | ||
1682 | ||
e54c96f1 | 1683 | |
23324ae1 FM |
1684 | /** |
1685 | @class wxScrollEvent | |
1686 | @wxheader{event.h} | |
7c913512 | 1687 | |
23324ae1 | 1688 | A scroll event holds information about events sent from stand-alone |
e54c96f1 | 1689 | scrollbars() and sliders(). Note that |
7c913512 | 1690 | starting from wxWidgets 2.1, scrolled windows send the |
23324ae1 FM |
1691 | wxScrollWinEvent which does not derive from |
1692 | wxCommandEvent, but from wxEvent directly - don't confuse these two kinds of | |
1693 | events and use the event table macros mentioned below only for the | |
1694 | scrollbar-like controls. | |
7c913512 | 1695 | |
23324ae1 FM |
1696 | @library{wxcore} |
1697 | @category{events} | |
7c913512 | 1698 | |
e54c96f1 | 1699 | @see wxScrollBar, wxSlider, wxSpinButton, , wxScrollWinEvent, @ref |
4cc4bfaf | 1700 | overview_eventhandlingoverview |
23324ae1 FM |
1701 | */ |
1702 | class wxScrollEvent : public wxCommandEvent | |
1703 | { | |
1704 | public: | |
1705 | /** | |
1706 | Constructor. | |
1707 | */ | |
1708 | wxScrollEvent(WXTYPE commandType = 0, int id = 0, int pos = 0, | |
1709 | int orientation = 0); | |
1710 | ||
1711 | /** | |
1712 | Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the | |
1713 | scrollbar. | |
1714 | */ | |
328f5751 | 1715 | int GetOrientation() const; |
23324ae1 FM |
1716 | |
1717 | /** | |
1718 | Returns the position of the scrollbar. | |
1719 | */ | |
328f5751 | 1720 | int GetPosition() const; |
23324ae1 FM |
1721 | }; |
1722 | ||
1723 | ||
e54c96f1 | 1724 | |
23324ae1 FM |
1725 | /** |
1726 | @class wxIdleEvent | |
1727 | @wxheader{event.h} | |
7c913512 | 1728 | |
23324ae1 FM |
1729 | This class is used for idle events, which are generated when the system becomes |
1730 | idle. Note that, unless you do something specifically, the idle events are not | |
1731 | sent if the system remains idle once it has become it, e.g. only a single idle | |
1732 | event will be generated until something else resulting in more normal events | |
1733 | happens and only then is the next idle event sent again. If you need to ensure | |
7c913512 FM |
1734 | a continuous stream of idle events, you can either use |
1735 | wxIdleEvent::RequestMore method in your handler or call | |
e54c96f1 | 1736 | wxWakeUpIdle() periodically (for example from timer |
23324ae1 FM |
1737 | event), but note that both of these approaches (and especially the first one) |
1738 | increase the system load and so should be avoided if possible. | |
7c913512 FM |
1739 | |
1740 | By default, idle events are sent to all windows (and also | |
23324ae1 FM |
1741 | wxApp, as usual). If this is causing a significant |
1742 | overhead in your application, you can call wxIdleEvent::SetMode with | |
1743 | the value wxIDLE_PROCESS_SPECIFIED, and set the wxWS_EX_PROCESS_IDLE extra | |
1744 | window style for every window which should receive idle events. | |
7c913512 | 1745 | |
23324ae1 FM |
1746 | @library{wxbase} |
1747 | @category{events} | |
7c913512 | 1748 | |
e54c96f1 FM |
1749 | @see @ref overview_eventhandlingoverview, wxUpdateUIEvent, |
1750 | wxWindow::OnInternalIdle | |
23324ae1 FM |
1751 | */ |
1752 | class wxIdleEvent : public wxEvent | |
1753 | { | |
1754 | public: | |
1755 | /** | |
1756 | Constructor. | |
1757 | */ | |
1758 | wxIdleEvent(); | |
1759 | ||
1760 | /** | |
1761 | Returns @true if it is appropriate to send idle events to | |
1762 | this window. | |
23324ae1 | 1763 | This function looks at the mode used (see wxIdleEvent::SetMode), |
4cc4bfaf | 1764 | and the wxWS_EX_PROCESS_IDLE style in @a window to determine whether idle |
23324ae1 FM |
1765 | events should be sent to |
1766 | this window now. By default this will always return @true because | |
1767 | the update mode is initially wxIDLE_PROCESS_ALL. You can change the mode | |
1768 | to only send idle events to windows with the wxWS_EX_PROCESS_IDLE extra window | |
1769 | style set. | |
1770 | ||
4cc4bfaf | 1771 | @see SetMode() |
23324ae1 FM |
1772 | */ |
1773 | static bool CanSend(wxWindow* window); | |
1774 | ||
1775 | /** | |
1776 | Static function returning a value specifying how wxWidgets | |
1777 | will send idle events: to all windows, or only to those which specify that they | |
1778 | will process the events. | |
23324ae1 FM |
1779 | See SetMode(). |
1780 | */ | |
1781 | static wxIdleMode GetMode(); | |
1782 | ||
1783 | /** | |
1784 | Returns @true if the OnIdle function processing this event requested more | |
1785 | processing time. | |
1786 | ||
4cc4bfaf | 1787 | @see RequestMore() |
23324ae1 | 1788 | */ |
328f5751 | 1789 | bool MoreRequested() const; |
23324ae1 FM |
1790 | |
1791 | /** | |
1792 | Tells wxWidgets that more processing is required. This function can be called | |
1793 | by an OnIdle | |
1794 | handler for a window or window event handler to indicate that wxApp::OnIdle | |
1795 | should | |
1796 | forward the OnIdle event once more to the application windows. If no window | |
1797 | calls this function | |
1798 | during OnIdle, then the application will remain in a passive event loop (not | |
1799 | calling OnIdle) until a | |
1800 | new event is posted to the application by the windowing system. | |
1801 | ||
4cc4bfaf | 1802 | @see MoreRequested() |
23324ae1 | 1803 | */ |
4cc4bfaf | 1804 | void RequestMore(bool needMore = true); |
23324ae1 FM |
1805 | |
1806 | /** | |
1807 | Static function for specifying how wxWidgets will send idle events: to | |
1808 | all windows, or only to those which specify that they | |
1809 | will process the events. | |
4cc4bfaf | 1810 | @a mode can be one of the following values. |
23324ae1 FM |
1811 | The default is wxIDLE_PROCESS_ALL. |
1812 | */ | |
1813 | static void SetMode(wxIdleMode mode); | |
1814 | }; | |
1815 | ||
1816 | ||
e54c96f1 | 1817 | |
23324ae1 FM |
1818 | /** |
1819 | @class wxInitDialogEvent | |
1820 | @wxheader{event.h} | |
7c913512 | 1821 | |
23324ae1 FM |
1822 | A wxInitDialogEvent is sent as a dialog or panel is being initialised. |
1823 | Handlers for this event can transfer data to the window. | |
1824 | The default handler calls wxWindow::TransferDataToWindow. | |
7c913512 | 1825 | |
23324ae1 FM |
1826 | @library{wxcore} |
1827 | @category{events} | |
7c913512 | 1828 | |
e54c96f1 | 1829 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
1830 | */ |
1831 | class wxInitDialogEvent : public wxEvent | |
1832 | { | |
1833 | public: | |
1834 | /** | |
1835 | Constructor. | |
1836 | */ | |
1837 | wxInitDialogEvent(int id = 0); | |
1838 | }; | |
1839 | ||
1840 | ||
e54c96f1 | 1841 | |
23324ae1 FM |
1842 | /** |
1843 | @class wxWindowDestroyEvent | |
1844 | @wxheader{event.h} | |
7c913512 | 1845 | |
23324ae1 FM |
1846 | This event is sent from the wxWindow destructor wxWindow::~wxWindow() when a |
1847 | window is destroyed. | |
7c913512 | 1848 | |
23324ae1 FM |
1849 | When a class derived from wxWindow is destroyed its destructor will have |
1850 | already run by the time this event is sent. Therefore this event will not | |
1851 | usually be received at all. | |
7c913512 | 1852 | |
23324ae1 FM |
1853 | To receive this event wxEvtHandler::Connect |
1854 | must be used (using an event table macro will not work). Since it is | |
1855 | received after the destructor has run, an object should not handle its | |
1856 | own wxWindowDestroyEvent, but it can be used to get notification of the | |
1857 | destruction of another window. | |
7c913512 | 1858 | |
23324ae1 FM |
1859 | @library{wxcore} |
1860 | @category{events} | |
7c913512 | 1861 | |
e54c96f1 | 1862 | @see @ref overview_eventhandlingoverview, wxWindowCreateEvent |
23324ae1 FM |
1863 | */ |
1864 | class wxWindowDestroyEvent : public wxCommandEvent | |
1865 | { | |
1866 | public: | |
1867 | /** | |
1868 | Constructor. | |
1869 | */ | |
4cc4bfaf | 1870 | wxWindowDestroyEvent(wxWindow* win = NULL); |
23324ae1 FM |
1871 | }; |
1872 | ||
1873 | ||
e54c96f1 | 1874 | |
23324ae1 FM |
1875 | /** |
1876 | @class wxNavigationKeyEvent | |
1877 | @wxheader{event.h} | |
7c913512 FM |
1878 | |
1879 | This event class contains information about navigation events, | |
1880 | generated by navigation keys such as tab and page down. | |
1881 | ||
1882 | This event is mainly used by wxWidgets implementations. A | |
1883 | wxNavigationKeyEvent handler is automatically provided by wxWidgets | |
23324ae1 | 1884 | when you make a class into a control container with the macro |
7c913512 FM |
1885 | WX_DECLARE_CONTROL_CONTAINER. |
1886 | ||
23324ae1 FM |
1887 | @library{wxcore} |
1888 | @category{events} | |
7c913512 | 1889 | |
e54c96f1 | 1890 | @see wxWindow::Navigate, wxWindow::NavigateIn |
23324ae1 | 1891 | */ |
7c913512 | 1892 | class wxNavigationKeyEvent |
23324ae1 FM |
1893 | { |
1894 | public: | |
1895 | //@{ | |
1896 | /** | |
1897 | Constructor. | |
1898 | */ | |
1899 | wxNavigationKeyEvent(); | |
7c913512 | 1900 | wxNavigationKeyEvent(const wxNavigationKeyEvent& event); |
23324ae1 FM |
1901 | //@} |
1902 | ||
1903 | /** | |
1904 | Returns the child that has the focus, or @NULL. | |
1905 | */ | |
328f5751 | 1906 | wxWindow* GetCurrentFocus() const; |
23324ae1 FM |
1907 | |
1908 | /** | |
1909 | Returns @true if the navigation was in the forward direction. | |
1910 | */ | |
328f5751 | 1911 | bool GetDirection() const; |
23324ae1 FM |
1912 | |
1913 | /** | |
1914 | Returns @true if the navigation event was from a tab key. This is required | |
1915 | for proper navigation over radio buttons. | |
1916 | */ | |
328f5751 | 1917 | bool IsFromTab() const; |
23324ae1 FM |
1918 | |
1919 | /** | |
1920 | Returns @true if the navigation event represents a window change (for | |
7c913512 | 1921 | example, from Ctrl-Page Down |
23324ae1 FM |
1922 | in a notebook). |
1923 | */ | |
328f5751 | 1924 | bool IsWindowChange() const; |
23324ae1 FM |
1925 | |
1926 | /** | |
1927 | Sets the current focus window member. | |
1928 | */ | |
1929 | void SetCurrentFocus(wxWindow* currentFocus); | |
1930 | ||
1931 | /** | |
4cc4bfaf | 1932 | Sets the direction to forward if @a direction is @true, or backward if @c |
23324ae1 FM |
1933 | @false. |
1934 | */ | |
1935 | void SetDirection(bool direction); | |
1936 | ||
1937 | /** | |
1938 | Sets the flags. | |
1939 | */ | |
1940 | void SetFlags(long flags); | |
1941 | ||
1942 | /** | |
1943 | Marks the navigation event as from a tab key. | |
1944 | */ | |
1945 | void SetFromTab(bool fromTab); | |
1946 | ||
1947 | /** | |
1948 | Marks the event as a window change event. | |
1949 | */ | |
1950 | void SetWindowChange(bool windowChange); | |
1951 | }; | |
1952 | ||
1953 | ||
e54c96f1 | 1954 | |
23324ae1 FM |
1955 | /** |
1956 | @class wxMouseCaptureChangedEvent | |
1957 | @wxheader{event.h} | |
7c913512 | 1958 | |
23324ae1 FM |
1959 | An mouse capture changed event is sent to a window that loses its |
1960 | mouse capture. This is called even if wxWindow::ReleaseCapture | |
1961 | was called by the application code. Handling this event allows | |
1962 | an application to cater for unexpected capture releases which | |
1963 | might otherwise confuse mouse handling code. | |
7c913512 | 1964 | |
23324ae1 | 1965 | This event is implemented under Windows only. |
7c913512 | 1966 | |
23324ae1 FM |
1967 | @library{wxcore} |
1968 | @category{events} | |
7c913512 | 1969 | |
e54c96f1 | 1970 | @see wxMouseCaptureLostEvent, @ref overview_eventhandlingoverview, |
4cc4bfaf | 1971 | wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture |
23324ae1 FM |
1972 | */ |
1973 | class wxMouseCaptureChangedEvent : public wxEvent | |
1974 | { | |
1975 | public: | |
1976 | /** | |
1977 | Constructor. | |
1978 | */ | |
1979 | wxMouseCaptureChangedEvent(wxWindowID windowId = 0, | |
4cc4bfaf | 1980 | wxWindow* gainedCapture = NULL); |
23324ae1 FM |
1981 | |
1982 | /** | |
1983 | Returns the window that gained the capture, or @NULL if it was a non-wxWidgets | |
1984 | window. | |
1985 | */ | |
328f5751 | 1986 | wxWindow* GetCapturedWindow() const; |
23324ae1 FM |
1987 | }; |
1988 | ||
1989 | ||
e54c96f1 | 1990 | |
23324ae1 FM |
1991 | /** |
1992 | @class wxCloseEvent | |
1993 | @wxheader{event.h} | |
7c913512 | 1994 | |
23324ae1 | 1995 | This event class contains information about window and session close events. |
7c913512 | 1996 | |
23324ae1 FM |
1997 | The handler function for EVT_CLOSE is called when the user has tried to close a |
1998 | a frame | |
1999 | or dialog box using the window manager (X) or system menu (Windows). It can | |
2000 | also be invoked by the application itself programmatically, for example by | |
2001 | calling the wxWindow::Close function. | |
7c913512 | 2002 | |
23324ae1 FM |
2003 | You should check whether the application is forcing the deletion of the window |
2004 | using wxCloseEvent::CanVeto. If this is @false, | |
2005 | you @e must destroy the window using wxWindow::Destroy. | |
2006 | If the return value is @true, it is up to you whether you respond by destroying | |
2007 | the window. | |
7c913512 | 2008 | |
23324ae1 FM |
2009 | If you don't destroy the window, you should call wxCloseEvent::Veto to |
2010 | let the calling code know that you did not destroy the window. This allows the | |
2011 | wxWindow::Close function | |
2012 | to return @true or @false depending on whether the close instruction was | |
2013 | honoured or not. | |
7c913512 | 2014 | |
23324ae1 FM |
2015 | @library{wxcore} |
2016 | @category{events} | |
7c913512 | 2017 | |
e54c96f1 FM |
2018 | @see wxWindow::Close, @ref overview_windowdeletionoverview "Window deletion |
2019 | overview" | |
23324ae1 FM |
2020 | */ |
2021 | class wxCloseEvent : public wxEvent | |
2022 | { | |
2023 | public: | |
2024 | /** | |
2025 | Constructor. | |
2026 | */ | |
2027 | wxCloseEvent(WXTYPE commandEventType = 0, int id = 0); | |
2028 | ||
2029 | /** | |
2030 | Returns @true if you can veto a system shutdown or a window close event. | |
2031 | Vetoing a window close event is not possible if the calling code wishes to | |
2032 | force the application to exit, and so this function must be called to check | |
2033 | this. | |
2034 | */ | |
2035 | bool CanVeto(); | |
2036 | ||
2037 | /** | |
2038 | Returns @true if the user is just logging off or @false if the system is | |
2039 | shutting down. This method can only be called for end session and query end | |
2040 | session events, it doesn't make sense for close window event. | |
2041 | */ | |
328f5751 | 2042 | bool GetLoggingOff() const; |
23324ae1 FM |
2043 | |
2044 | /** | |
2045 | Sets the 'can veto' flag. | |
2046 | */ | |
2047 | void SetCanVeto(bool canVeto); | |
2048 | ||
2049 | /** | |
2050 | Sets the 'force' flag. | |
2051 | */ | |
328f5751 | 2052 | void SetForce(bool force) const; |
23324ae1 FM |
2053 | |
2054 | /** | |
2055 | Sets the 'logging off' flag. | |
2056 | */ | |
328f5751 | 2057 | void SetLoggingOff(bool loggingOff) const; |
23324ae1 FM |
2058 | |
2059 | /** | |
2060 | Call this from your event handler to veto a system shutdown or to signal | |
2061 | to the calling application that a window close did not happen. | |
23324ae1 FM |
2062 | You can only veto a shutdown if CanVeto() returns |
2063 | @true. | |
2064 | */ | |
4cc4bfaf | 2065 | void Veto(bool veto = true); |
23324ae1 FM |
2066 | }; |
2067 | ||
2068 | ||
e54c96f1 | 2069 | |
23324ae1 FM |
2070 | /** |
2071 | @class wxMenuEvent | |
2072 | @wxheader{event.h} | |
7c913512 | 2073 | |
23324ae1 FM |
2074 | This class is used for a variety of menu-related events. Note that |
2075 | these do not include menu command events, which are | |
2076 | handled using wxCommandEvent objects. | |
7c913512 | 2077 | |
23324ae1 FM |
2078 | The default handler for wxEVT_MENU_HIGHLIGHT displays help |
2079 | text in the first field of the status bar. | |
7c913512 | 2080 | |
23324ae1 FM |
2081 | @library{wxcore} |
2082 | @category{events} | |
7c913512 | 2083 | |
e54c96f1 | 2084 | @see @ref overview_wxcommandevent "Command events", @ref |
4cc4bfaf | 2085 | overview_eventhandlingoverview |
23324ae1 FM |
2086 | */ |
2087 | class wxMenuEvent : public wxEvent | |
2088 | { | |
2089 | public: | |
2090 | /** | |
2091 | Constructor. | |
2092 | */ | |
4cc4bfaf | 2093 | wxMenuEvent(WXTYPE id = 0, int id = 0, wxMenu* menu = NULL); |
23324ae1 FM |
2094 | |
2095 | /** | |
2096 | Returns the menu which is being opened or closed. This method should only be | |
2097 | used with the @c OPEN and @c CLOSE events and even for them the | |
2098 | returned pointer may be @NULL in some ports. | |
2099 | */ | |
328f5751 | 2100 | wxMenu* GetMenu() const; |
23324ae1 FM |
2101 | |
2102 | /** | |
2103 | Returns the menu identifier associated with the event. This method should be | |
2104 | only used with the @c HIGHLIGHT events. | |
2105 | */ | |
328f5751 | 2106 | int GetMenuId() const; |
23324ae1 FM |
2107 | |
2108 | /** | |
7c913512 | 2109 | Returns @true if the menu which is being opened or closed is a popup menu, |
23324ae1 | 2110 | @false if it is a normal one. |
23324ae1 FM |
2111 | This method should only be used with the @c OPEN and @c CLOSE events. |
2112 | */ | |
328f5751 | 2113 | bool IsPopup() const; |
23324ae1 FM |
2114 | }; |
2115 | ||
2116 | ||
e54c96f1 | 2117 | |
23324ae1 FM |
2118 | /** |
2119 | @class wxEventBlocker | |
2120 | @wxheader{event.h} | |
7c913512 | 2121 | |
23324ae1 FM |
2122 | This class is a special event handler which allows to discard |
2123 | any event (or a set of event types) directed to a specific window. | |
7c913512 | 2124 | |
23324ae1 | 2125 | Example: |
7c913512 | 2126 | |
23324ae1 FM |
2127 | @code |
2128 | { | |
2129 | // block all events directed to this window while | |
2130 | // we do the 1000 FuncWhichSendsEvents() calls | |
2131 | wxEventBlocker blocker(this); | |
7c913512 | 2132 | |
23324ae1 FM |
2133 | for ( int i = 0; i 1000; i++ ) |
2134 | FuncWhichSendsEvents(i); | |
7c913512 | 2135 | |
23324ae1 | 2136 | } // ~wxEventBlocker called, old event handler is restored |
7c913512 | 2137 | |
23324ae1 FM |
2138 | // the event generated by this call will be processed |
2139 | FuncWhichSendsEvents(0) | |
2140 | @endcode | |
7c913512 | 2141 | |
23324ae1 FM |
2142 | @library{wxcore} |
2143 | @category{FIXME} | |
7c913512 | 2144 | |
e54c96f1 | 2145 | @see @ref overview_eventhandlingoverview, wxEvtHandler |
23324ae1 FM |
2146 | */ |
2147 | class wxEventBlocker : public wxEvtHandler | |
2148 | { | |
2149 | public: | |
2150 | /** | |
2151 | Constructs the blocker for the given window and for the given event type. | |
4cc4bfaf | 2152 | If @a type is @c wxEVT_ANY, then all events for that window are |
23324ae1 FM |
2153 | blocked. You can call Block() after creation to |
2154 | add other event types to the list of events to block. | |
4cc4bfaf | 2155 | Note that the @a win window @b must remain alive until the |
23324ae1 FM |
2156 | wxEventBlocker object destruction. |
2157 | */ | |
2158 | wxEventBlocker(wxWindow* win, wxEventType type = wxEVT_ANY); | |
2159 | ||
2160 | /** | |
2161 | Destructor. The blocker will remove itself from the chain of event handlers for | |
2162 | the window provided in the constructor, thus restoring normal processing of | |
2163 | events. | |
2164 | */ | |
2165 | ~wxEventBlocker(); | |
2166 | ||
2167 | /** | |
2168 | Adds to the list of event types which should be blocked the given @e eventType. | |
2169 | */ | |
2170 | void Block(wxEventType eventType); | |
2171 | }; | |
2172 | ||
2173 | ||
e54c96f1 | 2174 | |
23324ae1 FM |
2175 | /** |
2176 | @class wxEvtHandler | |
2177 | @wxheader{event.h} | |
7c913512 | 2178 | |
23324ae1 FM |
2179 | A class that can handle events from the windowing system. |
2180 | wxWindow (and therefore all window classes) are derived from | |
2181 | this class. | |
7c913512 | 2182 | |
23324ae1 FM |
2183 | When events are received, wxEvtHandler invokes the method listed in the |
2184 | event table using itself as the object. When using multiple inheritance | |
2185 | it is imperative that the wxEvtHandler(-derived) class be the first | |
2186 | class inherited such that the "this" pointer for the overall object | |
2187 | will be identical to the "this" pointer for the wxEvtHandler portion. | |
7c913512 | 2188 | |
23324ae1 FM |
2189 | @library{wxbase} |
2190 | @category{FIXME} | |
7c913512 | 2191 | |
e54c96f1 | 2192 | @see @ref overview_eventhandlingoverview |
23324ae1 FM |
2193 | */ |
2194 | class wxEvtHandler : public wxObject | |
2195 | { | |
2196 | public: | |
2197 | /** | |
2198 | Constructor. | |
2199 | */ | |
2200 | wxEvtHandler(); | |
2201 | ||
2202 | /** | |
2203 | Destructor. If the handler is part of a chain, the destructor will | |
2204 | unlink itself and restore the previous and next handlers so that they point to | |
2205 | each other. | |
2206 | */ | |
2207 | ~wxEvtHandler(); | |
2208 | ||
2209 | /** | |
2210 | This function posts an event to be processed later. | |
2211 | ||
7c913512 | 2212 | @param event |
4cc4bfaf | 2213 | Event to add to process queue. |
23324ae1 FM |
2214 | |
2215 | @remarks The difference between sending an event (using the ProcessEvent | |
4cc4bfaf FM |
2216 | method) and posting it is that in the first case the |
2217 | event is processed before the function returns, while | |
2218 | in the second case, the function returns immediately | |
2219 | and the event will be processed sometime later (usually | |
2220 | during the next event loop iteration). | |
23324ae1 FM |
2221 | */ |
2222 | virtual void AddPendingEvent(const wxEvent& event); | |
2223 | ||
2224 | //@{ | |
2225 | /** | |
2226 | Connects the given function dynamically with the event handler, id and event | |
2227 | type. This | |
2228 | is an alternative to the use of static event tables. See the 'event' or the old | |
2229 | 'dynamic' sample for usage. | |
2230 | ||
7c913512 | 2231 | @param id |
4cc4bfaf FM |
2232 | The identifier (or first of the identifier range) to be |
2233 | associated with the event handler function. For the version not taking this | |
2234 | argument, it defaults to wxID_ANY. | |
7c913512 | 2235 | @param lastId |
4cc4bfaf FM |
2236 | The second part of the identifier range to be associated with the event |
2237 | handler function. | |
7c913512 | 2238 | @param eventType |
4cc4bfaf | 2239 | The event type to be associated with this event handler. |
7c913512 | 2240 | @param function |
4cc4bfaf FM |
2241 | The event handler function. Note that this function should |
2242 | be explicitly converted to the correct type which can be done using a macro | |
2243 | called wxFooEventHandler for the handler for any wxFooEvent. | |
7c913512 | 2244 | @param userData |
4cc4bfaf | 2245 | Data to be associated with the event table entry. |
7c913512 | 2246 | @param eventSink |
4cc4bfaf FM |
2247 | Object whose member function should be called. If this is @NULL, |
2248 | this will be used. | |
23324ae1 FM |
2249 | */ |
2250 | void Connect(int id, int lastId, wxEventType eventType, | |
2251 | wxObjectEventFunction function, | |
4cc4bfaf FM |
2252 | wxObject* userData = NULL, |
2253 | wxEvtHandler* eventSink = NULL); | |
7c913512 FM |
2254 | void Connect(int id, wxEventType eventType, |
2255 | wxObjectEventFunction function, | |
4cc4bfaf FM |
2256 | wxObject* userData = NULL, |
2257 | wxEvtHandler* eventSink = NULL); | |
7c913512 FM |
2258 | void Connect(wxEventType eventType, |
2259 | wxObjectEventFunction function, | |
4cc4bfaf FM |
2260 | wxObject* userData = NULL, |
2261 | wxEvtHandler* eventSink = NULL); | |
23324ae1 FM |
2262 | //@} |
2263 | ||
2264 | //@{ | |
2265 | /** | |
2266 | Disconnects the given function dynamically from the event handler, using the | |
2267 | specified | |
2268 | parameters as search criteria and returning @true if a matching function has been | |
2269 | found and removed. This method can only disconnect functions which have been | |
2270 | added | |
2271 | using the Connect() method. There is no way | |
2272 | to disconnect functions connected using the (static) event tables. | |
2273 | ||
7c913512 | 2274 | @param id |
4cc4bfaf | 2275 | The identifier (or first of the identifier range) associated with the event |
23324ae1 | 2276 | handler function. |
7c913512 | 2277 | @param lastId |
4cc4bfaf | 2278 | The second part of the identifier range associated with the event handler |
23324ae1 | 2279 | function. |
7c913512 | 2280 | @param eventType |
4cc4bfaf | 2281 | The event type associated with this event handler. |
7c913512 | 2282 | @param function |
4cc4bfaf | 2283 | The event handler function. |
7c913512 | 2284 | @param userData |
4cc4bfaf | 2285 | Data associated with the event table entry. |
7c913512 | 2286 | @param eventSink |
4cc4bfaf | 2287 | Object whose member function should be called. |
23324ae1 | 2288 | */ |
4cc4bfaf FM |
2289 | bool Disconnect(wxEventType eventType = wxEVT_NULL, |
2290 | wxObjectEventFunction function = NULL, | |
2291 | wxObject* userData = NULL, | |
2292 | wxEvtHandler* eventSink = NULL); | |
7c913512 | 2293 | bool Disconnect(int id = wxID_ANY, |
4cc4bfaf FM |
2294 | wxEventType eventType = wxEVT_NULL, |
2295 | wxObjectEventFunction function = NULL, | |
2296 | wxObject* userData = NULL, | |
2297 | wxEvtHandler* eventSink = NULL); | |
7c913512 | 2298 | bool Disconnect(int id, int lastId = wxID_ANY, |
4cc4bfaf FM |
2299 | wxEventType eventType = wxEVT_NULL, |
2300 | wxObjectEventFunction function = NULL, | |
2301 | wxObject* userData = NULL, | |
2302 | wxEvtHandler* eventSink = NULL); | |
23324ae1 FM |
2303 | //@} |
2304 | ||
2305 | /** | |
2306 | Gets user-supplied client data. | |
2307 | ||
2308 | @remarks Normally, any extra data the programmer wishes to associate with | |
4cc4bfaf FM |
2309 | the object should be made available by deriving a new |
2310 | class with new data members. | |
23324ae1 | 2311 | |
4cc4bfaf | 2312 | @see SetClientData() |
23324ae1 FM |
2313 | */ |
2314 | void* GetClientData(); | |
2315 | ||
2316 | /** | |
2317 | Get a pointer to the user-supplied client data object. | |
2318 | ||
4cc4bfaf | 2319 | @see SetClientObject(), wxClientData |
23324ae1 | 2320 | */ |
328f5751 | 2321 | wxClientData* GetClientObject() const; |
23324ae1 FM |
2322 | |
2323 | /** | |
2324 | Returns @true if the event handler is enabled, @false otherwise. | |
2325 | ||
4cc4bfaf | 2326 | @see SetEvtHandlerEnabled() |
23324ae1 FM |
2327 | */ |
2328 | bool GetEvtHandlerEnabled(); | |
2329 | ||
2330 | /** | |
2331 | Gets the pointer to the next handler in the chain. | |
2332 | ||
4cc4bfaf FM |
2333 | @see SetNextHandler(), GetPreviousHandler(), |
2334 | SetPreviousHandler(), wxWindow::PushEventHandler, | |
2335 | wxWindow::PopEventHandler | |
23324ae1 FM |
2336 | */ |
2337 | wxEvtHandler* GetNextHandler(); | |
2338 | ||
2339 | /** | |
2340 | Gets the pointer to the previous handler in the chain. | |
2341 | ||
4cc4bfaf FM |
2342 | @see SetPreviousHandler(), GetNextHandler(), |
2343 | SetNextHandler(), wxWindow::PushEventHandler, | |
2344 | wxWindow::PopEventHandler | |
23324ae1 FM |
2345 | */ |
2346 | wxEvtHandler* GetPreviousHandler(); | |
2347 | ||
2348 | /** | |
2349 | Processes an event, searching event tables and calling zero or more suitable | |
2350 | event handler function(s). | |
2351 | ||
7c913512 | 2352 | @param event |
4cc4bfaf | 2353 | Event to process. |
23324ae1 FM |
2354 | |
2355 | @returns @true if a suitable event handler function was found and | |
4cc4bfaf | 2356 | executed, and the function did not call wxEvent::Skip. |
23324ae1 FM |
2357 | |
2358 | @remarks Normally, your application would not call this function: it is | |
4cc4bfaf FM |
2359 | called in the wxWidgets implementation to dispatch |
2360 | incoming user interface events to the framework (and | |
2361 | application). | |
23324ae1 | 2362 | |
4cc4bfaf | 2363 | @see SearchEventTable() |
23324ae1 FM |
2364 | */ |
2365 | virtual bool ProcessEvent(wxEvent& event); | |
2366 | ||
2367 | /** | |
2368 | Processes an event by calling ProcessEvent() | |
2369 | and handles any exceptions that occur in the process. If an exception is | |
2370 | thrown in event handler, wxApp::OnExceptionInMainLoop | |
2371 | is called. | |
2372 | ||
7c913512 | 2373 | @param event |
4cc4bfaf | 2374 | Event to process. |
23324ae1 FM |
2375 | |
2376 | @returns @true if the event was processed, @false if no handler was found | |
4cc4bfaf | 2377 | or an exception was thrown. |
23324ae1 | 2378 | |
4cc4bfaf | 2379 | @see wxWindow::HandleWindowEvent |
23324ae1 FM |
2380 | */ |
2381 | bool SafelyProcessEvent(wxEvent& event); | |
2382 | ||
2383 | /** | |
2384 | Searches the event table, executing an event handler function if an appropriate | |
2385 | one | |
2386 | is found. | |
2387 | ||
7c913512 | 2388 | @param table |
4cc4bfaf | 2389 | Event table to be searched. |
7c913512 | 2390 | @param event |
4cc4bfaf | 2391 | Event to be matched against an event table entry. |
23324ae1 FM |
2392 | |
2393 | @returns @true if a suitable event handler function was found and | |
4cc4bfaf | 2394 | executed, and the function did not call wxEvent::Skip. |
23324ae1 FM |
2395 | |
2396 | @remarks This function looks through the object's event table and tries | |
4cc4bfaf | 2397 | to find an entry that will match the event. |
23324ae1 | 2398 | |
4cc4bfaf | 2399 | @see ProcessEvent() |
23324ae1 FM |
2400 | */ |
2401 | virtual bool SearchEventTable(wxEventTable& table, | |
2402 | wxEvent& event); | |
2403 | ||
2404 | /** | |
2405 | Sets user-supplied client data. | |
2406 | ||
7c913512 | 2407 | @param data |
4cc4bfaf | 2408 | Data to be associated with the event handler. |
23324ae1 FM |
2409 | |
2410 | @remarks Normally, any extra data the programmer wishes to associate with | |
4cc4bfaf FM |
2411 | the object should be made available by deriving a new |
2412 | class with new data members. You must not call this | |
2413 | method and SetClientObject on the same class - only one | |
2414 | of them. | |
23324ae1 | 2415 | |
4cc4bfaf | 2416 | @see GetClientData() |
23324ae1 FM |
2417 | */ |
2418 | void SetClientData(void* data); | |
2419 | ||
2420 | /** | |
2421 | Set the client data object. Any previous object will be deleted. | |
2422 | ||
4cc4bfaf | 2423 | @see GetClientObject(), wxClientData |
23324ae1 FM |
2424 | */ |
2425 | void SetClientObject(wxClientData* data); | |
2426 | ||
2427 | /** | |
2428 | Enables or disables the event handler. | |
2429 | ||
7c913512 | 2430 | @param enabled |
4cc4bfaf | 2431 | @true if the event handler is to be enabled, @false if it is to be disabled. |
23324ae1 FM |
2432 | |
2433 | @remarks You can use this function to avoid having to remove the event | |
4cc4bfaf FM |
2434 | handler from the chain, for example when implementing a |
2435 | dialog editor and changing from edit to test mode. | |
23324ae1 | 2436 | |
4cc4bfaf | 2437 | @see GetEvtHandlerEnabled() |
23324ae1 FM |
2438 | */ |
2439 | void SetEvtHandlerEnabled(bool enabled); | |
2440 | ||
2441 | /** | |
2442 | Sets the pointer to the next handler. | |
2443 | ||
7c913512 | 2444 | @param handler |
4cc4bfaf | 2445 | Event handler to be set as the next handler. |
23324ae1 | 2446 | |
4cc4bfaf FM |
2447 | @see GetNextHandler(), SetPreviousHandler(), |
2448 | GetPreviousHandler(), wxWindow::PushEventHandler, | |
2449 | wxWindow::PopEventHandler | |
23324ae1 FM |
2450 | */ |
2451 | void SetNextHandler(wxEvtHandler* handler); | |
2452 | ||
2453 | /** | |
2454 | Sets the pointer to the previous handler. | |
2455 | ||
7c913512 | 2456 | @param handler |
4cc4bfaf | 2457 | Event handler to be set as the previous handler. |
23324ae1 FM |
2458 | */ |
2459 | void SetPreviousHandler(wxEvtHandler* handler); | |
2460 | }; | |
2461 | ||
2462 | ||
e54c96f1 | 2463 | |
23324ae1 FM |
2464 | /** |
2465 | @class wxIconizeEvent | |
2466 | @wxheader{event.h} | |
7c913512 | 2467 | |
23324ae1 | 2468 | An event being sent when the frame is iconized (minimized) or restored. |
7c913512 | 2469 | |
23324ae1 | 2470 | Currently only wxMSW and wxGTK generate such events. |
7c913512 | 2471 | |
23324ae1 FM |
2472 | @library{wxcore} |
2473 | @category{events} | |
7c913512 | 2474 | |
e54c96f1 | 2475 | @see @ref overview_eventhandlingoverview, wxTopLevelWindow::Iconize, |
4cc4bfaf | 2476 | wxTopLevelWindow::IsIconized |
23324ae1 FM |
2477 | */ |
2478 | class wxIconizeEvent : public wxEvent | |
2479 | { | |
2480 | public: | |
2481 | /** | |
2482 | Constructor. | |
2483 | */ | |
4cc4bfaf | 2484 | wxIconizeEvent(int id = 0, bool iconized = true); |
23324ae1 FM |
2485 | |
2486 | /** | |
2487 | Returns @true if the frame has been iconized, @false if it has been | |
2488 | restored. | |
2489 | */ | |
328f5751 | 2490 | bool Iconized() const; |
23324ae1 FM |
2491 | }; |
2492 | ||
2493 | ||
e54c96f1 | 2494 | |
23324ae1 FM |
2495 | /** |
2496 | @class wxMoveEvent | |
2497 | @wxheader{event.h} | |
7c913512 | 2498 | |
23324ae1 | 2499 | A move event holds information about move change events. |
7c913512 | 2500 | |
23324ae1 FM |
2501 | @library{wxcore} |
2502 | @category{events} | |
7c913512 | 2503 | |
e54c96f1 | 2504 | @see wxPoint, @ref overview_eventhandlingoverview |
23324ae1 FM |
2505 | */ |
2506 | class wxMoveEvent : public wxEvent | |
2507 | { | |
2508 | public: | |
2509 | /** | |
2510 | Constructor. | |
2511 | */ | |
2512 | wxMoveEvent(const wxPoint& pt, int id = 0); | |
2513 | ||
2514 | /** | |
2515 | Returns the position of the window generating the move change event. | |
2516 | */ | |
328f5751 | 2517 | wxPoint GetPosition() const; |
23324ae1 FM |
2518 | }; |
2519 | ||
2520 | ||
e54c96f1 | 2521 | |
23324ae1 FM |
2522 | /** |
2523 | @class wxEvent | |
2524 | @wxheader{event.h} | |
7c913512 | 2525 | |
23324ae1 FM |
2526 | An event is a structure holding information about an event passed to a |
2527 | callback or member function. @b wxEvent used to be a multipurpose | |
2528 | event object, and is an abstract base class for other event classes (see below). | |
7c913512 | 2529 | |
4cc4bfaf | 2530 | For more information about events, see the @ref overview_eventhandlingoverview. |
7c913512 | 2531 | |
23324ae1 FM |
2532 | @b wxPerl note: In wxPerl custom event classes should be derived from |
2533 | @c Wx::PlEvent and @c Wx::PlCommandEvent. | |
7c913512 | 2534 | |
23324ae1 FM |
2535 | @library{wxbase} |
2536 | @category{events} | |
7c913512 | 2537 | |
e54c96f1 | 2538 | @see wxCommandEvent, wxMouseEvent |
23324ae1 FM |
2539 | */ |
2540 | class wxEvent : public wxObject | |
2541 | { | |
2542 | public: | |
2543 | /** | |
2544 | Constructor. Should not need to be used directly by an application. | |
2545 | */ | |
4cc4bfaf | 2546 | wxEvent(int id = 0, wxEventType eventType = wxEVT_NULL); |
23324ae1 FM |
2547 | |
2548 | /** | |
2549 | Returns a copy of the event. | |
23324ae1 FM |
2550 | Any event that is posted to the wxWidgets event system for later action (via |
2551 | wxEvtHandler::AddPendingEvent or | |
e54c96f1 | 2552 | wxPostEvent()) must implement this method. All wxWidgets |
23324ae1 FM |
2553 | events fully implement this method, but any derived events implemented by the |
2554 | user should also implement this method just in case they (or some event | |
2555 | derived from them) are ever posted. | |
23324ae1 FM |
2556 | All wxWidgets events implement a copy constructor, so the easiest way of |
2557 | implementing the Clone function is to implement a copy constructor for | |
2558 | a new event (call it MyEvent) and then define the Clone function like this: | |
2559 | */ | |
328f5751 | 2560 | virtual wxEvent* Clone() const; |
23324ae1 FM |
2561 | |
2562 | /** | |
2563 | Returns the object (usually a window) associated with the | |
2564 | event, if any. | |
2565 | */ | |
2566 | wxObject* GetEventObject(); | |
2567 | ||
2568 | /** | |
2569 | Returns the identifier of the given event type, | |
2570 | such as @c wxEVT_COMMAND_BUTTON_CLICKED. | |
2571 | */ | |
2572 | wxEventType GetEventType(); | |
2573 | ||
2574 | /** | |
2575 | Returns the identifier associated with this event, such as a button command id. | |
2576 | */ | |
328f5751 | 2577 | int GetId() const; |
23324ae1 FM |
2578 | |
2579 | /** | |
2580 | Returns @true if the event handler should be skipped, @false otherwise. | |
2581 | */ | |
328f5751 | 2582 | bool GetSkipped() const; |
23324ae1 FM |
2583 | |
2584 | /** | |
2585 | Gets the timestamp for the event. The timestamp is the time in milliseconds | |
2586 | since some fixed moment (not necessarily the standard Unix Epoch, so | |
2587 | only differences between the timestamps and not their absolute values usually | |
2588 | make sense). | |
2589 | */ | |
2590 | long GetTimestamp(); | |
2591 | ||
2592 | /** | |
2593 | Returns @true if the event is or is derived from | |
2594 | wxCommandEvent else it returns @false. | |
2595 | Note: Exists only for optimization purposes. | |
2596 | */ | |
328f5751 | 2597 | bool IsCommandEvent() const; |
23324ae1 FM |
2598 | |
2599 | /** | |
2600 | Sets the propagation level to the given value (for example returned from an | |
2601 | earlier call to wxEvent::StopPropagation). | |
2602 | */ | |
2603 | void ResumePropagation(int propagationLevel); | |
2604 | ||
2605 | /** | |
2606 | Sets the originating object. | |
2607 | */ | |
2608 | void SetEventObject(wxObject* object); | |
2609 | ||
2610 | /** | |
2611 | Sets the event type. | |
2612 | */ | |
2613 | void SetEventType(wxEventType type); | |
2614 | ||
2615 | /** | |
2616 | Sets the identifier associated with this event, such as a button command id. | |
2617 | */ | |
2618 | void SetId(int id); | |
2619 | ||
2620 | /** | |
2621 | Sets the timestamp for the event. | |
2622 | */ | |
2623 | void SetTimestamp(long timeStamp); | |
2624 | ||
2625 | /** | |
2626 | Test if this event should be propagated or not, i.e. if the propagation level | |
2627 | is currently greater than 0. | |
2628 | */ | |
328f5751 | 2629 | bool ShouldPropagate() const; |
23324ae1 FM |
2630 | |
2631 | /** | |
2632 | This method can be used inside an event handler to control whether further | |
2633 | event handlers bound to this event will be called after the current one | |
2634 | returns. Without Skip() (or equivalently if Skip(@false) is used), | |
2635 | the event will not be processed any more. If Skip(@true) is called, the event | |
2636 | processing system continues searching for a further handler function for this | |
2637 | event, even though it has been processed already in the current handler. | |
23324ae1 FM |
2638 | In general, it is recommended to skip all non-command events to allow the |
2639 | default handling to take place. The command events are, however, normally not | |
2640 | skipped as usually a single command such as a button click or menu item | |
2641 | selection must only be processed by one handler. | |
2642 | */ | |
4cc4bfaf | 2643 | void Skip(bool skip = true); |
23324ae1 FM |
2644 | |
2645 | /** | |
2646 | Stop the event from propagating to its parent window. | |
7c913512 | 2647 | Returns the old propagation level value which may be later passed to |
23324ae1 FM |
2648 | ResumePropagation() to allow propagating the |
2649 | event again. | |
2650 | */ | |
2651 | int StopPropagation(); | |
2652 | ||
2653 | /** | |
2654 | int m_propagationLevel | |
23324ae1 FM |
2655 | Indicates how many levels the event can propagate. This member is protected and |
2656 | should typically only be set in the constructors of the derived classes. It | |
7c913512 FM |
2657 | may be temporarily changed by StopPropagation() |
2658 | and ResumePropagation() and tested with | |
23324ae1 | 2659 | ShouldPropagate(). |
23324ae1 | 2660 | The initial value is set to either @c wxEVENT_PROPAGATE_NONE (by |
7c913512 | 2661 | default) meaning that the event shouldn't be propagated at all or to |
23324ae1 FM |
2662 | @c wxEVENT_PROPAGATE_MAX (for command events) meaning that it should be |
2663 | propagated as much as necessary. | |
23324ae1 FM |
2664 | Any positive number means that the event should be propagated but no more than |
2665 | the given number of times. E.g. the propagation level may be set to 1 to | |
2666 | propagate the event to its parent only, but not to its grandparent. | |
2667 | */ | |
2668 | }; | |
2669 | ||
2670 | ||
e54c96f1 | 2671 | |
23324ae1 FM |
2672 | /** |
2673 | @class wxSizeEvent | |
2674 | @wxheader{event.h} | |
7c913512 | 2675 | |
23324ae1 | 2676 | A size event holds information about size change events. |
7c913512 | 2677 | |
23324ae1 | 2678 | The EVT_SIZE handler function will be called when the window has been resized. |
7c913512 | 2679 | |
23324ae1 FM |
2680 | You may wish to use this for frames to resize their child windows as |
2681 | appropriate. | |
7c913512 | 2682 | |
23324ae1 FM |
2683 | Note that the size passed is of |
2684 | the whole window: call wxWindow::GetClientSize for the area which may be | |
2685 | used by the application. | |
7c913512 | 2686 | |
23324ae1 FM |
2687 | When a window is resized, usually only a small part of the window is damaged |
2688 | and you | |
2689 | may only need to repaint that area. However, if your drawing depends on the | |
2690 | size of the window, | |
2691 | you may need to clear the DC explicitly and repaint the whole window. In which | |
2692 | case, you | |
2693 | may need to call wxWindow::Refresh to invalidate the entire window. | |
7c913512 | 2694 | |
23324ae1 FM |
2695 | @library{wxcore} |
2696 | @category{events} | |
7c913512 | 2697 | |
e54c96f1 | 2698 | @see wxSize, @ref overview_eventhandlingoverview |
23324ae1 FM |
2699 | */ |
2700 | class wxSizeEvent : public wxEvent | |
2701 | { | |
2702 | public: | |
2703 | /** | |
2704 | Constructor. | |
2705 | */ | |
2706 | wxSizeEvent(const wxSize& sz, int id = 0); | |
2707 | ||
2708 | /** | |
2709 | Returns the entire size of the window generating the size change event. | |
2710 | */ | |
328f5751 | 2711 | wxSize GetSize() const; |
23324ae1 FM |
2712 | }; |
2713 | ||
2714 | ||
e54c96f1 | 2715 | |
23324ae1 FM |
2716 | /** |
2717 | @class wxSetCursorEvent | |
2718 | @wxheader{event.h} | |
7c913512 | 2719 | |
23324ae1 FM |
2720 | A SetCursorEvent is generated when the mouse cursor is about to be set as a |
2721 | result of mouse motion. This event gives the application the chance to perform | |
2722 | specific mouse cursor processing based on the current position of the mouse | |
2723 | within the window. Use wxSetCursorEvent::SetCursor to | |
2724 | specify the cursor you want to be displayed. | |
7c913512 | 2725 | |
23324ae1 FM |
2726 | @library{wxcore} |
2727 | @category{FIXME} | |
7c913512 | 2728 | |
e54c96f1 | 2729 | @see ::wxSetCursor, wxWindow::wxSetCursor |
23324ae1 FM |
2730 | */ |
2731 | class wxSetCursorEvent : public wxEvent | |
2732 | { | |
2733 | public: | |
2734 | /** | |
2735 | Constructor, used by the library itself internally to initialize the event | |
2736 | object. | |
2737 | */ | |
2738 | wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0); | |
2739 | ||
2740 | /** | |
2741 | Returns a reference to the cursor specified by this event. | |
2742 | */ | |
328f5751 | 2743 | wxCursor GetCursor() const; |
23324ae1 FM |
2744 | |
2745 | /** | |
2746 | Returns the X coordinate of the mouse in client coordinates. | |
2747 | */ | |
328f5751 | 2748 | wxCoord GetX() const; |
23324ae1 FM |
2749 | |
2750 | /** | |
2751 | Returns the Y coordinate of the mouse in client coordinates. | |
2752 | */ | |
328f5751 | 2753 | wxCoord GetY() const; |
23324ae1 FM |
2754 | |
2755 | /** | |
2756 | Returns @true if the cursor specified by this event is a valid cursor. | |
2757 | ||
2758 | @remarks You cannot specify wxNullCursor with this event, as it is not | |
4cc4bfaf | 2759 | considered a valid cursor. |
23324ae1 | 2760 | */ |
328f5751 | 2761 | bool HasCursor() const; |
23324ae1 FM |
2762 | |
2763 | /** | |
2764 | Sets the cursor associated with this event. | |
2765 | */ | |
2766 | void SetCursor(const wxCursor& cursor); | |
2767 | }; | |
e54c96f1 | 2768 | |
39fb8056 FM |
2769 | |
2770 | ||
2771 | /** | |
2772 | In a GUI application, this function posts @a event to the specified @e dest | |
2773 | object using wxEvtHandler::AddPendingEvent. | |
2774 | ||
2775 | Otherwise, it dispatches @a event immediately using wxEvtHandler::ProcessEvent. | |
2776 | See the respective documentation for details (and caveats). | |
2777 | */ | |
2778 | void wxPostEvent(wxEvtHandler* dest, wxEvent& event); |