]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/event.h
Split documentation of non-GUI wxEvent-related classes.
[wxWidgets.git] / interface / wx / event.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: event.h
3 // Purpose: interface of wxEvent-derived classes,
4 // see event_base.h for wxEvtHandler and wxEvent.
5 // Author: wxWidgets team
6 // RCS-ID: $Id$
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 /**
12 @class wxEventBlocker
13
14 This class is a special event handler which allows to discard
15 any event (or a set of event types) directed to a specific window.
16
17 Example:
18
19 @code
20 void MyWindow::DoSomething()
21 {
22 {
23 // block all events directed to this window while
24 // we do the 1000 FunctionWhichSendsEvents() calls
25 wxEventBlocker blocker(this);
26
27 for ( int i = 0; i 1000; i++ )
28 FunctionWhichSendsEvents(i);
29
30 } // ~wxEventBlocker called, old event handler is restored
31
32 // the event generated by this call will be processed:
33 FunctionWhichSendsEvents(0)
34 }
35 @endcode
36
37 @library{wxcore}
38 @category{events}
39
40 @see @ref overview_events_processing, wxEvtHandler
41 */
42 class wxEventBlocker : public wxEvtHandler
43 {
44 public:
45 /**
46 Constructs the blocker for the given window and for the given event type.
47
48 If @a type is @c wxEVT_ANY, then all events for that window are blocked.
49 You can call Block() after creation to add other event types to the list
50 of events to block.
51
52 Note that the @a win window @b must remain alive until the
53 wxEventBlocker object destruction.
54 */
55 wxEventBlocker(wxWindow* win, wxEventType type = -1);
56
57 /**
58 Destructor. The blocker will remove itself from the chain of event handlers for
59 the window provided in the constructor, thus restoring normal processing of events.
60 */
61 virtual ~wxEventBlocker();
62
63 /**
64 Adds to the list of event types which should be blocked the given @a eventType.
65 */
66 void Block(wxEventType eventType);
67 };
68
69
70
71 /**
72 Helper class to temporarily change an event to not propagate.
73 */
74 class wxPropagationDisabler
75 {
76 public:
77 wxPropagationDisabler(wxEvent& event);
78 ~wxPropagationDisabler();
79 };
80
81
82 /**
83 Helper class to temporarily lower propagation level.
84 */
85 class wxPropagateOnce
86 {
87 public:
88 wxPropagateOnce(wxEvent& event);
89 ~wxPropagateOnce();
90 };
91
92
93
94 /**
95 Flags for categories of keys.
96
97 These values are used by wxKeyEvent::IsKeyInCategory(). They may be
98 combined via the bitwise operators |, &, and ~.
99
100 @since 2.9.1
101 */
102 enum wxKeyCategoryFlags
103 {
104 /// arrow keys, on and off numeric keypads
105 WXK_CATEGORY_ARROW,
106
107 /// page up and page down keys, on and off numeric keypads
108 WXK_CATEGORY_PAGING,
109
110 /// home and end keys, on and off numeric keypads
111 WXK_CATEGORY_JUMP,
112
113 /// tab key, on and off numeric keypads
114 WXK_CATEGORY_TAB,
115
116 /// backspace and delete keys, on and off numeric keypads
117 WXK_CATEGORY_CUT,
118
119 /// union of WXK_CATEGORY_ARROW, WXK_CATEGORY_PAGING, and WXK_CATEGORY_JUMP categories
120 WXK_CATEGORY_NAVIGATION
121 };
122
123
124 /**
125 @class wxKeyEvent
126
127 This event class contains information about key press and release events.
128
129 The main information carried by this event is the key being pressed or
130 released. It can be accessed using either GetKeyCode() function or
131 GetUnicodeKey(). For the printable characters, the latter should be used as
132 it works for any keys, including non-Latin-1 characters that can be entered
133 when using national keyboard layouts. GetKeyCode() should be used to handle
134 special characters (such as cursor arrows keys or @c HOME or @c INS and so
135 on) which correspond to ::wxKeyCode enum elements above the @c WXK_START
136 constant. While GetKeyCode() also returns the character code for Latin-1
137 keys for compatibility, it doesn't work for Unicode characters in general
138 and will return @c WXK_NONE for any non-Latin-1 ones. For this reason, it's
139 recommended to always use GetUnicodeKey() and only fall back to GetKeyCode()
140 if GetUnicodeKey() returned @c WXK_NONE meaning that the event corresponds
141 to a non-printable special keys.
142
143 While both of these functions can be used with the events of @c
144 wxEVT_KEY_DOWN, @c wxEVT_KEY_UP and @c wxEVT_CHAR types, the values
145 returned by them are different for the first two events and the last one.
146 For the latter, the key returned corresponds to the character that would
147 appear in e.g. a text zone if the user pressed the key in it. As such, its
148 value depends on the current state of the Shift key and, for the letters,
149 on the state of Caps Lock modifier. For example, if @c A key is pressed
150 without Shift being held down, wxKeyEvent of type @c wxEVT_CHAR generated
151 for this key press will return (from either GetKeyCode() or GetUnicodeKey()
152 as their meanings coincide for ASCII characters) key code of 97
153 corresponding the ASCII value of @c a. And if the same key is pressed but
154 with Shift being held (or Caps Lock being active), then the key could would
155 be 65, i.e. ASCII value of capital @c A.
156
157 However for the key down and up events the returned key code will instead
158 be @c A independently of the state of the modifier keys i.e. it depends
159 only on physical key being pressed and is not translated to its logical
160 representation using the current keyboard state. Such untranslated key
161 codes are defined as follows:
162 - For the letters they correspond to the @e upper case value of the
163 letter.
164 - For the other alphanumeric keys (e.g. @c 7 or @c +), the untranslated
165 key code corresponds to the character produced by the key when it is
166 pressed without Shift. E.g. in standard US keyboard layout the
167 untranslated key code for the key @c =/+ in the upper right corner of
168 the keyboard is 61 which is the ASCII value of @c =.
169 - For the rest of the keys (i.e. special non-printable keys) it is the
170 same as the normal key code as no translation is used anyhow.
171
172 Notice that the first rule applies to all Unicode letters, not just the
173 usual Latin-1 ones. However for non-Latin-1 letters only GetUnicodeKey()
174 can be used to retrieve the key code as GetKeyCode() just returns @c
175 WXK_NONE in this case.
176
177 To summarize: you should handle @c wxEVT_CHAR if you need the translated
178 key and @c wxEVT_KEY_DOWN if you only need the value of the key itself,
179 independent of the current keyboard state.
180
181 @note Not all key down events may be generated by the user. As an example,
182 @c wxEVT_KEY_DOWN with @c = key code can be generated using the
183 standard US keyboard layout but not using the German one because the @c
184 = key corresponds to Shift-0 key combination in this layout and the key
185 code for it is @c 0, not @c =. Because of this you should avoid
186 requiring your users to type key events that might be impossible to
187 enter on their keyboard.
188
189
190 Another difference between key and char events is that another kind of
191 translation is done for the latter ones when the Control key is pressed:
192 char events for ASCII letters in this case carry codes corresponding to the
193 ASCII value of Ctrl-Latter, i.e. 1 for Ctrl-A, 2 for Ctrl-B and so on until
194 26 for Ctrl-Z. This is convenient for terminal-like applications and can be
195 completely ignored by all the other ones (if you need to handle Ctrl-A it
196 is probably a better idea to use the key event rather than the char one).
197 Notice that currently no translation is done for the presses of @c [, @c
198 \\, @c ], @c ^ and @c _ keys which might be mapped to ASCII values from 27
199 to 31.
200 Since version 2.9.2, the enum values @c WXK_CONTROL_A - @c WXK_CONTROL_Z
201 can be used instead of the non-descriptive constant values 1-26.
202
203 Finally, modifier keys only generate key events but no char events at all.
204 The modifiers keys are @c WXK_SHIFT, @c WXK_CONTROL, @c WXK_ALT and various
205 @c WXK_WINDOWS_XXX from ::wxKeyCode enum.
206
207 Modifier keys events are special in one additional aspect: usually the
208 keyboard state associated with a key press is well defined, e.g.
209 wxKeyboardState::ShiftDown() returns @c true only if the Shift key was held
210 pressed when the key that generated this event itself was pressed. There is
211 an ambiguity for the key press events for Shift key itself however. By
212 convention, it is considered to be already pressed when it is pressed and
213 already released when it is released. In other words, @c wxEVT_KEY_DOWN
214 event for the Shift key itself will have @c wxMOD_SHIFT in GetModifiers()
215 and ShiftDown() will return true while the @c wxEVT_KEY_UP event for Shift
216 itself will not have @c wxMOD_SHIFT in its modifiers and ShiftDown() will
217 return false.
218
219
220 @b Tip: You may discover the key codes and modifiers generated by all the
221 keys on your system interactively by running the @ref
222 page_samples_keyboard wxWidgets sample and pressing some keys in it.
223
224 @note If a key down (@c EVT_KEY_DOWN) event is caught and the event handler
225 does not call @c event.Skip() then the corresponding char event
226 (@c EVT_CHAR) will not happen. This is by design and enables the
227 programs that handle both types of events to avoid processing the
228 same key twice. As a consequence, if you do not want to suppress the
229 @c wxEVT_CHAR events for the keys you handle, always call @c
230 event.Skip() in your @c wxEVT_KEY_DOWN handler. Not doing may also
231 prevent accelerators defined using this key from working.
232
233 @note If a key is maintained in a pressed state, you will typically get a
234 lot of (automatically generated) key down events but only one key up
235 one at the end when the key is released so it is wrong to assume that
236 there is one up event corresponding to each down one.
237
238 @note For Windows programmers: The key and char events in wxWidgets are
239 similar to but slightly different from Windows @c WM_KEYDOWN and
240 @c WM_CHAR events. In particular, Alt-x combination will generate a
241 char event in wxWidgets (unless it is used as an accelerator) and
242 almost all keys, including ones without ASCII equivalents, generate
243 char events too.
244
245
246 @beginEventTable{wxKeyEvent}
247 @event{EVT_KEY_DOWN(func)}
248 Process a @c wxEVT_KEY_DOWN event (any key has been pressed). If this
249 event is handled and not skipped, @c wxEVT_CHAR will not be generated
250 at all for this key press (but @c wxEVT_KEY_UP will be).
251 @event{EVT_KEY_UP(func)}
252 Process a @c wxEVT_KEY_UP event (any key has been released).
253 @event{EVT_CHAR(func)}
254 Process a @c wxEVT_CHAR event.
255 @event{EVT_CHAR_HOOK(func)}
256 Process a @c wxEVT_CHAR_HOOK event. Unlike all the other key events,
257 this event is propagated upwards the window hierarchy which allows
258 intercepting it in the parent window of the focused window to which it
259 is sent initially (if there is no focused window, this event is sent to
260 the wxApp global object). It is also generated before any other key
261 events and so gives the parent window an opportunity to modify the
262 keyboard handling of its children, e.g. it is used internally by
263 wxWidgets in some ports to intercept pressing Esc key in any child of a
264 dialog to close the dialog itself when it's pressed. By default, if
265 this event is handled, i.e. the handler doesn't call wxEvent::Skip(),
266 neither @c wxEVT_KEY_DOWN nor @c wxEVT_CHAR events will be generated
267 (although @c wxEVT_KEY_UP still will be), i.e. it replaces the normal
268 key events. However by calling the special DoAllowNextEvent() method
269 you can handle @c wxEVT_CHAR_HOOK and still allow normal events
270 generation. This is something that is rarely useful but can be required
271 if you need to prevent a parent @c wxEVT_CHAR_HOOK handler from running
272 without suppressing the normal key events. Finally notice that this
273 event is not generated when the mouse is captured as it is considered
274 that the window which has the capture should receive all the keyboard
275 events too without allowing its parent wxTopLevelWindow to interfere
276 with their processing.
277 @endEventTable
278
279 @see wxKeyboardState
280
281 @library{wxcore}
282 @category{events}
283 */
284 class wxKeyEvent : public wxEvent,
285 public wxKeyboardState
286 {
287 public:
288 /**
289 Constructor.
290 Currently, the only valid event types are @c wxEVT_CHAR and @c wxEVT_CHAR_HOOK.
291 */
292 wxKeyEvent(wxEventType keyEventType = wxEVT_NULL);
293
294 /**
295 Returns the key code of the key that generated this event.
296
297 ASCII symbols return normal ASCII values, while events from special
298 keys such as "left cursor arrow" (@c WXK_LEFT) return values outside of
299 the ASCII range. See ::wxKeyCode for a full list of the virtual key
300 codes.
301
302 Note that this method returns a meaningful value only for special
303 non-alphanumeric keys or if the user entered a Latin-1 character (this
304 includes ASCII and the accented letters found in Western European
305 languages but not letters of other alphabets such as e.g. Cyrillic).
306 Otherwise it simply method returns @c WXK_NONE and GetUnicodeKey()
307 should be used to obtain the corresponding Unicode character.
308
309 Using GetUnicodeKey() is in general the right thing to do if you are
310 interested in the characters typed by the user, GetKeyCode() should be
311 only used for special keys (for which GetUnicodeKey() returns @c
312 WXK_NONE). To handle both kinds of keys you might write:
313 @code
314 void MyHandler::OnChar(wxKeyEvent& event)
315 {
316 wxChar uc = event.GetUnicodeKey();
317 if ( uc != WXK_NONE )
318 {
319 // It's a "normal" character. Notice that this includes
320 // control characters in 1..31 range, e.g. WXK_RETURN or
321 // WXK_BACK, so check for them explicitly.
322 if ( uc >= 32 )
323 {
324 wxLogMessage("You pressed '%c'", uc);
325 }
326 else
327 {
328 // It's a control character
329 ...
330 }
331 }
332 else // No Unicode equivalent.
333 {
334 // It's a special key, deal with all the known ones:
335 switch ( GetKeyCode() )
336 {
337 case WXK_LEFT:
338 case WXK_RIGHT:
339 ... move cursor ...
340 break;
341
342 case WXK_F1:
343 ... give help ...
344 break;
345 }
346 }
347 }
348 @endcode
349 */
350 int GetKeyCode() const;
351
352 /**
353 Returns true if the key is in the given key category.
354
355 @param category
356 A bitwise combination of named ::wxKeyCategoryFlags constants.
357
358 @since 2.9.1
359 */
360 bool IsKeyInCategory(int category) const;
361
362 //@{
363 /**
364 Obtains the position (in client coordinates) at which the key was pressed.
365
366 Notice that this position is simply the current mouse pointer position
367 and has no special relationship to the key event itself.
368 */
369 wxPoint GetPosition() const;
370 void GetPosition(long* x, long* y) const;
371 //@}
372
373 /**
374 Returns the raw key code for this event.
375
376 The flags are platform-dependent and should only be used if the
377 functionality provided by other wxKeyEvent methods is insufficient.
378
379 Under MSW, the raw key code is the value of @c wParam parameter of the
380 corresponding message.
381
382 Under GTK, the raw key code is the @c keyval field of the corresponding
383 GDK event.
384
385 Under OS X, the raw key code is the @c keyCode field of the
386 corresponding NSEvent.
387
388 @note Currently the raw key codes are not supported by all ports, use
389 @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available.
390 */
391 wxUint32 GetRawKeyCode() const;
392
393 /**
394 Returns the low level key flags for this event.
395
396 The flags are platform-dependent and should only be used if the
397 functionality provided by other wxKeyEvent methods is insufficient.
398
399 Under MSW, the raw flags are just the value of @c lParam parameter of
400 the corresponding message.
401
402 Under GTK, the raw flags contain the @c hardware_keycode field of the
403 corresponding GDK event.
404
405 Under OS X, the raw flags contain the modifiers state.
406
407 @note Currently the raw key flags are not supported by all ports, use
408 @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available.
409 */
410 wxUint32 GetRawKeyFlags() const;
411
412 /**
413 Returns the Unicode character corresponding to this key event.
414
415 If the key pressed doesn't have any character value (e.g. a cursor key)
416 this method will return @c WXK_NONE. In this case you should use
417 GetKeyCode() to retrieve the value of the key.
418
419 This function is only available in Unicode build, i.e. when
420 @c wxUSE_UNICODE is 1.
421 */
422 wxChar GetUnicodeKey() const;
423
424 /**
425 Returns the X position (in client coordinates) of the event.
426
427 @see GetPosition()
428 */
429 wxCoord GetX() const;
430
431 /**
432 Returns the Y position (in client coordinates) of the event.
433
434 @see GetPosition()
435 */
436 wxCoord GetY() const;
437
438 /**
439 Allow normal key events generation.
440
441 Can be called from @c wxEVT_CHAR_HOOK handler to indicate that the
442 generation of normal events should @em not be suppressed, as it happens
443 by default when this event is handled.
444
445 The intended use of this method is to allow some window object to
446 prevent @c wxEVT_CHAR_HOOK handler in its parent window from running by
447 defining its own handler for this event. Without calling this method,
448 this would result in not generating @c wxEVT_KEY_DOWN nor @c wxEVT_CHAR
449 events at all but by calling it you can ensure that these events would
450 still be generated, even if @c wxEVT_CHAR_HOOK event was handled.
451
452 @since 2.9.3
453 */
454 void DoAllowNextEvent();
455
456 /**
457 Returns @true if DoAllowNextEvent() had been called, @false by default.
458
459 This method is used by wxWidgets itself to determine whether the normal
460 key events should be generated after @c wxEVT_CHAR_HOOK processing.
461
462 @since 2.9.3
463 */
464 bool IsNextEventAllowed() const;
465 };
466
467
468
469 enum
470 {
471 wxJOYSTICK1,
472 wxJOYSTICK2
473 };
474
475 // Which button is down?
476 enum
477 {
478 wxJOY_BUTTON_ANY = -1,
479 wxJOY_BUTTON1 = 1,
480 wxJOY_BUTTON2 = 2,
481 wxJOY_BUTTON3 = 4,
482 wxJOY_BUTTON4 = 8
483 };
484
485
486 /**
487 @class wxJoystickEvent
488
489 This event class contains information about joystick events, particularly
490 events received by windows.
491
492 @beginEventTable{wxJoystickEvent}
493 @event{EVT_JOY_BUTTON_DOWN(func)}
494 Process a @c wxEVT_JOY_BUTTON_DOWN event.
495 @event{EVT_JOY_BUTTON_UP(func)}
496 Process a @c wxEVT_JOY_BUTTON_UP event.
497 @event{EVT_JOY_MOVE(func)}
498 Process a @c wxEVT_JOY_MOVE event.
499 @event{EVT_JOY_ZMOVE(func)}
500 Process a @c wxEVT_JOY_ZMOVE event.
501 @event{EVT_JOYSTICK_EVENTS(func)}
502 Processes all joystick events.
503 @endEventTable
504
505 @library{wxcore}
506 @category{events}
507
508 @see wxJoystick
509 */
510 class wxJoystickEvent : public wxEvent
511 {
512 public:
513 /**
514 Constructor.
515 */
516 wxJoystickEvent(wxEventType eventType = wxEVT_NULL, int state = 0,
517 int joystick = wxJOYSTICK1,
518 int change = 0);
519
520 /**
521 Returns @true if the event was a down event from the specified button
522 (or any button).
523
524 @param button
525 Can be @c wxJOY_BUTTONn where @c n is 1, 2, 3 or 4; or @c wxJOY_BUTTON_ANY to
526 indicate any button down event.
527 */
528 bool ButtonDown(int button = wxJOY_BUTTON_ANY) const;
529
530 /**
531 Returns @true if the specified button (or any button) was in a down state.
532
533 @param button
534 Can be @c wxJOY_BUTTONn where @c n is 1, 2, 3 or 4; or @c wxJOY_BUTTON_ANY to
535 indicate any button down event.
536 */
537 bool ButtonIsDown(int button = wxJOY_BUTTON_ANY) const;
538
539 /**
540 Returns @true if the event was an up event from the specified button
541 (or any button).
542
543 @param button
544 Can be @c wxJOY_BUTTONn where @c n is 1, 2, 3 or 4; or @c wxJOY_BUTTON_ANY to
545 indicate any button down event.
546 */
547 bool ButtonUp(int button = wxJOY_BUTTON_ANY) const;
548
549 /**
550 Returns the identifier of the button changing state.
551
552 This is a @c wxJOY_BUTTONn identifier, where @c n is one of 1, 2, 3, 4.
553 */
554 int GetButtonChange() const;
555
556 /**
557 Returns the down state of the buttons.
558
559 This is a @c wxJOY_BUTTONn identifier, where @c n is one of 1, 2, 3, 4.
560 */
561 int GetButtonState() const;
562
563 /**
564 Returns the identifier of the joystick generating the event - one of
565 wxJOYSTICK1 and wxJOYSTICK2.
566 */
567 int GetJoystick() const;
568
569 /**
570 Returns the x, y position of the joystick event.
571
572 These coordinates are valid for all the events except wxEVT_JOY_ZMOVE.
573 */
574 wxPoint GetPosition() const;
575
576 /**
577 Returns the z position of the joystick event.
578
579 This method can only be used for wxEVT_JOY_ZMOVE events.
580 */
581 int GetZPosition() const;
582
583 /**
584 Returns @true if this was a button up or down event
585 (@e not 'is any button down?').
586 */
587 bool IsButton() const;
588
589 /**
590 Returns @true if this was an x, y move event.
591 */
592 bool IsMove() const;
593
594 /**
595 Returns @true if this was a z move event.
596 */
597 bool IsZMove() const;
598 };
599
600
601
602 /**
603 @class wxScrollWinEvent
604
605 A scroll event holds information about events sent from scrolling windows.
606
607 Note that you can use the EVT_SCROLLWIN* macros for intercepting scroll window events
608 from the receiving window.
609
610 @beginEventTable{wxScrollWinEvent}
611 @event{EVT_SCROLLWIN(func)}
612 Process all scroll events.
613 @event{EVT_SCROLLWIN_TOP(func)}
614 Process @c wxEVT_SCROLLWIN_TOP scroll-to-top events.
615 @event{EVT_SCROLLWIN_BOTTOM(func)}
616 Process @c wxEVT_SCROLLWIN_BOTTOM scroll-to-bottom events.
617 @event{EVT_SCROLLWIN_LINEUP(func)}
618 Process @c wxEVT_SCROLLWIN_LINEUP line up events.
619 @event{EVT_SCROLLWIN_LINEDOWN(func)}
620 Process @c wxEVT_SCROLLWIN_LINEDOWN line down events.
621 @event{EVT_SCROLLWIN_PAGEUP(func)}
622 Process @c wxEVT_SCROLLWIN_PAGEUP page up events.
623 @event{EVT_SCROLLWIN_PAGEDOWN(func)}
624 Process @c wxEVT_SCROLLWIN_PAGEDOWN page down events.
625 @event{EVT_SCROLLWIN_THUMBTRACK(func)}
626 Process @c wxEVT_SCROLLWIN_THUMBTRACK thumbtrack events
627 (frequent events sent as the user drags the thumbtrack).
628 @event{EVT_SCROLLWIN_THUMBRELEASE(func)}
629 Process @c wxEVT_SCROLLWIN_THUMBRELEASE thumb release events.
630 @endEventTable
631
632
633 @library{wxcore}
634 @category{events}
635
636 @see wxScrollEvent, @ref overview_events
637 */
638 class wxScrollWinEvent : public wxEvent
639 {
640 public:
641 /**
642 Constructor.
643 */
644 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, int pos = 0,
645 int orientation = 0);
646
647 /**
648 Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the
649 scrollbar.
650
651 @todo wxHORIZONTAL and wxVERTICAL should go in their own enum
652 */
653 int GetOrientation() const;
654
655 /**
656 Returns the position of the scrollbar for the thumb track and release events.
657
658 Note that this field can't be used for the other events, you need to query
659 the window itself for the current position in that case.
660 */
661 int GetPosition() const;
662
663 void SetOrientation(int orient);
664 void SetPosition(int pos);
665 };
666
667
668
669 /**
670 @class wxSysColourChangedEvent
671
672 This class is used for system colour change events, which are generated
673 when the user changes the colour settings using the control panel.
674 This is only appropriate under Windows.
675
676 @remarks
677 The default event handler for this event propagates the event to child windows,
678 since Windows only sends the events to top-level windows.
679 If intercepting this event for a top-level window, remember to call the base
680 class handler, or to pass the event on to the window's children explicitly.
681
682 @beginEventTable{wxSysColourChangedEvent}
683 @event{EVT_SYS_COLOUR_CHANGED(func)}
684 Process a @c wxEVT_SYS_COLOUR_CHANGED event.
685 @endEventTable
686
687 @library{wxcore}
688 @category{events}
689
690 @see @ref overview_events
691 */
692 class wxSysColourChangedEvent : public wxEvent
693 {
694 public:
695 /**
696 Constructor.
697 */
698 wxSysColourChangedEvent();
699 };
700
701
702
703 /**
704 @class wxWindowCreateEvent
705
706 This event is sent just after the actual window associated with a wxWindow
707 object has been created.
708
709 Since it is derived from wxCommandEvent, the event propagates up
710 the window hierarchy.
711
712 @beginEventTable{wxWindowCreateEvent}
713 @event{EVT_WINDOW_CREATE(func)}
714 Process a @c wxEVT_CREATE event.
715 @endEventTable
716
717 @library{wxcore}
718 @category{events}
719
720 @see @ref overview_events, wxWindowDestroyEvent
721 */
722 class wxWindowCreateEvent : public wxCommandEvent
723 {
724 public:
725 /**
726 Constructor.
727 */
728 wxWindowCreateEvent(wxWindow* win = NULL);
729
730 /// Return the window being created.
731 wxWindow *GetWindow() const;
732 };
733
734
735
736 /**
737 @class wxPaintEvent
738
739 A paint event is sent when a window's contents needs to be repainted.
740
741 The handler of this event must create a wxPaintDC object and use it for
742 painting the window contents. For example:
743 @code
744 void MyWindow::OnPaint(wxPaintEvent& event)
745 {
746 wxPaintDC dc(this);
747
748 DrawMyDocument(dc);
749 }
750 @endcode
751
752 Notice that you must @e not create other kinds of wxDC (e.g. wxClientDC or
753 wxWindowDC) in EVT_PAINT handlers and also don't create wxPaintDC outside
754 of this event handlers.
755
756
757 You can optimize painting by retrieving the rectangles that have been damaged
758 and only repainting these. The rectangles are in terms of the client area,
759 and are unscrolled, so you will need to do some calculations using the current
760 view position to obtain logical, scrolled units.
761 Here is an example of using the wxRegionIterator class:
762 @code
763 // Called when window needs to be repainted.
764 void MyWindow::OnPaint(wxPaintEvent& event)
765 {
766 wxPaintDC dc(this);
767
768 // Find Out where the window is scrolled to
769 int vbX,vbY; // Top left corner of client
770 GetViewStart(&vbX,&vbY);
771
772 int vX,vY,vW,vH; // Dimensions of client area in pixels
773 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
774
775 while (upd)
776 {
777 vX = upd.GetX();
778 vY = upd.GetY();
779 vW = upd.GetW();
780 vH = upd.GetH();
781
782 // Alternatively we can do this:
783 // wxRect rect(upd.GetRect());
784
785 // Repaint this rectangle
786 ...some code...
787
788 upd ++ ;
789 }
790 }
791 @endcode
792
793 @remarks
794 Please notice that in general it is impossible to change the drawing of a
795 standard control (such as wxButton) and so you shouldn't attempt to handle
796 paint events for them as even if it might work on some platforms, this is
797 inherently not portable and won't work everywhere.
798
799
800 @beginEventTable{wxPaintEvent}
801 @event{EVT_PAINT(func)}
802 Process a @c wxEVT_PAINT event.
803 @endEventTable
804
805 @library{wxcore}
806 @category{events}
807
808 @see @ref overview_events
809 */
810 class wxPaintEvent : public wxEvent
811 {
812 public:
813 /**
814 Constructor.
815 */
816 wxPaintEvent(int id = 0);
817 };
818
819
820
821 /**
822 @class wxMaximizeEvent
823
824 An event being sent when a top level window is maximized. Notice that it is
825 not sent when the window is restored to its original size after it had been
826 maximized, only a normal wxSizeEvent is generated in this case.
827
828 Currently this event is only generated in wxMSW, wxGTK, wxOSX/Cocoa and wxOS2
829 ports so portable programs should only rely on receiving @c wxEVT_SIZE and
830 not necessarily this event when the window is maximized.
831
832 @beginEventTable{wxMaximizeEvent}
833 @event{EVT_MAXIMIZE(func)}
834 Process a @c wxEVT_MAXIMIZE event.
835 @endEventTable
836
837 @library{wxcore}
838 @category{events}
839
840 @see @ref overview_events, wxTopLevelWindow::Maximize,
841 wxTopLevelWindow::IsMaximized
842 */
843 class wxMaximizeEvent : public wxEvent
844 {
845 public:
846 /**
847 Constructor. Only used by wxWidgets internally.
848 */
849 wxMaximizeEvent(int id = 0);
850 };
851
852 /**
853 The possibles modes to pass to wxUpdateUIEvent::SetMode().
854 */
855 enum wxUpdateUIMode
856 {
857 /** Send UI update events to all windows. */
858 wxUPDATE_UI_PROCESS_ALL,
859
860 /** Send UI update events to windows that have
861 the wxWS_EX_PROCESS_UI_UPDATES flag specified. */
862 wxUPDATE_UI_PROCESS_SPECIFIED
863 };
864
865
866 /**
867 @class wxUpdateUIEvent
868
869 This class is used for pseudo-events which are called by wxWidgets
870 to give an application the chance to update various user interface elements.
871
872 Without update UI events, an application has to work hard to check/uncheck,
873 enable/disable, show/hide, and set the text for elements such as menu items
874 and toolbar buttons. The code for doing this has to be mixed up with the code
875 that is invoked when an action is invoked for a menu item or button.
876
877 With update UI events, you define an event handler to look at the state of the
878 application and change UI elements accordingly. wxWidgets will call your member
879 functions in idle time, so you don't have to worry where to call this code.
880
881 In addition to being a clearer and more declarative method, it also means you don't
882 have to worry whether you're updating a toolbar or menubar identifier. The same
883 handler can update a menu item and toolbar button, if the identifier is the same.
884 Instead of directly manipulating the menu or button, you call functions in the event
885 object, such as wxUpdateUIEvent::Check. wxWidgets will determine whether such a
886 call has been made, and which UI element to update.
887
888 These events will work for popup menus as well as menubars. Just before a menu is
889 popped up, wxMenu::UpdateUI is called to process any UI events for the window that
890 owns the menu.
891
892 If you find that the overhead of UI update processing is affecting your application,
893 you can do one or both of the following:
894 @li Call wxUpdateUIEvent::SetMode with a value of wxUPDATE_UI_PROCESS_SPECIFIED,
895 and set the extra style wxWS_EX_PROCESS_UI_UPDATES for every window that should
896 receive update events. No other windows will receive update events.
897 @li Call wxUpdateUIEvent::SetUpdateInterval with a millisecond value to set the delay
898 between updates. You may need to call wxWindow::UpdateWindowUI at critical points,
899 for example when a dialog is about to be shown, in case the user sees a slight
900 delay before windows are updated.
901
902 Note that although events are sent in idle time, defining a wxIdleEvent handler
903 for a window does not affect this because the events are sent from wxWindow::OnInternalIdle
904 which is always called in idle time.
905
906 wxWidgets tries to optimize update events on some platforms.
907 On Windows and GTK+, events for menubar items are only sent when the menu is about
908 to be shown, and not in idle time.
909
910
911 @beginEventTable{wxUpdateUIEvent}
912 @event{EVT_UPDATE_UI(id, func)}
913 Process a @c wxEVT_UPDATE_UI event for the command with the given id.
914 @event{EVT_UPDATE_UI_RANGE(id1, id2, func)}
915 Process a @c wxEVT_UPDATE_UI event for any command with id included in the given range.
916 @endEventTable
917
918 @library{wxcore}
919 @category{events}
920
921 @see @ref overview_events
922 */
923 class wxUpdateUIEvent : public wxCommandEvent
924 {
925 public:
926 /**
927 Constructor.
928 */
929 wxUpdateUIEvent(wxWindowID commandId = 0);
930
931 /**
932 Returns @true if it is appropriate to update (send UI update events to)
933 this window.
934
935 This function looks at the mode used (see wxUpdateUIEvent::SetMode),
936 the wxWS_EX_PROCESS_UI_UPDATES flag in @a window, the time update events
937 were last sent in idle time, and the update interval, to determine whether
938 events should be sent to this window now. By default this will always
939 return @true because the update mode is initially wxUPDATE_UI_PROCESS_ALL
940 and the interval is set to 0; so update events will be sent as often as
941 possible. You can reduce the frequency that events are sent by changing the
942 mode and/or setting an update interval.
943
944 @see ResetUpdateTime(), SetUpdateInterval(), SetMode()
945 */
946 static bool CanUpdate(wxWindow* window);
947
948 /**
949 Check or uncheck the UI element.
950 */
951 void Check(bool check);
952
953 /**
954 Enable or disable the UI element.
955 */
956 void Enable(bool enable);
957
958 /**
959 Returns @true if the UI element should be checked.
960 */
961 bool GetChecked() const;
962
963 /**
964 Returns @true if the UI element should be enabled.
965 */
966 bool GetEnabled() const;
967
968 /**
969 Static function returning a value specifying how wxWidgets will send update
970 events: to all windows, or only to those which specify that they will process
971 the events.
972
973 @see SetMode()
974 */
975 static wxUpdateUIMode GetMode();
976
977 /**
978 Returns @true if the application has called Check().
979 For wxWidgets internal use only.
980 */
981 bool GetSetChecked() const;
982
983 /**
984 Returns @true if the application has called Enable().
985 For wxWidgets internal use only.
986 */
987 bool GetSetEnabled() const;
988
989 /**
990 Returns @true if the application has called Show().
991 For wxWidgets internal use only.
992 */
993 bool GetSetShown() const;
994
995 /**
996 Returns @true if the application has called SetText().
997 For wxWidgets internal use only.
998 */
999 bool GetSetText() const;
1000
1001 /**
1002 Returns @true if the UI element should be shown.
1003 */
1004 bool GetShown() const;
1005
1006 /**
1007 Returns the text that should be set for the UI element.
1008 */
1009 wxString GetText() const;
1010
1011 /**
1012 Returns the current interval between updates in milliseconds.
1013 The value -1 disables updates, 0 updates as frequently as possible.
1014
1015 @see SetUpdateInterval().
1016 */
1017 static long GetUpdateInterval();
1018
1019 /**
1020 Used internally to reset the last-updated time to the current time.
1021
1022 It is assumed that update events are normally sent in idle time, so this
1023 is called at the end of idle processing.
1024
1025 @see CanUpdate(), SetUpdateInterval(), SetMode()
1026 */
1027 static void ResetUpdateTime();
1028
1029 /**
1030 Specify how wxWidgets will send update events: to all windows, or only to
1031 those which specify that they will process the events.
1032
1033 @param mode
1034 this parameter may be one of the ::wxUpdateUIMode enumeration values.
1035 The default mode is wxUPDATE_UI_PROCESS_ALL.
1036 */
1037 static void SetMode(wxUpdateUIMode mode);
1038
1039 /**
1040 Sets the text for this UI element.
1041 */
1042 void SetText(const wxString& text);
1043
1044 /**
1045 Sets the interval between updates in milliseconds.
1046
1047 Set to -1 to disable updates, or to 0 to update as frequently as possible.
1048 The default is 0.
1049
1050 Use this to reduce the overhead of UI update events if your application
1051 has a lot of windows. If you set the value to -1 or greater than 0,
1052 you may also need to call wxWindow::UpdateWindowUI at appropriate points
1053 in your application, such as when a dialog is about to be shown.
1054 */
1055 static void SetUpdateInterval(long updateInterval);
1056
1057 /**
1058 Show or hide the UI element.
1059 */
1060 void Show(bool show);
1061 };
1062
1063
1064
1065 /**
1066 @class wxClipboardTextEvent
1067
1068 This class represents the events generated by a control (typically a
1069 wxTextCtrl but other windows can generate these events as well) when its
1070 content gets copied or cut to, or pasted from the clipboard.
1071
1072 There are three types of corresponding events @c wxEVT_COMMAND_TEXT_COPY,
1073 @c wxEVT_COMMAND_TEXT_CUT and @c wxEVT_COMMAND_TEXT_PASTE.
1074
1075 If any of these events is processed (without being skipped) by an event
1076 handler, the corresponding operation doesn't take place which allows to
1077 prevent the text from being copied from or pasted to a control. It is also
1078 possible to examine the clipboard contents in the PASTE event handler and
1079 transform it in some way before inserting in a control -- for example,
1080 changing its case or removing invalid characters.
1081
1082 Finally notice that a CUT event is always preceded by the COPY event which
1083 makes it possible to only process the latter if it doesn't matter if the
1084 text was copied or cut.
1085
1086 @note
1087 These events are currently only generated by wxTextCtrl in wxGTK and wxOSX
1088 but are also generated by wxComboBox without wxCB_READONLY style in wxMSW.
1089
1090 @beginEventTable{wxClipboardTextEvent}
1091 @event{EVT_TEXT_COPY(id, func)}
1092 Some or all of the controls content was copied to the clipboard.
1093 @event{EVT_TEXT_CUT(id, func)}
1094 Some or all of the controls content was cut (i.e. copied and
1095 deleted).
1096 @event{EVT_TEXT_PASTE(id, func)}
1097 Clipboard content was pasted into the control.
1098 @endEventTable
1099
1100
1101 @library{wxcore}
1102 @category{events}
1103
1104 @see wxClipboard
1105 */
1106 class wxClipboardTextEvent : public wxCommandEvent
1107 {
1108 public:
1109 /**
1110 Constructor.
1111 */
1112 wxClipboardTextEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
1113 };
1114
1115 /**
1116 Possible axis values for mouse wheel scroll events.
1117
1118 @since 2.9.4
1119 */
1120 enum wxMouseWheelAxis
1121 {
1122 wxMOUSE_WHEEL_VERTICAL, ///< Vertical scroll event.
1123 wxMOUSE_WHEEL_HORIZONTAL ///< Horizontal scroll event.
1124 };
1125
1126
1127 /**
1128 @class wxMouseEvent
1129
1130 This event class contains information about the events generated by the mouse:
1131 they include mouse buttons press and release events and mouse move events.
1132
1133 All mouse events involving the buttons use @c wxMOUSE_BTN_LEFT for the
1134 left mouse button, @c wxMOUSE_BTN_MIDDLE for the middle one and
1135 @c wxMOUSE_BTN_RIGHT for the right one. And if the system supports more
1136 buttons, the @c wxMOUSE_BTN_AUX1 and @c wxMOUSE_BTN_AUX2 events
1137 can also be generated. Note that not all mice have even a middle button so a
1138 portable application should avoid relying on the events from it (but the right
1139 button click can be emulated using the left mouse button with the control key
1140 under Mac platforms with a single button mouse).
1141
1142 For the @c wxEVT_ENTER_WINDOW and @c wxEVT_LEAVE_WINDOW events
1143 purposes, the mouse is considered to be inside the window if it is in the
1144 window client area and not inside one of its children. In other words, the
1145 parent window receives @c wxEVT_LEAVE_WINDOW event not only when the
1146 mouse leaves the window entirely but also when it enters one of its children.
1147
1148 The position associated with a mouse event is expressed in the window
1149 coordinates of the window which generated the event, you can use
1150 wxWindow::ClientToScreen() to convert it to screen coordinates and possibly
1151 call wxWindow::ScreenToClient() next to convert it to window coordinates of
1152 another window.
1153
1154 @note Note that under Windows CE mouse enter and leave events are not natively
1155 supported by the system but are generated by wxWidgets itself. This has several
1156 drawbacks: the LEAVE_WINDOW event might be received some time after the mouse
1157 left the window and the state variables for it may have changed during this time.
1158
1159 @note Note the difference between methods like wxMouseEvent::LeftDown and
1160 the inherited wxMouseState::LeftIsDown: the former returns @true when
1161 the event corresponds to the left mouse button click while the latter
1162 returns @true if the left mouse button is currently being pressed.
1163 For example, when the user is dragging the mouse you can use
1164 wxMouseEvent::LeftIsDown to test whether the left mouse button is
1165 (still) depressed. Also, by convention, if wxMouseEvent::LeftDown
1166 returns @true, wxMouseEvent::LeftIsDown will also return @true in
1167 wxWidgets whatever the underlying GUI behaviour is (which is
1168 platform-dependent). The same applies, of course, to other mouse
1169 buttons as well.
1170
1171
1172 @beginEventTable{wxMouseEvent}
1173 @event{EVT_LEFT_DOWN(func)}
1174 Process a @c wxEVT_LEFT_DOWN event. The handler of this event should normally
1175 call event.Skip() to allow the default processing to take place as otherwise
1176 the window under mouse wouldn't get the focus.
1177 @event{EVT_LEFT_UP(func)}
1178 Process a @c wxEVT_LEFT_UP event.
1179 @event{EVT_LEFT_DCLICK(func)}
1180 Process a @c wxEVT_LEFT_DCLICK event.
1181 @event{EVT_MIDDLE_DOWN(func)}
1182 Process a @c wxEVT_MIDDLE_DOWN event.
1183 @event{EVT_MIDDLE_UP(func)}
1184 Process a @c wxEVT_MIDDLE_UP event.
1185 @event{EVT_MIDDLE_DCLICK(func)}
1186 Process a @c wxEVT_MIDDLE_DCLICK event.
1187 @event{EVT_RIGHT_DOWN(func)}
1188 Process a @c wxEVT_RIGHT_DOWN event.
1189 @event{EVT_RIGHT_UP(func)}
1190 Process a @c wxEVT_RIGHT_UP event.
1191 @event{EVT_RIGHT_DCLICK(func)}
1192 Process a @c wxEVT_RIGHT_DCLICK event.
1193 @event{EVT_MOUSE_AUX1_DOWN(func)}
1194 Process a @c wxEVT_AUX1_DOWN event.
1195 @event{EVT_MOUSE_AUX1_UP(func)}
1196 Process a @c wxEVT_AUX1_UP event.
1197 @event{EVT_MOUSE_AUX1_DCLICK(func)}
1198 Process a @c wxEVT_AUX1_DCLICK event.
1199 @event{EVT_MOUSE_AUX2_DOWN(func)}
1200 Process a @c wxEVT_AUX2_DOWN event.
1201 @event{EVT_MOUSE_AUX2_UP(func)}
1202 Process a @c wxEVT_AUX2_UP event.
1203 @event{EVT_MOUSE_AUX2_DCLICK(func)}
1204 Process a @c wxEVT_AUX2_DCLICK event.
1205 @event{EVT_MOTION(func)}
1206 Process a @c wxEVT_MOTION event.
1207 @event{EVT_ENTER_WINDOW(func)}
1208 Process a @c wxEVT_ENTER_WINDOW event.
1209 @event{EVT_LEAVE_WINDOW(func)}
1210 Process a @c wxEVT_LEAVE_WINDOW event.
1211 @event{EVT_MOUSEWHEEL(func)}
1212 Process a @c wxEVT_MOUSEWHEEL event.
1213 @event{EVT_MOUSE_EVENTS(func)}
1214 Process all mouse events.
1215 @endEventTable
1216
1217 @library{wxcore}
1218 @category{events}
1219
1220 @see wxKeyEvent
1221 */
1222 class wxMouseEvent : public wxEvent,
1223 public wxMouseState
1224 {
1225 public:
1226 /**
1227 Constructor. Valid event types are:
1228
1229 @li @c wxEVT_ENTER_WINDOW
1230 @li @c wxEVT_LEAVE_WINDOW
1231 @li @c wxEVT_LEFT_DOWN
1232 @li @c wxEVT_LEFT_UP
1233 @li @c wxEVT_LEFT_DCLICK
1234 @li @c wxEVT_MIDDLE_DOWN
1235 @li @c wxEVT_MIDDLE_UP
1236 @li @c wxEVT_MIDDLE_DCLICK
1237 @li @c wxEVT_RIGHT_DOWN
1238 @li @c wxEVT_RIGHT_UP
1239 @li @c wxEVT_RIGHT_DCLICK
1240 @li @c wxEVT_AUX1_DOWN
1241 @li @c wxEVT_AUX1_UP
1242 @li @c wxEVT_AUX1_DCLICK
1243 @li @c wxEVT_AUX2_DOWN
1244 @li @c wxEVT_AUX2_UP
1245 @li @c wxEVT_AUX2_DCLICK
1246 @li @c wxEVT_MOTION
1247 @li @c wxEVT_MOUSEWHEEL
1248 */
1249 wxMouseEvent(wxEventType mouseEventType = wxEVT_NULL);
1250
1251 /**
1252 Returns @true if the event was a first extra button double click.
1253 */
1254 bool Aux1DClick() const;
1255
1256 /**
1257 Returns @true if the first extra button mouse button changed to down.
1258 */
1259 bool Aux1Down() const;
1260
1261 /**
1262 Returns @true if the first extra button mouse button changed to up.
1263 */
1264 bool Aux1Up() const;
1265
1266 /**
1267 Returns @true if the event was a second extra button double click.
1268 */
1269 bool Aux2DClick() const;
1270
1271 /**
1272 Returns @true if the second extra button mouse button changed to down.
1273 */
1274 bool Aux2Down() const;
1275
1276 /**
1277 Returns @true if the second extra button mouse button changed to up.
1278 */
1279 bool Aux2Up() const;
1280
1281 /**
1282 Returns @true if the event was generated by the specified button.
1283
1284 @see wxMouseState::ButtoinIsDown()
1285 */
1286 bool Button(wxMouseButton but) const;
1287
1288 /**
1289 If the argument is omitted, this returns @true if the event was a mouse
1290 double click event. Otherwise the argument specifies which double click event
1291 was generated (see Button() for the possible values).
1292 */
1293 bool ButtonDClick(wxMouseButton but = wxMOUSE_BTN_ANY) const;
1294
1295 /**
1296 If the argument is omitted, this returns @true if the event was a mouse
1297 button down event. Otherwise the argument specifies which button-down event
1298 was generated (see Button() for the possible values).
1299 */
1300 bool ButtonDown(wxMouseButton but = wxMOUSE_BTN_ANY) const;
1301
1302 /**
1303 If the argument is omitted, this returns @true if the event was a mouse
1304 button up event. Otherwise the argument specifies which button-up event
1305 was generated (see Button() for the possible values).
1306 */
1307 bool ButtonUp(wxMouseButton but = wxMOUSE_BTN_ANY) const;
1308
1309 /**
1310 Returns @true if this was a dragging event (motion while a button is depressed).
1311
1312 @see Moving()
1313 */
1314 bool Dragging() const;
1315
1316 /**
1317 Returns @true if the mouse was entering the window.
1318
1319 @see Leaving()
1320 */
1321 bool Entering() const;
1322
1323 /**
1324 Returns the mouse button which generated this event or @c wxMOUSE_BTN_NONE
1325 if no button is involved (for mouse move, enter or leave event, for example).
1326 Otherwise @c wxMOUSE_BTN_LEFT is returned for the left button down, up and
1327 double click events, @c wxMOUSE_BTN_MIDDLE and @c wxMOUSE_BTN_RIGHT
1328 for the same events for the middle and the right buttons respectively.
1329 */
1330 int GetButton() const;
1331
1332 /**
1333 Returns the number of mouse clicks for this event: 1 for a simple click, 2
1334 for a double-click, 3 for a triple-click and so on.
1335
1336 Currently this function is implemented only in wxMac and returns -1 for the
1337 other platforms (you can still distinguish simple clicks from double-clicks as
1338 they generate different kinds of events however).
1339
1340 @since 2.9.0
1341 */
1342 int GetClickCount() const;
1343
1344 /**
1345 Returns the configured number of lines (or whatever) to be scrolled per
1346 wheel action. Defaults to three.
1347 */
1348 int GetLinesPerAction() const;
1349
1350 /**
1351 Returns the logical mouse position in pixels (i.e. translated according to the
1352 translation set for the DC, which usually indicates that the window has been
1353 scrolled).
1354 */
1355 wxPoint GetLogicalPosition(const wxDC& dc) const;
1356
1357 /**
1358 Get wheel delta, normally 120.
1359
1360 This is the threshold for action to be taken, and one such action
1361 (for example, scrolling one increment) should occur for each delta.
1362 */
1363 int GetWheelDelta() const;
1364
1365 /**
1366 Get wheel rotation, positive or negative indicates direction of rotation.
1367
1368 Current devices all send an event when rotation is at least +/-WheelDelta, but
1369 finer resolution devices can be created in the future.
1370
1371 Because of this you shouldn't assume that one event is equal to 1 line, but you
1372 should be able to either do partial line scrolling or wait until several
1373 events accumulate before scrolling.
1374 */
1375 int GetWheelRotation() const;
1376
1377 /**
1378 Gets the axis the wheel operation concerns.
1379
1380 Usually the mouse wheel is used to scroll vertically so @c
1381 wxMOUSE_WHEEL_VERTICAL is returned but some mice (and most trackpads)
1382 also allow to use the wheel to scroll horizontally in which case
1383 @c wxMOUSE_WHEEL_HORIZONTAL is returned.
1384
1385 Notice that before wxWidgets 2.9.4 this method returned @c int.
1386 */
1387 wxMouseWheelAxis GetWheelAxis() const;
1388
1389 /**
1390 Returns @true if the event was a mouse button event (not necessarily a button
1391 down event - that may be tested using ButtonDown()).
1392 */
1393 bool IsButton() const;
1394
1395 /**
1396 Returns @true if the system has been setup to do page scrolling with
1397 the mouse wheel instead of line scrolling.
1398 */
1399 bool IsPageScroll() const;
1400
1401 /**
1402 Returns @true if the mouse was leaving the window.
1403
1404 @see Entering().
1405 */
1406 bool Leaving() const;
1407
1408 /**
1409 Returns @true if the event was a left double click.
1410 */
1411 bool LeftDClick() const;
1412
1413 /**
1414 Returns @true if the left mouse button changed to down.
1415 */
1416 bool LeftDown() const;
1417
1418 /**
1419 Returns @true if the left mouse button changed to up.
1420 */
1421 bool LeftUp() const;
1422
1423 /**
1424 Returns @true if the Meta key was down at the time of the event.
1425 */
1426 bool MetaDown() const;
1427
1428 /**
1429 Returns @true if the event was a middle double click.
1430 */
1431 bool MiddleDClick() const;
1432
1433 /**
1434 Returns @true if the middle mouse button changed to down.
1435 */
1436 bool MiddleDown() const;
1437
1438 /**
1439 Returns @true if the middle mouse button changed to up.
1440 */
1441 bool MiddleUp() const;
1442
1443 /**
1444 Returns @true if this was a motion event and no mouse buttons were pressed.
1445 If any mouse button is held pressed, then this method returns @false and
1446 Dragging() returns @true.
1447 */
1448 bool Moving() const;
1449
1450 /**
1451 Returns @true if the event was a right double click.
1452 */
1453 bool RightDClick() const;
1454
1455 /**
1456 Returns @true if the right mouse button changed to down.
1457 */
1458 bool RightDown() const;
1459
1460 /**
1461 Returns @true if the right mouse button changed to up.
1462 */
1463 bool RightUp() const;
1464 };
1465
1466
1467
1468 /**
1469 @class wxDropFilesEvent
1470
1471 This class is used for drop files events, that is, when files have been dropped
1472 onto the window. This functionality is currently only available under Windows.
1473
1474 The window must have previously been enabled for dropping by calling
1475 wxWindow::DragAcceptFiles().
1476
1477 Important note: this is a separate implementation to the more general drag and drop
1478 implementation documented in the @ref overview_dnd. It uses the older, Windows
1479 message-based approach of dropping files.
1480
1481 @beginEventTable{wxDropFilesEvent}
1482 @event{EVT_DROP_FILES(func)}
1483 Process a @c wxEVT_DROP_FILES event.
1484 @endEventTable
1485
1486 @onlyfor{wxmsw}
1487
1488 @library{wxcore}
1489 @category{events}
1490
1491 @see @ref overview_events
1492 */
1493 class wxDropFilesEvent : public wxEvent
1494 {
1495 public:
1496 /**
1497 Constructor.
1498 */
1499 wxDropFilesEvent(wxEventType id = 0, int noFiles = 0,
1500 wxString* files = NULL);
1501
1502 /**
1503 Returns an array of filenames.
1504 */
1505 wxString* GetFiles() const;
1506
1507 /**
1508 Returns the number of files dropped.
1509 */
1510 int GetNumberOfFiles() const;
1511
1512 /**
1513 Returns the position at which the files were dropped.
1514 Returns an array of filenames.
1515 */
1516 wxPoint GetPosition() const;
1517 };
1518
1519
1520
1521 /**
1522 @class wxCommandEvent
1523
1524 This event class contains information about command events, which originate
1525 from a variety of simple controls.
1526
1527 Note that wxCommandEvents and wxCommandEvent-derived event classes by default
1528 and unlike other wxEvent-derived classes propagate upward from the source
1529 window (the window which emits the event) up to the first parent which processes
1530 the event. Be sure to read @ref overview_events_propagation.
1531
1532 More complex controls, such as wxTreeCtrl, have separate command event classes.
1533
1534 @beginEventTable{wxCommandEvent}
1535 @event{EVT_COMMAND(id, event, func)}
1536 Process a command, supplying the window identifier, command event identifier,
1537 and member function.
1538 @event{EVT_COMMAND_RANGE(id1, id2, event, func)}
1539 Process a command for a range of window identifiers, supplying the minimum and
1540 maximum window identifiers, command event identifier, and member function.
1541 @event{EVT_BUTTON(id, func)}
1542 Process a @c wxEVT_COMMAND_BUTTON_CLICKED command, which is generated by a wxButton control.
1543 @event{EVT_CHECKBOX(id, func)}
1544 Process a @c wxEVT_COMMAND_CHECKBOX_CLICKED command, which is generated by a wxCheckBox control.
1545 @event{EVT_CHOICE(id, func)}
1546 Process a @c wxEVT_COMMAND_CHOICE_SELECTED command, which is generated by a wxChoice control.
1547 @event{EVT_COMBOBOX(id, func)}
1548 Process a @c wxEVT_COMMAND_COMBOBOX_SELECTED command, which is generated by a wxComboBox control.
1549 @event{EVT_LISTBOX(id, func)}
1550 Process a @c wxEVT_COMMAND_LISTBOX_SELECTED command, which is generated by a wxListBox control.
1551 @event{EVT_LISTBOX_DCLICK(id, func)}
1552 Process a @c wxEVT_COMMAND_LISTBOX_DOUBLECLICKED command, which is generated by a wxListBox control.
1553 @event{EVT_CHECKLISTBOX(id, func)}
1554 Process a @c wxEVT_COMMAND_CHECKLISTBOX_TOGGLED command, which is generated by a wxCheckListBox control.
1555 @event{EVT_MENU(id, func)}
1556 Process a @c wxEVT_COMMAND_MENU_SELECTED command, which is generated by a menu item.
1557 @event{EVT_MENU_RANGE(id1, id2, func)}
1558 Process a @c wxEVT_COMMAND_MENU_RANGE command, which is generated by a range of menu items.
1559 @event{EVT_CONTEXT_MENU(func)}
1560 Process the event generated when the user has requested a popup menu to appear by
1561 pressing a special keyboard key (under Windows) or by right clicking the mouse.
1562 @event{EVT_RADIOBOX(id, func)}
1563 Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED command, which is generated by a wxRadioBox control.
1564 @event{EVT_RADIOBUTTON(id, func)}
1565 Process a @c wxEVT_COMMAND_RADIOBUTTON_SELECTED command, which is generated by a wxRadioButton control.
1566 @event{EVT_SCROLLBAR(id, func)}
1567 Process a @c wxEVT_COMMAND_SCROLLBAR_UPDATED command, which is generated by a wxScrollBar
1568 control. This is provided for compatibility only; more specific scrollbar event macros
1569 should be used instead (see wxScrollEvent).
1570 @event{EVT_SLIDER(id, func)}
1571 Process a @c wxEVT_COMMAND_SLIDER_UPDATED command, which is generated by a wxSlider control.
1572 @event{EVT_TEXT(id, func)}
1573 Process a @c wxEVT_COMMAND_TEXT_UPDATED command, which is generated by a wxTextCtrl control.
1574 @event{EVT_TEXT_ENTER(id, func)}
1575 Process a @c wxEVT_COMMAND_TEXT_ENTER command, which is generated by a wxTextCtrl control.
1576 Note that you must use wxTE_PROCESS_ENTER flag when creating the control if you want it
1577 to generate such events.
1578 @event{EVT_TEXT_MAXLEN(id, func)}
1579 Process a @c wxEVT_COMMAND_TEXT_MAXLEN command, which is generated by a wxTextCtrl control
1580 when the user tries to enter more characters into it than the limit previously set
1581 with SetMaxLength().
1582 @event{EVT_TOGGLEBUTTON(id, func)}
1583 Process a @c wxEVT_COMMAND_TOGGLEBUTTON_CLICKED event.
1584 @event{EVT_TOOL(id, func)}
1585 Process a @c wxEVT_COMMAND_TOOL_CLICKED event (a synonym for @c wxEVT_COMMAND_MENU_SELECTED).
1586 Pass the id of the tool.
1587 @event{EVT_TOOL_RANGE(id1, id2, func)}
1588 Process a @c wxEVT_COMMAND_TOOL_CLICKED event for a range of identifiers. Pass the ids of the tools.
1589 @event{EVT_TOOL_RCLICKED(id, func)}
1590 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event. Pass the id of the tool. (Not available on wxOSX.)
1591 @event{EVT_TOOL_RCLICKED_RANGE(id1, id2, func)}
1592 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event for a range of ids. Pass the ids of the tools. (Not available on wxOSX.)
1593 @event{EVT_TOOL_ENTER(id, func)}
1594 Process a @c wxEVT_COMMAND_TOOL_ENTER event. Pass the id of the toolbar itself.
1595 The value of wxCommandEvent::GetSelection() is the tool id, or -1 if the mouse cursor
1596 has moved off a tool. (Not available on wxOSX.)
1597 @event{EVT_COMMAND_LEFT_CLICK(id, func)}
1598 Process a @c wxEVT_COMMAND_LEFT_CLICK command, which is generated by a control (wxMSW only).
1599 @event{EVT_COMMAND_LEFT_DCLICK(id, func)}
1600 Process a @c wxEVT_COMMAND_LEFT_DCLICK command, which is generated by a control (wxMSW only).
1601 @event{EVT_COMMAND_RIGHT_CLICK(id, func)}
1602 Process a @c wxEVT_COMMAND_RIGHT_CLICK command, which is generated by a control (wxMSW only).
1603 @event{EVT_COMMAND_SET_FOCUS(id, func)}
1604 Process a @c wxEVT_COMMAND_SET_FOCUS command, which is generated by a control (wxMSW only).
1605 @event{EVT_COMMAND_KILL_FOCUS(id, func)}
1606 Process a @c wxEVT_COMMAND_KILL_FOCUS command, which is generated by a control (wxMSW only).
1607 @event{EVT_COMMAND_ENTER(id, func)}
1608 Process a @c wxEVT_COMMAND_ENTER command, which is generated by a control.
1609 @endEventTable
1610
1611 @library{wxcore}
1612 @category{events}
1613 */
1614 class wxCommandEvent : public wxEvent
1615 {
1616 public:
1617 /**
1618 Constructor.
1619 */
1620 wxCommandEvent(wxEventType commandEventType = wxEVT_NULL, int id = 0);
1621
1622 /**
1623 Returns client data pointer for a listbox or choice selection event
1624 (not valid for a deselection).
1625 */
1626 void* GetClientData() const;
1627
1628 /**
1629 Returns client object pointer for a listbox or choice selection event
1630 (not valid for a deselection).
1631 */
1632 wxClientData* GetClientObject() const;
1633
1634 /**
1635 Returns extra information dependent on the event objects type.
1636
1637 If the event comes from a listbox selection, it is a boolean
1638 determining whether the event was a selection (@true) or a
1639 deselection (@false). A listbox deselection only occurs for
1640 multiple-selection boxes, and in this case the index and string values
1641 are indeterminate and the listbox must be examined by the application.
1642 */
1643 long GetExtraLong() const;
1644
1645 /**
1646 Returns the integer identifier corresponding to a listbox, choice or
1647 radiobox selection (only if the event was a selection, not a deselection),
1648 or a boolean value representing the value of a checkbox.
1649
1650 For a menu item, this method returns -1 if the item is not checkable or
1651 a boolean value (true or false) for checkable items indicating the new
1652 state of the item.
1653 */
1654 int GetInt() const;
1655
1656 /**
1657 Returns item index for a listbox or choice selection event (not valid for
1658 a deselection).
1659 */
1660 int GetSelection() const;
1661
1662 /**
1663 Returns item string for a listbox or choice selection event. If one
1664 or several items have been deselected, returns the index of the first
1665 deselected item. If some items have been selected and others deselected
1666 at the same time, it will return the index of the first selected item.
1667 */
1668 wxString GetString() const;
1669
1670 /**
1671 This method can be used with checkbox and menu events: for the checkboxes, the
1672 method returns @true for a selection event and @false for a deselection one.
1673 For the menu events, this method indicates if the menu item just has become
1674 checked or unchecked (and thus only makes sense for checkable menu items).
1675
1676 Notice that this method cannot be used with wxCheckListBox currently.
1677 */
1678 bool IsChecked() const;
1679
1680 /**
1681 For a listbox or similar event, returns @true if it is a selection, @false
1682 if it is a deselection. If some items have been selected and others deselected
1683 at the same time, it will return @true.
1684 */
1685 bool IsSelection() const;
1686
1687 /**
1688 Sets the client data for this event.
1689 */
1690 void SetClientData(void* clientData);
1691
1692 /**
1693 Sets the client object for this event. The client object is not owned by the
1694 event object and the event object will not delete the client object in its destructor.
1695
1696 The client object must be owned and deleted by another object (e.g. a control)
1697 that has longer life time than the event object.
1698 */
1699 void SetClientObject(wxClientData* clientObject);
1700
1701 /**
1702 Sets the @b m_extraLong member.
1703 */
1704 void SetExtraLong(long extraLong);
1705
1706 /**
1707 Sets the @b m_commandInt member.
1708 */
1709 void SetInt(int intCommand);
1710
1711 /**
1712 Sets the @b m_commandString member.
1713 */
1714 void SetString(const wxString& string);
1715 };
1716
1717
1718
1719 /**
1720 @class wxActivateEvent
1721
1722 An activate event is sent when a window or application is being activated
1723 or deactivated.
1724
1725 @beginEventTable{wxActivateEvent}
1726 @event{EVT_ACTIVATE(func)}
1727 Process a @c wxEVT_ACTIVATE event.
1728 @event{EVT_ACTIVATE_APP(func)}
1729 Process a @c wxEVT_ACTIVATE_APP event.
1730 This event is received by the wxApp-derived instance only.
1731 @event{EVT_HIBERNATE(func)}
1732 Process a hibernate event, supplying the member function. This event applies
1733 to wxApp only, and only on Windows SmartPhone and PocketPC.
1734 It is generated when the system is low on memory; the application should free
1735 up as much memory as possible, and restore full working state when it receives
1736 a @c wxEVT_ACTIVATE or @c wxEVT_ACTIVATE_APP event.
1737 @endEventTable
1738
1739 @library{wxcore}
1740 @category{events}
1741
1742 @see @ref overview_events, wxApp::IsActive
1743 */
1744 class wxActivateEvent : public wxEvent
1745 {
1746 public:
1747 /**
1748 Constructor.
1749 */
1750 wxActivateEvent(wxEventType eventType = wxEVT_NULL, bool active = true,
1751 int id = 0);
1752
1753 /**
1754 Returns @true if the application or window is being activated, @false otherwise.
1755 */
1756 bool GetActive() const;
1757 };
1758
1759
1760
1761 /**
1762 @class wxContextMenuEvent
1763
1764 This class is used for context menu events, sent to give
1765 the application a chance to show a context (popup) menu for a wxWindow.
1766
1767 Note that if wxContextMenuEvent::GetPosition returns wxDefaultPosition, this
1768 means that the event originated from a keyboard context button event, and you
1769 should compute a suitable position yourself, for example by calling wxGetMousePosition().
1770
1771 Notice that the exact sequence of mouse events is different across the
1772 platforms. For example, under MSW the context menu event is generated after
1773 @c EVT_RIGHT_UP event and only if it was not handled but under GTK the
1774 context menu event is generated after @c EVT_RIGHT_DOWN event. This is
1775 correct in the sense that it ensures that the context menu is shown
1776 according to the current platform UI conventions and also means that you
1777 must not handle (or call wxEvent::Skip() in your handler if you do have
1778 one) neither right mouse down nor right mouse up event if you plan on
1779 handling @c EVT_CONTEXT_MENU event.
1780
1781 @beginEventTable{wxContextMenuEvent}
1782 @event{EVT_CONTEXT_MENU(func)}
1783 A right click (or other context menu command depending on platform) has been detected.
1784 @endEventTable
1785
1786
1787 @library{wxcore}
1788 @category{events}
1789
1790 @see wxCommandEvent, @ref overview_events
1791 */
1792 class wxContextMenuEvent : public wxCommandEvent
1793 {
1794 public:
1795 /**
1796 Constructor.
1797 */
1798 wxContextMenuEvent(wxEventType type = wxEVT_NULL, int id = 0,
1799 const wxPoint& pos = wxDefaultPosition);
1800
1801 /**
1802 Returns the position in screen coordinates at which the menu should be shown.
1803 Use wxWindow::ScreenToClient to convert to client coordinates.
1804
1805 You can also omit a position from wxWindow::PopupMenu in order to use
1806 the current mouse pointer position.
1807
1808 If the event originated from a keyboard event, the value returned from this
1809 function will be wxDefaultPosition.
1810 */
1811 const wxPoint& GetPosition() const;
1812
1813 /**
1814 Sets the position at which the menu should be shown.
1815 */
1816 void SetPosition(const wxPoint& point);
1817 };
1818
1819
1820
1821 /**
1822 @class wxEraseEvent
1823
1824 An erase event is sent when a window's background needs to be repainted.
1825
1826 On some platforms, such as GTK+, this event is simulated (simply generated just
1827 before the paint event) and may cause flicker. It is therefore recommended that
1828 you set the text background colour explicitly in order to prevent flicker.
1829 The default background colour under GTK+ is grey.
1830
1831 To intercept this event, use the EVT_ERASE_BACKGROUND macro in an event table
1832 definition.
1833
1834 You must use the device context returned by GetDC() to draw on, don't create
1835 a wxPaintDC in the event handler.
1836
1837 @beginEventTable{wxEraseEvent}
1838 @event{EVT_ERASE_BACKGROUND(func)}
1839 Process a @c wxEVT_ERASE_BACKGROUND event.
1840 @endEventTable
1841
1842 @library{wxcore}
1843 @category{events}
1844
1845 @see @ref overview_events
1846 */
1847 class wxEraseEvent : public wxEvent
1848 {
1849 public:
1850 /**
1851 Constructor.
1852 */
1853 wxEraseEvent(int id = 0, wxDC* dc = NULL);
1854
1855 /**
1856 Returns the device context associated with the erase event to draw on.
1857
1858 The returned pointer is never @NULL.
1859 */
1860 wxDC* GetDC() const;
1861 };
1862
1863
1864
1865 /**
1866 @class wxFocusEvent
1867
1868 A focus event is sent when a window's focus changes. The window losing focus
1869 receives a "kill focus" event while the window gaining it gets a "set focus" one.
1870
1871 Notice that the set focus event happens both when the user gives focus to the
1872 window (whether using the mouse or keyboard) and when it is done from the
1873 program itself using wxWindow::SetFocus.
1874
1875 The focus event handlers should almost invariably call wxEvent::Skip() on
1876 their event argument to allow the default handling to take place. Failure
1877 to do this may result in incorrect behaviour of the native controls. Also
1878 note that wxEVT_KILL_FOCUS handler must not call wxWindow::SetFocus() as
1879 this, again, is not supported by all native controls. If you need to do
1880 this, consider using the @ref sec_delayed_action described in wxIdleEvent
1881 documentation.
1882
1883 @beginEventTable{wxFocusEvent}
1884 @event{EVT_SET_FOCUS(func)}
1885 Process a @c wxEVT_SET_FOCUS event.
1886 @event{EVT_KILL_FOCUS(func)}
1887 Process a @c wxEVT_KILL_FOCUS event.
1888 @endEventTable
1889
1890 @library{wxcore}
1891 @category{events}
1892
1893 @see @ref overview_events
1894 */
1895 class wxFocusEvent : public wxEvent
1896 {
1897 public:
1898 /**
1899 Constructor.
1900 */
1901 wxFocusEvent(wxEventType eventType = wxEVT_NULL, int id = 0);
1902
1903 /**
1904 Returns the window associated with this event, that is the window which had the
1905 focus before for the @c wxEVT_SET_FOCUS event and the window which is
1906 going to receive focus for the @c wxEVT_KILL_FOCUS one.
1907
1908 Warning: the window pointer may be @NULL!
1909 */
1910 wxWindow *GetWindow() const;
1911
1912 void SetWindow(wxWindow *win);
1913 };
1914
1915
1916
1917 /**
1918 @class wxChildFocusEvent
1919
1920 A child focus event is sent to a (parent-)window when one of its child windows
1921 gains focus, so that the window could restore the focus back to its corresponding
1922 child if it loses it now and regains later.
1923
1924 Notice that child window is the direct child of the window receiving event.
1925 Use wxWindow::FindFocus() to retrieve the window which is actually getting focus.
1926
1927 @beginEventTable{wxChildFocusEvent}
1928 @event{EVT_CHILD_FOCUS(func)}
1929 Process a @c wxEVT_CHILD_FOCUS event.
1930 @endEventTable
1931
1932 @library{wxcore}
1933 @category{events}
1934
1935 @see @ref overview_events
1936 */
1937 class wxChildFocusEvent : public wxCommandEvent
1938 {
1939 public:
1940 /**
1941 Constructor.
1942
1943 @param win
1944 The direct child which is (or which contains the window which is) receiving
1945 the focus.
1946 */
1947 wxChildFocusEvent(wxWindow* win = NULL);
1948
1949 /**
1950 Returns the direct child which receives the focus, or a (grand-)parent of the
1951 control receiving the focus.
1952
1953 To get the actually focused control use wxWindow::FindFocus.
1954 */
1955 wxWindow *GetWindow() const;
1956 };
1957
1958
1959
1960 /**
1961 @class wxMouseCaptureLostEvent
1962
1963 A mouse capture lost event is sent to a window that had obtained mouse capture,
1964 which was subsequently lost due to an "external" event (for example, when a dialog
1965 box is shown or if another application captures the mouse).
1966
1967 If this happens, this event is sent to all windows that are on the capture stack
1968 (i.e. called CaptureMouse, but didn't call ReleaseMouse yet). The event is
1969 not sent if the capture changes because of a call to CaptureMouse or
1970 ReleaseMouse.
1971
1972 This event is currently emitted under Windows only.
1973
1974 @beginEventTable{wxMouseCaptureLostEvent}
1975 @event{EVT_MOUSE_CAPTURE_LOST(func)}
1976 Process a @c wxEVT_MOUSE_CAPTURE_LOST event.
1977 @endEventTable
1978
1979 @onlyfor{wxmsw}
1980
1981 @library{wxcore}
1982 @category{events}
1983
1984 @see wxMouseCaptureChangedEvent, @ref overview_events,
1985 wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
1986 */
1987 class wxMouseCaptureLostEvent : public wxEvent
1988 {
1989 public:
1990 /**
1991 Constructor.
1992 */
1993 wxMouseCaptureLostEvent(wxWindowID windowId = 0);
1994 };
1995
1996
1997
1998 class wxDisplayChangedEvent : public wxEvent
1999 {
2000 public:
2001 wxDisplayChangedEvent();
2002 };
2003
2004
2005 class wxPaletteChangedEvent : public wxEvent
2006 {
2007 public:
2008 wxPaletteChangedEvent(wxWindowID winid = 0);
2009
2010 void SetChangedWindow(wxWindow* win);
2011 wxWindow* GetChangedWindow() const;
2012 };
2013
2014
2015 class wxQueryNewPaletteEvent : public wxEvent
2016 {
2017 public:
2018 wxQueryNewPaletteEvent(wxWindowID winid = 0);
2019
2020 void SetPaletteRealized(bool realized);
2021 bool GetPaletteRealized();
2022 };
2023
2024
2025
2026
2027 /**
2028 @class wxNotifyEvent
2029
2030 This class is not used by the event handlers by itself, but is a base class
2031 for other event classes (such as wxBookCtrlEvent).
2032
2033 It (or an object of a derived class) is sent when the controls state is being
2034 changed and allows the program to wxNotifyEvent::Veto() this change if it wants
2035 to prevent it from happening.
2036
2037 @library{wxcore}
2038 @category{events}
2039
2040 @see wxBookCtrlEvent
2041 */
2042 class wxNotifyEvent : public wxCommandEvent
2043 {
2044 public:
2045 /**
2046 Constructor (used internally by wxWidgets only).
2047 */
2048 wxNotifyEvent(wxEventType eventType = wxEVT_NULL, int id = 0);
2049
2050 /**
2051 This is the opposite of Veto(): it explicitly allows the event to be processed.
2052 For most events it is not necessary to call this method as the events are allowed
2053 anyhow but some are forbidden by default (this will be mentioned in the corresponding
2054 event description).
2055 */
2056 void Allow();
2057
2058 /**
2059 Returns @true if the change is allowed (Veto() hasn't been called) or @false
2060 otherwise (if it was).
2061 */
2062 bool IsAllowed() const;
2063
2064 /**
2065 Prevents the change announced by this event from happening.
2066
2067 It is in general a good idea to notify the user about the reasons for vetoing
2068 the change because otherwise the applications behaviour (which just refuses to
2069 do what the user wants) might be quite surprising.
2070 */
2071 void Veto();
2072 };
2073
2074
2075 /**
2076 @class wxThreadEvent
2077
2078 This class adds some simple functionality to wxEvent to facilitate
2079 inter-thread communication.
2080
2081 This event is not natively emitted by any control/class: it is just
2082 a helper class for the user.
2083 Its most important feature is the GetEventCategory() implementation which
2084 allows thread events @b NOT to be processed by wxEventLoopBase::YieldFor calls
2085 (unless the @c wxEVT_CATEGORY_THREAD is specified - which is never in wx code).
2086
2087 @library{wxcore}
2088 @category{events,threading}
2089
2090 @see @ref overview_thread, wxEventLoopBase::YieldFor
2091
2092 @since 2.9.0
2093 */
2094 class wxThreadEvent : public wxEvent
2095 {
2096 public:
2097 /**
2098 Constructor.
2099 */
2100 wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY);
2101
2102 /**
2103 Clones this event making sure that all internal members which use
2104 COW (only @c m_commandString for now; see @ref overview_refcount)
2105 are unshared (see wxObject::UnShare).
2106 */
2107 virtual wxEvent *Clone() const;
2108
2109 /**
2110 Returns @c wxEVT_CATEGORY_THREAD.
2111
2112 This is important to avoid unwanted processing of thread events
2113 when calling wxEventLoopBase::YieldFor().
2114 */
2115 virtual wxEventCategory GetEventCategory() const;
2116
2117 /**
2118 Sets custom data payload.
2119
2120 The @a payload argument may be of any type that wxAny can handle
2121 (i.e. pretty much anything). Note that T's copy constructor must be
2122 thread-safe, i.e. create a copy that doesn't share anything with
2123 the original (see Clone()).
2124
2125 @note This method is not available with Visual C++ 6.
2126
2127 @since 2.9.1
2128
2129 @see GetPayload(), wxAny
2130 */
2131 template<typename T>
2132 void SetPayload(const T& payload);
2133
2134 /**
2135 Get custom data payload.
2136
2137 Correct type is checked in debug builds.
2138
2139 @note This method is not available with Visual C++ 6.
2140
2141 @since 2.9.1
2142
2143 @see SetPayload(), wxAny
2144 */
2145 template<typename T>
2146 T GetPayload() const;
2147
2148 /**
2149 Returns extra information integer value.
2150 */
2151 long GetExtraLong() const;
2152
2153 /**
2154 Returns stored integer value.
2155 */
2156 int GetInt() const;
2157
2158 /**
2159 Returns stored string value.
2160 */
2161 wxString GetString() const;
2162
2163
2164 /**
2165 Sets the extra information value.
2166 */
2167 void SetExtraLong(long extraLong);
2168
2169 /**
2170 Sets the integer value.
2171 */
2172 void SetInt(int intCommand);
2173
2174 /**
2175 Sets the string value.
2176 */
2177 void SetString(const wxString& string);
2178 };
2179
2180
2181 /**
2182 @class wxHelpEvent
2183
2184 A help event is sent when the user has requested context-sensitive help.
2185 This can either be caused by the application requesting context-sensitive help mode
2186 via wxContextHelp, or (on MS Windows) by the system generating a WM_HELP message when
2187 the user pressed F1 or clicked on the query button in a dialog caption.
2188
2189 A help event is sent to the window that the user clicked on, and is propagated
2190 up the window hierarchy until the event is processed or there are no more event
2191 handlers.
2192
2193 The application should call wxEvent::GetId to check the identity of the
2194 clicked-on window, and then either show some suitable help or call wxEvent::Skip()
2195 if the identifier is unrecognised.
2196
2197 Calling Skip is important because it allows wxWidgets to generate further
2198 events for ancestors of the clicked-on window. Otherwise it would be impossible to
2199 show help for container windows, since processing would stop after the first window
2200 found.
2201
2202 @beginEventTable{wxHelpEvent}
2203 @event{EVT_HELP(id, func)}
2204 Process a @c wxEVT_HELP event.
2205 @event{EVT_HELP_RANGE(id1, id2, func)}
2206 Process a @c wxEVT_HELP event for a range of ids.
2207 @endEventTable
2208
2209 @library{wxcore}
2210 @category{events}
2211
2212 @see wxContextHelp, wxDialog, @ref overview_events
2213 */
2214 class wxHelpEvent : public wxCommandEvent
2215 {
2216 public:
2217 /**
2218 Indicates how a wxHelpEvent was generated.
2219 */
2220 enum Origin
2221 {
2222 Origin_Unknown, /**< unrecognized event source. */
2223 Origin_Keyboard, /**< event generated from F1 key press. */
2224
2225 /** event generated by wxContextHelp or from the [?] button on
2226 the title bar (Windows). */
2227 Origin_HelpButton
2228 };
2229
2230 /**
2231 Constructor.
2232 */
2233 wxHelpEvent(wxEventType type = wxEVT_NULL,
2234 wxWindowID winid = 0,
2235 const wxPoint& pt = wxDefaultPosition,
2236 wxHelpEvent::Origin origin = Origin_Unknown);
2237
2238 /**
2239 Returns the origin of the help event which is one of the ::wxHelpEventOrigin
2240 values.
2241
2242 The application may handle events generated using the keyboard or mouse
2243 differently, e.g. by using wxGetMousePosition() for the mouse events.
2244
2245 @see SetOrigin()
2246 */
2247 wxHelpEvent::Origin GetOrigin() const;
2248
2249 /**
2250 Returns the left-click position of the mouse, in screen coordinates.
2251 This allows the application to position the help appropriately.
2252 */
2253 const wxPoint& GetPosition() const;
2254
2255 /**
2256 Set the help event origin, only used internally by wxWidgets normally.
2257
2258 @see GetOrigin()
2259 */
2260 void SetOrigin(wxHelpEvent::Origin origin);
2261
2262 /**
2263 Sets the left-click position of the mouse, in screen coordinates.
2264 */
2265 void SetPosition(const wxPoint& pt);
2266 };
2267
2268
2269
2270 /**
2271 @class wxScrollEvent
2272
2273 A scroll event holds information about events sent from stand-alone
2274 scrollbars (see wxScrollBar) and sliders (see wxSlider).
2275
2276 Note that scrolled windows send the wxScrollWinEvent which does not derive from
2277 wxCommandEvent, but from wxEvent directly - don't confuse these two kinds of
2278 events and use the event table macros mentioned below only for the scrollbar-like
2279 controls.
2280
2281 @section scrollevent_diff The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED
2282
2283 The EVT_SCROLL_THUMBRELEASE event is only emitted when actually dragging the thumb
2284 using the mouse and releasing it (This EVT_SCROLL_THUMBRELEASE event is also followed
2285 by an EVT_SCROLL_CHANGED event).
2286
2287 The EVT_SCROLL_CHANGED event also occurs when using the keyboard to change the thumb
2288 position, and when clicking next to the thumb (In all these cases the EVT_SCROLL_THUMBRELEASE
2289 event does not happen).
2290
2291 In short, the EVT_SCROLL_CHANGED event is triggered when scrolling/ moving has finished
2292 independently of the way it had started. Please see the widgets sample ("Slider" page)
2293 to see the difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED in action.
2294
2295 @remarks
2296 Note that unless specifying a scroll control identifier, you will need to test for scrollbar
2297 orientation with wxScrollEvent::GetOrientation, since horizontal and vertical scroll events
2298 are processed using the same event handler.
2299
2300 @beginEventTable{wxScrollEvent}
2301 You can use EVT_COMMAND_SCROLL... macros with window IDs for when intercepting
2302 scroll events from controls, or EVT_SCROLL... macros without window IDs for
2303 intercepting scroll events from the receiving window -- except for this, the
2304 macros behave exactly the same.
2305 @event{EVT_SCROLL(func)}
2306 Process all scroll events.
2307 @event{EVT_SCROLL_TOP(func)}
2308 Process @c wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
2309 @event{EVT_SCROLL_BOTTOM(func)}
2310 Process @c wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
2311 @event{EVT_SCROLL_LINEUP(func)}
2312 Process @c wxEVT_SCROLL_LINEUP line up events.
2313 @event{EVT_SCROLL_LINEDOWN(func)}
2314 Process @c wxEVT_SCROLL_LINEDOWN line down events.
2315 @event{EVT_SCROLL_PAGEUP(func)}
2316 Process @c wxEVT_SCROLL_PAGEUP page up events.
2317 @event{EVT_SCROLL_PAGEDOWN(func)}
2318 Process @c wxEVT_SCROLL_PAGEDOWN page down events.
2319 @event{EVT_SCROLL_THUMBTRACK(func)}
2320 Process @c wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent as the
2321 user drags the thumbtrack).
2322 @event{EVT_SCROLL_THUMBRELEASE(func)}
2323 Process @c wxEVT_SCROLL_THUMBRELEASE thumb release events.
2324 @event{EVT_SCROLL_CHANGED(func)}
2325 Process @c wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).
2326 @event{EVT_COMMAND_SCROLL(id, func)}
2327 Process all scroll events.
2328 @event{EVT_COMMAND_SCROLL_TOP(id, func)}
2329 Process @c wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
2330 @event{EVT_COMMAND_SCROLL_BOTTOM(id, func)}
2331 Process @c wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
2332 @event{EVT_COMMAND_SCROLL_LINEUP(id, func)}
2333 Process @c wxEVT_SCROLL_LINEUP line up events.
2334 @event{EVT_COMMAND_SCROLL_LINEDOWN(id, func)}
2335 Process @c wxEVT_SCROLL_LINEDOWN line down events.
2336 @event{EVT_COMMAND_SCROLL_PAGEUP(id, func)}
2337 Process @c wxEVT_SCROLL_PAGEUP page up events.
2338 @event{EVT_COMMAND_SCROLL_PAGEDOWN(id, func)}
2339 Process @c wxEVT_SCROLL_PAGEDOWN page down events.
2340 @event{EVT_COMMAND_SCROLL_THUMBTRACK(id, func)}
2341 Process @c wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent
2342 as the user drags the thumbtrack).
2343 @event{EVT_COMMAND_SCROLL_THUMBRELEASE(func)}
2344 Process @c wxEVT_SCROLL_THUMBRELEASE thumb release events.
2345 @event{EVT_COMMAND_SCROLL_CHANGED(func)}
2346 Process @c wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).
2347 @endEventTable
2348
2349 @library{wxcore}
2350 @category{events}
2351
2352 @see wxScrollBar, wxSlider, wxSpinButton, wxScrollWinEvent, @ref overview_events
2353 */
2354 class wxScrollEvent : public wxCommandEvent
2355 {
2356 public:
2357 /**
2358 Constructor.
2359 */
2360 wxScrollEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int pos = 0,
2361 int orientation = 0);
2362
2363 /**
2364 Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the
2365 scrollbar.
2366 */
2367 int GetOrientation() const;
2368
2369 /**
2370 Returns the position of the scrollbar.
2371 */
2372 int GetPosition() const;
2373
2374
2375 void SetOrientation(int orient);
2376 void SetPosition(int pos);
2377 };
2378
2379
2380
2381
2382 /**
2383 @class wxInitDialogEvent
2384
2385 A wxInitDialogEvent is sent as a dialog or panel is being initialised.
2386 Handlers for this event can transfer data to the window.
2387
2388 The default handler calls wxWindow::TransferDataToWindow.
2389
2390 @beginEventTable{wxInitDialogEvent}
2391 @event{EVT_INIT_DIALOG(func)}
2392 Process a @c wxEVT_INIT_DIALOG event.
2393 @endEventTable
2394
2395 @library{wxcore}
2396 @category{events}
2397
2398 @see @ref overview_events
2399 */
2400 class wxInitDialogEvent : public wxEvent
2401 {
2402 public:
2403 /**
2404 Constructor.
2405 */
2406 wxInitDialogEvent(int id = 0);
2407 };
2408
2409
2410
2411 /**
2412 @class wxWindowDestroyEvent
2413
2414 This event is sent as early as possible during the window destruction
2415 process.
2416
2417 For the top level windows, as early as possible means that this is done by
2418 wxFrame or wxDialog destructor, i.e. after the destructor of the derived
2419 class was executed and so any methods specific to the derived class can't
2420 be called any more from this event handler. If you need to do this, you
2421 must call wxWindow::SendDestroyEvent() from your derived class destructor.
2422
2423 For the child windows, this event is generated just before deleting the
2424 window from wxWindow::Destroy() (which is also called when the parent
2425 window is deleted) or from the window destructor if operator @c delete was
2426 used directly (which is not recommended for this very reason).
2427
2428 It is usually pointless to handle this event in the window itself but it ca
2429 be very useful to receive notifications about the window destruction in the
2430 parent window or in any other object interested in this window.
2431
2432 @library{wxcore}
2433 @category{events}
2434
2435 @see @ref overview_events, wxWindowCreateEvent
2436 */
2437 class wxWindowDestroyEvent : public wxCommandEvent
2438 {
2439 public:
2440 /**
2441 Constructor.
2442 */
2443 wxWindowDestroyEvent(wxWindow* win = NULL);
2444
2445 /// Return the window being destroyed.
2446 wxWindow *GetWindow() const;
2447 };
2448
2449
2450 /**
2451 @class wxNavigationKeyEvent
2452
2453 This event class contains information about navigation events,
2454 generated by navigation keys such as tab and page down.
2455
2456 This event is mainly used by wxWidgets implementations.
2457 A wxNavigationKeyEvent handler is automatically provided by wxWidgets
2458 when you enable keyboard navigation inside a window by inheriting it from
2459 wxNavigationEnabled<>.
2460
2461 @beginEventTable{wxNavigationKeyEvent}
2462 @event{EVT_NAVIGATION_KEY(func)}
2463 Process a navigation key event.
2464 @endEventTable
2465
2466 @library{wxcore}
2467 @category{events}
2468
2469 @see wxWindow::Navigate, wxWindow::NavigateIn
2470 */
2471 class wxNavigationKeyEvent : public wxEvent
2472 {
2473 public:
2474 /**
2475 Flags which can be used with wxNavigationKeyEvent.
2476 */
2477 enum wxNavigationKeyEventFlags
2478 {
2479 IsBackward = 0x0000,
2480 IsForward = 0x0001,
2481 WinChange = 0x0002,
2482 FromTab = 0x0004
2483 };
2484
2485 wxNavigationKeyEvent();
2486 wxNavigationKeyEvent(const wxNavigationKeyEvent& event);
2487
2488 /**
2489 Returns the child that has the focus, or @NULL.
2490 */
2491 wxWindow* GetCurrentFocus() const;
2492
2493 /**
2494 Returns @true if the navigation was in the forward direction.
2495 */
2496 bool GetDirection() const;
2497
2498 /**
2499 Returns @true if the navigation event was from a tab key.
2500 This is required for proper navigation over radio buttons.
2501 */
2502 bool IsFromTab() const;
2503
2504 /**
2505 Returns @true if the navigation event represents a window change
2506 (for example, from Ctrl-Page Down in a notebook).
2507 */
2508 bool IsWindowChange() const;
2509
2510 /**
2511 Sets the current focus window member.
2512 */
2513 void SetCurrentFocus(wxWindow* currentFocus);
2514
2515 /**
2516 Sets the direction to forward if @a direction is @true, or backward
2517 if @false.
2518 */
2519 void SetDirection(bool direction);
2520
2521 /**
2522 Sets the flags for this event.
2523 The @a flags can be a combination of the ::wxNavigationKeyEventFlags values.
2524 */
2525 void SetFlags(long flags);
2526
2527 /**
2528 Marks the navigation event as from a tab key.
2529 */
2530 void SetFromTab(bool fromTab);
2531
2532 /**
2533 Marks the event as a window change event.
2534 */
2535 void SetWindowChange(bool windowChange);
2536 };
2537
2538
2539
2540 /**
2541 @class wxMouseCaptureChangedEvent
2542
2543 An mouse capture changed event is sent to a window that loses its
2544 mouse capture. This is called even if wxWindow::ReleaseMouse
2545 was called by the application code. Handling this event allows
2546 an application to cater for unexpected capture releases which
2547 might otherwise confuse mouse handling code.
2548
2549 @onlyfor{wxmsw}
2550
2551 @beginEventTable{wxMouseCaptureChangedEvent}
2552 @event{EVT_MOUSE_CAPTURE_CHANGED(func)}
2553 Process a @c wxEVT_MOUSE_CAPTURE_CHANGED event.
2554 @endEventTable
2555
2556 @library{wxcore}
2557 @category{events}
2558
2559 @see wxMouseCaptureLostEvent, @ref overview_events,
2560 wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
2561 */
2562 class wxMouseCaptureChangedEvent : public wxEvent
2563 {
2564 public:
2565 /**
2566 Constructor.
2567 */
2568 wxMouseCaptureChangedEvent(wxWindowID windowId = 0,
2569 wxWindow* gainedCapture = NULL);
2570
2571 /**
2572 Returns the window that gained the capture, or @NULL if it was a
2573 non-wxWidgets window.
2574 */
2575 wxWindow* GetCapturedWindow() const;
2576 };
2577
2578
2579
2580 /**
2581 @class wxCloseEvent
2582
2583 This event class contains information about window and session close events.
2584
2585 The handler function for EVT_CLOSE is called when the user has tried to close a
2586 a frame or dialog box using the window manager (X) or system menu (Windows).
2587 It can also be invoked by the application itself programmatically, for example by
2588 calling the wxWindow::Close function.
2589
2590 You should check whether the application is forcing the deletion of the window
2591 using wxCloseEvent::CanVeto. If this is @false, you @e must destroy the window
2592 using wxWindow::Destroy.
2593
2594 If the return value is @true, it is up to you whether you respond by destroying
2595 the window.
2596
2597 If you don't destroy the window, you should call wxCloseEvent::Veto to
2598 let the calling code know that you did not destroy the window.
2599 This allows the wxWindow::Close function to return @true or @false depending
2600 on whether the close instruction was honoured or not.
2601
2602 Example of a wxCloseEvent handler:
2603
2604 @code
2605 void MyFrame::OnClose(wxCloseEvent& event)
2606 {
2607 if ( event.CanVeto() && m_bFileNotSaved )
2608 {
2609 if ( wxMessageBox("The file has not been saved... continue closing?",
2610 "Please confirm",
2611 wxICON_QUESTION | wxYES_NO) != wxYES )
2612 {
2613 event.Veto();
2614 return;
2615 }
2616 }
2617
2618 Destroy(); // you may also do: event.Skip();
2619 // since the default event handler does call Destroy(), too
2620 }
2621 @endcode
2622
2623 The EVT_END_SESSION event is slightly different as it is sent by the system
2624 when the user session is ending (e.g. because of log out or shutdown) and
2625 so all windows are being forcefully closed. At least under MSW, after the
2626 handler for this event is executed the program is simply killed by the
2627 system. Because of this, the default handler for this event provided by
2628 wxWidgets calls all the usual cleanup code (including wxApp::OnExit()) so
2629 that it could still be executed and exit()s the process itself, without
2630 waiting for being killed. If this behaviour is for some reason undesirable,
2631 make sure that you define a handler for this event in your wxApp-derived
2632 class and do not call @c event.Skip() in it (but be aware that the system
2633 will still kill your application).
2634
2635 @beginEventTable{wxCloseEvent}
2636 @event{EVT_CLOSE(func)}
2637 Process a @c wxEVT_CLOSE_WINDOW command event, supplying the member function.
2638 This event applies to wxFrame and wxDialog classes.
2639 @event{EVT_QUERY_END_SESSION(func)}
2640 Process a @c wxEVT_QUERY_END_SESSION session event, supplying the member function.
2641 This event can be handled in wxApp-derived class only.
2642 @event{EVT_END_SESSION(func)}
2643 Process a @c wxEVT_END_SESSION session event, supplying the member function.
2644 This event can be handled in wxApp-derived class only.
2645 @endEventTable
2646
2647 @library{wxcore}
2648 @category{events}
2649
2650 @see wxWindow::Close, @ref overview_windowdeletion
2651 */
2652 class wxCloseEvent : public wxEvent
2653 {
2654 public:
2655 /**
2656 Constructor.
2657 */
2658 wxCloseEvent(wxEventType commandEventType = wxEVT_NULL, int id = 0);
2659
2660 /**
2661 Returns @true if you can veto a system shutdown or a window close event.
2662 Vetoing a window close event is not possible if the calling code wishes to
2663 force the application to exit, and so this function must be called to check this.
2664 */
2665 bool CanVeto() const;
2666
2667 /**
2668 Returns @true if the user is just logging off or @false if the system is
2669 shutting down. This method can only be called for end session and query end
2670 session events, it doesn't make sense for close window event.
2671 */
2672 bool GetLoggingOff() const;
2673
2674 /**
2675 Sets the 'can veto' flag.
2676 */
2677 void SetCanVeto(bool canVeto);
2678
2679 /**
2680 Sets the 'logging off' flag.
2681 */
2682 void SetLoggingOff(bool loggingOff);
2683
2684 /**
2685 Call this from your event handler to veto a system shutdown or to signal
2686 to the calling application that a window close did not happen.
2687
2688 You can only veto a shutdown if CanVeto() returns @true.
2689 */
2690 void Veto(bool veto = true);
2691 };
2692
2693
2694
2695 /**
2696 @class wxMenuEvent
2697
2698 This class is used for a variety of menu-related events. Note that
2699 these do not include menu command events, which are
2700 handled using wxCommandEvent objects.
2701
2702 The default handler for @c wxEVT_MENU_HIGHLIGHT displays help
2703 text in the first field of the status bar.
2704
2705 @beginEventTable{wxMenuEvent}
2706 @event{EVT_MENU_OPEN(func)}
2707 A menu is about to be opened. On Windows, this is only sent once for each
2708 navigation of the menubar (up until all menus have closed).
2709 @event{EVT_MENU_CLOSE(func)}
2710 A menu has been just closed.
2711 @event{EVT_MENU_HIGHLIGHT(id, func)}
2712 The menu item with the specified id has been highlighted: used to show
2713 help prompts in the status bar by wxFrame
2714 @event{EVT_MENU_HIGHLIGHT_ALL(func)}
2715 A menu item has been highlighted, i.e. the currently selected menu item has changed.
2716 @endEventTable
2717
2718 @library{wxcore}
2719 @category{events}
2720
2721 @see wxCommandEvent, @ref overview_events
2722 */
2723 class wxMenuEvent : public wxEvent
2724 {
2725 public:
2726 /**
2727 Constructor.
2728 */
2729 wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0, wxMenu* menu = NULL);
2730
2731 /**
2732 Returns the menu which is being opened or closed.
2733
2734 This method can only be used with the @c OPEN and @c CLOSE events.
2735
2736 The returned value is never @NULL in the ports implementing this
2737 function, which currently includes all the major ones.
2738 */
2739 wxMenu* GetMenu() const;
2740
2741 /**
2742 Returns the menu identifier associated with the event.
2743 This method should be only used with the @c HIGHLIGHT events.
2744 */
2745 int GetMenuId() const;
2746
2747 /**
2748 Returns @true if the menu which is being opened or closed is a popup menu,
2749 @false if it is a normal one.
2750
2751 This method should only be used with the @c OPEN and @c CLOSE events.
2752 */
2753 bool IsPopup() const;
2754 };
2755
2756 /**
2757 @class wxShowEvent
2758
2759 An event being sent when the window is shown or hidden.
2760 The event is triggered by calls to wxWindow::Show(), and any user
2761 action showing a previously hidden window or vice versa (if allowed by
2762 the current platform and/or window manager).
2763 Notice that the event is not triggered when the application is iconized
2764 (minimized) or restored under wxMSW.
2765
2766 @onlyfor{wxmsw,wxgtk,wxos2}
2767
2768 @beginEventTable{wxShowEvent}
2769 @event{EVT_SHOW(func)}
2770 Process a @c wxEVT_SHOW event.
2771 @endEventTable
2772
2773 @library{wxcore}
2774 @category{events}
2775
2776 @see @ref overview_events, wxWindow::Show,
2777 wxWindow::IsShown
2778 */
2779
2780 class wxShowEvent : public wxEvent
2781 {
2782 public:
2783 /**
2784 Constructor.
2785 */
2786 wxShowEvent(int winid = 0, bool show = false);
2787
2788 /**
2789 Set whether the windows was shown or hidden.
2790 */
2791 void SetShow(bool show);
2792
2793 /**
2794 Return @true if the window has been shown, @false if it has been
2795 hidden.
2796 */
2797 bool IsShown() const;
2798
2799 /**
2800 @deprecated This function is deprecated in favour of IsShown().
2801 */
2802 bool GetShow() const;
2803 };
2804
2805
2806
2807 /**
2808 @class wxIconizeEvent
2809
2810 An event being sent when the frame is iconized (minimized) or restored.
2811
2812 Currently only wxMSW and wxGTK generate such events.
2813
2814 @onlyfor{wxmsw,wxgtk}
2815
2816 @beginEventTable{wxIconizeEvent}
2817 @event{EVT_ICONIZE(func)}
2818 Process a @c wxEVT_ICONIZE event.
2819 @endEventTable
2820
2821 @library{wxcore}
2822 @category{events}
2823
2824 @see @ref overview_events, wxTopLevelWindow::Iconize,
2825 wxTopLevelWindow::IsIconized
2826 */
2827 class wxIconizeEvent : public wxEvent
2828 {
2829 public:
2830 /**
2831 Constructor.
2832 */
2833 wxIconizeEvent(int id = 0, bool iconized = true);
2834
2835 /**
2836 Returns @true if the frame has been iconized, @false if it has been
2837 restored.
2838 */
2839 bool IsIconized() const;
2840
2841 /**
2842 @deprecated This function is deprecated in favour of IsIconized().
2843 */
2844 bool Iconized() const;
2845 };
2846
2847
2848
2849 /**
2850 @class wxMoveEvent
2851
2852 A move event holds information about wxTopLevelWindow move change events.
2853
2854 These events are currently only generated by wxMSW port.
2855
2856 @beginEventTable{wxMoveEvent}
2857 @event{EVT_MOVE(func)}
2858 Process a @c wxEVT_MOVE event, which is generated when a window is moved.
2859 @event{EVT_MOVE_START(func)}
2860 Process a @c wxEVT_MOVE_START event, which is generated when the user starts
2861 to move or size a window. wxMSW only.
2862 @event{EVT_MOVING(func)}
2863 Process a @c wxEVT_MOVING event, which is generated while the user is
2864 moving the window. wxMSW only.
2865 @event{EVT_MOVE_END(func)}
2866 Process a @c wxEVT_MOVE_END event, which is generated when the user stops
2867 moving or sizing a window. wxMSW only.
2868 @endEventTable
2869
2870 @library{wxcore}
2871 @category{events}
2872
2873 @see wxPoint, @ref overview_events
2874 */
2875 class wxMoveEvent : public wxEvent
2876 {
2877 public:
2878 /**
2879 Constructor.
2880 */
2881 wxMoveEvent(const wxPoint& pt, int id = 0);
2882
2883 /**
2884 Returns the position of the window generating the move change event.
2885 */
2886 wxPoint GetPosition() const;
2887
2888 wxRect GetRect() const;
2889 void SetRect(const wxRect& rect);
2890 void SetPosition(const wxPoint& pos);
2891 };
2892
2893
2894 /**
2895 @class wxSizeEvent
2896
2897 A size event holds information about size change events of wxWindow.
2898
2899 The EVT_SIZE handler function will be called when the window has been resized.
2900
2901 You may wish to use this for frames to resize their child windows as appropriate.
2902
2903 Note that the size passed is of the whole window: call wxWindow::GetClientSize()
2904 for the area which may be used by the application.
2905
2906 When a window is resized, usually only a small part of the window is damaged
2907 and you may only need to repaint that area. However, if your drawing depends on the
2908 size of the window, you may need to clear the DC explicitly and repaint the whole window.
2909 In which case, you may need to call wxWindow::Refresh to invalidate the entire window.
2910
2911 @b Important : Sizers ( see @ref overview_sizer ) rely on size events to function
2912 correctly. Therefore, in a sizer-based layout, do not forget to call Skip on all
2913 size events you catch (and don't catch size events at all when you don't need to).
2914
2915 @beginEventTable{wxSizeEvent}
2916 @event{EVT_SIZE(func)}
2917 Process a @c wxEVT_SIZE event.
2918 @endEventTable
2919
2920 @library{wxcore}
2921 @category{events}
2922
2923 @see wxSize, @ref overview_events
2924 */
2925 class wxSizeEvent : public wxEvent
2926 {
2927 public:
2928 /**
2929 Constructor.
2930 */
2931 wxSizeEvent(const wxSize& sz, int id = 0);
2932
2933 /**
2934 Returns the entire size of the window generating the size change event.
2935
2936 This is the new total size of the window, i.e. the same size as would
2937 be returned by wxWindow::GetSize() if it were called now. Use
2938 wxWindow::GetClientSize() if you catch this event in a top level window
2939 such as wxFrame to find the size available for the window contents.
2940 */
2941 wxSize GetSize() const;
2942 void SetSize(wxSize size);
2943
2944 wxRect GetRect() const;
2945 void SetRect(wxRect rect);
2946 };
2947
2948
2949
2950 /**
2951 @class wxSetCursorEvent
2952
2953 A wxSetCursorEvent is generated from wxWindow when the mouse cursor is about
2954 to be set as a result of mouse motion.
2955
2956 This event gives the application the chance to perform specific mouse cursor
2957 processing based on the current position of the mouse within the window.
2958 Use wxSetCursorEvent::SetCursor to specify the cursor you want to be displayed.
2959
2960 @beginEventTable{wxSetCursorEvent}
2961 @event{EVT_SET_CURSOR(func)}
2962 Process a @c wxEVT_SET_CURSOR event.
2963 @endEventTable
2964
2965 @library{wxcore}
2966 @category{events}
2967
2968 @see ::wxSetCursor, wxWindow::wxSetCursor
2969 */
2970 class wxSetCursorEvent : public wxEvent
2971 {
2972 public:
2973 /**
2974 Constructor, used by the library itself internally to initialize the event
2975 object.
2976 */
2977 wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0);
2978
2979 /**
2980 Returns a reference to the cursor specified by this event.
2981 */
2982 const wxCursor& GetCursor() const;
2983
2984 /**
2985 Returns the X coordinate of the mouse in client coordinates.
2986 */
2987 wxCoord GetX() const;
2988
2989 /**
2990 Returns the Y coordinate of the mouse in client coordinates.
2991 */
2992 wxCoord GetY() const;
2993
2994 /**
2995 Returns @true if the cursor specified by this event is a valid cursor.
2996
2997 @remarks You cannot specify wxNullCursor with this event, as it is not
2998 considered a valid cursor.
2999 */
3000 bool HasCursor() const;
3001
3002 /**
3003 Sets the cursor associated with this event.
3004 */
3005 void SetCursor(const wxCursor& cursor);
3006 };
3007
3008
3009
3010 // ============================================================================
3011 // Global functions/macros
3012 // ============================================================================
3013
3014 /** @addtogroup group_funcmacro_events */
3015 //@{
3016
3017
3018 wxEventType wxEVT_COMMAND_BUTTON_CLICKED;
3019 wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED;
3020 wxEventType wxEVT_COMMAND_CHOICE_SELECTED;
3021 wxEventType wxEVT_COMMAND_LISTBOX_SELECTED;
3022 wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
3023 wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED;
3024 wxEventType wxEVT_COMMAND_MENU_SELECTED;
3025 wxEventType wxEVT_COMMAND_SLIDER_UPDATED;
3026 wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED;
3027 wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED;
3028 wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED;
3029 wxEventType wxEVT_COMMAND_VLBOX_SELECTED;
3030 wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED;
3031 wxEventType wxEVT_COMMAND_TOOL_RCLICKED;
3032 wxEventType wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED;
3033 wxEventType wxEVT_COMMAND_TOOL_ENTER;
3034 wxEventType wxEVT_COMMAND_COMBOBOX_DROPDOWN;
3035 wxEventType wxEVT_COMMAND_COMBOBOX_CLOSEUP;
3036 wxEventType wxEVT_THREAD;
3037 wxEventType wxEVT_LEFT_DOWN;
3038 wxEventType wxEVT_LEFT_UP;
3039 wxEventType wxEVT_MIDDLE_DOWN;
3040 wxEventType wxEVT_MIDDLE_UP;
3041 wxEventType wxEVT_RIGHT_DOWN;
3042 wxEventType wxEVT_RIGHT_UP;
3043 wxEventType wxEVT_MOTION;
3044 wxEventType wxEVT_ENTER_WINDOW;
3045 wxEventType wxEVT_LEAVE_WINDOW;
3046 wxEventType wxEVT_LEFT_DCLICK;
3047 wxEventType wxEVT_MIDDLE_DCLICK;
3048 wxEventType wxEVT_RIGHT_DCLICK;
3049 wxEventType wxEVT_SET_FOCUS;
3050 wxEventType wxEVT_KILL_FOCUS;
3051 wxEventType wxEVT_CHILD_FOCUS;
3052 wxEventType wxEVT_MOUSEWHEEL;
3053 wxEventType wxEVT_AUX1_DOWN;
3054 wxEventType wxEVT_AUX1_UP;
3055 wxEventType wxEVT_AUX1_DCLICK;
3056 wxEventType wxEVT_AUX2_DOWN;
3057 wxEventType wxEVT_AUX2_UP;
3058 wxEventType wxEVT_AUX2_DCLICK;
3059 wxEventType wxEVT_CHAR;
3060 wxEventType wxEVT_CHAR_HOOK;
3061 wxEventType wxEVT_NAVIGATION_KEY;
3062 wxEventType wxEVT_KEY_DOWN;
3063 wxEventType wxEVT_KEY_UP;
3064 wxEventType wxEVT_HOTKEY;
3065 wxEventType wxEVT_SET_CURSOR;
3066 wxEventType wxEVT_SCROLL_TOP;
3067 wxEventType wxEVT_SCROLL_BOTTOM;
3068 wxEventType wxEVT_SCROLL_LINEUP;
3069 wxEventType wxEVT_SCROLL_LINEDOWN;
3070 wxEventType wxEVT_SCROLL_PAGEUP;
3071 wxEventType wxEVT_SCROLL_PAGEDOWN;
3072 wxEventType wxEVT_SCROLL_THUMBTRACK;
3073 wxEventType wxEVT_SCROLL_THUMBRELEASE;
3074 wxEventType wxEVT_SCROLL_CHANGED;
3075 wxEventType wxEVT_SPIN_UP;
3076 wxEventType wxEVT_SPIN_DOWN;
3077 wxEventType wxEVT_SPIN;
3078 wxEventType wxEVT_SCROLLWIN_TOP;
3079 wxEventType wxEVT_SCROLLWIN_BOTTOM;
3080 wxEventType wxEVT_SCROLLWIN_LINEUP;
3081 wxEventType wxEVT_SCROLLWIN_LINEDOWN;
3082 wxEventType wxEVT_SCROLLWIN_PAGEUP;
3083 wxEventType wxEVT_SCROLLWIN_PAGEDOWN;
3084 wxEventType wxEVT_SCROLLWIN_THUMBTRACK;
3085 wxEventType wxEVT_SCROLLWIN_THUMBRELEASE;
3086 wxEventType wxEVT_SIZE;
3087 wxEventType wxEVT_MOVE;
3088 wxEventType wxEVT_CLOSE_WINDOW;
3089 wxEventType wxEVT_END_SESSION;
3090 wxEventType wxEVT_QUERY_END_SESSION;
3091 wxEventType wxEVT_ACTIVATE_APP;
3092 wxEventType wxEVT_ACTIVATE;
3093 wxEventType wxEVT_CREATE;
3094 wxEventType wxEVT_DESTROY;
3095 wxEventType wxEVT_SHOW;
3096 wxEventType wxEVT_ICONIZE;
3097 wxEventType wxEVT_MAXIMIZE;
3098 wxEventType wxEVT_MOUSE_CAPTURE_CHANGED;
3099 wxEventType wxEVT_MOUSE_CAPTURE_LOST;
3100 wxEventType wxEVT_PAINT;
3101 wxEventType wxEVT_ERASE_BACKGROUND;
3102 wxEventType wxEVT_NC_PAINT;
3103 wxEventType wxEVT_MENU_OPEN;
3104 wxEventType wxEVT_MENU_CLOSE;
3105 wxEventType wxEVT_MENU_HIGHLIGHT;
3106 wxEventType wxEVT_CONTEXT_MENU;
3107 wxEventType wxEVT_SYS_COLOUR_CHANGED;
3108 wxEventType wxEVT_DISPLAY_CHANGED;
3109 wxEventType wxEVT_QUERY_NEW_PALETTE;
3110 wxEventType wxEVT_PALETTE_CHANGED;
3111 wxEventType wxEVT_JOY_BUTTON_DOWN;
3112 wxEventType wxEVT_JOY_BUTTON_UP;
3113 wxEventType wxEVT_JOY_MOVE;
3114 wxEventType wxEVT_JOY_ZMOVE;
3115 wxEventType wxEVT_DROP_FILES;
3116 wxEventType wxEVT_INIT_DIALOG;
3117 wxEventType wxEVT_IDLE;
3118 wxEventType wxEVT_UPDATE_UI;
3119 wxEventType wxEVT_SIZING;
3120 wxEventType wxEVT_MOVING;
3121 wxEventType wxEVT_MOVE_START;
3122 wxEventType wxEVT_MOVE_END;
3123 wxEventType wxEVT_HIBERNATE;
3124 wxEventType wxEVT_COMMAND_TEXT_COPY;
3125 wxEventType wxEVT_COMMAND_TEXT_CUT;
3126 wxEventType wxEVT_COMMAND_TEXT_PASTE;
3127 wxEventType wxEVT_COMMAND_LEFT_CLICK;
3128 wxEventType wxEVT_COMMAND_LEFT_DCLICK;
3129 wxEventType wxEVT_COMMAND_RIGHT_CLICK;
3130 wxEventType wxEVT_COMMAND_RIGHT_DCLICK;
3131 wxEventType wxEVT_COMMAND_SET_FOCUS;
3132 wxEventType wxEVT_COMMAND_KILL_FOCUS;
3133 wxEventType wxEVT_COMMAND_ENTER;
3134 wxEventType wxEVT_HELP;
3135 wxEventType wxEVT_DETAILED_HELP;
3136 wxEventType wxEVT_COMMAND_TEXT_UPDATED;
3137 wxEventType wxEVT_COMMAND_TEXT_ENTER;
3138 wxEventType wxEVT_COMMAND_TOOL_CLICKED;
3139 wxEventType wxEVT_WINDOW_MODAL_DIALOG_CLOSED;
3140
3141
3142
3143 //@}
3144