]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/event.h
Add wxDirCtrl::GetPath().
[wxWidgets.git] / interface / wx / event.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: event.h
71abf17e
VZ
3// Purpose: interface of wxEvent-derived classes,
4// see event_base.h for wxEvtHandler and wxEvent.
23324ae1
FM
5// Author: wxWidgets team
6// RCS-ID: $Id$
526954c5 7// Licence: wxWindows licence
23324ae1
FM
8/////////////////////////////////////////////////////////////////////////////
9
42013f4c 10
71abf17e
VZ
11/**
12 @class wxEventBlocker
42013f4c 13
71abf17e
VZ
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.
42013f4c 16
71abf17e 17 Example:
42013f4c 18
71abf17e
VZ
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);
23324ae1 26
71abf17e
VZ
27 for ( int i = 0; i 1000; i++ )
28 FunctionWhichSendsEvents(i);
42013f4c 29
71abf17e 30 } // ~wxEventBlocker called, old event handler is restored
7f853dd0 31
71abf17e
VZ
32 // the event generated by this call will be processed:
33 FunctionWhichSendsEvents(0)
34 }
35 @endcode
42013f4c 36
71abf17e
VZ
37 @library{wxcore}
38 @category{events}
42013f4c 39
71abf17e
VZ
40 @see @ref overview_events_processing, wxEvtHandler
41*/
42class wxEventBlocker : public wxEvtHandler
43{
44public:
42013f4c 45 /**
71abf17e 46 Constructs the blocker for the given window and for the given event type.
42013f4c 47
71abf17e
VZ
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.
7f853dd0 51
71abf17e
VZ
52 Note that the @a win window @b must remain alive until the
53 wxEventBlocker object destruction.
7f853dd0 54 */
71abf17e 55 wxEventBlocker(wxWindow* win, wxEventType type = -1);
7f853dd0
FM
56
57 /**
71abf17e
VZ
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.
7f853dd0 60 */
71abf17e 61 virtual ~wxEventBlocker();
7f853dd0
FM
62
63 /**
71abf17e 64 Adds to the list of event types which should be blocked the given @a eventType.
42013f4c 65 */
71abf17e
VZ
66 void Block(wxEventType eventType);
67};
8cc208e3 68
8cc208e3 69
8cc208e3 70
71abf17e
VZ
71/**
72 Helper class to temporarily change an event to not propagate.
73*/
74class wxPropagationDisabler
75{
76public:
77 wxPropagationDisabler(wxEvent& event);
78 ~wxPropagationDisabler();
79};
8cc208e3 80
8cc208e3 81
71abf17e
VZ
82/**
83 Helper class to temporarily lower propagation level.
84*/
85class wxPropagateOnce
86{
87public:
88 wxPropagateOnce(wxEvent& event);
89 ~wxPropagateOnce();
42013f4c 90};
23324ae1 91
e54c96f1 92
71abf17e 93
7a34307e
VZ
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*/
102enum 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
4f742042 113 /// tab key, on and off numeric keypads
7a34307e
VZ
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
23324ae1 124/**
42013f4c 125 @class wxKeyEvent
7c913512 126
0d2f3b9d 127 This event class contains information about key press and release events.
7c913512 128
7333c0ef
VZ
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.
09bdb1cb
VZ
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.
7333c0ef
VZ
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.
0d2f3b9d 206
d0fb62a6
VZ
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.
1f1d2182 223
42013f4c
FM
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
d0fb62a6
VZ
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.
1f1d2182 232
5effc1cf
VZ
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
42013f4c
FM
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
0d2f3b9d
VZ
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.
1f1d2182
FM
244
245
42013f4c 246 @beginEventTable{wxKeyEvent}
8c6791e4 247 @event{EVT_KEY_DOWN(func)}
f47a3591
VZ
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).
8c6791e4 251 @event{EVT_KEY_UP(func)}
3051a44a 252 Process a @c wxEVT_KEY_UP event (any key has been released).
8c6791e4 253 @event{EVT_CHAR(func)}
3051a44a 254 Process a @c wxEVT_CHAR event.
ff450486 255 @event{EVT_CHAR_HOOK(func)}
3a95f73c
VZ
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
4cf1a9bf
VZ
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.
1f1d2182 277 @endEventTable
7c913512 278
0e097789
VZ
279 @see wxKeyboardState
280
23324ae1
FM
281 @library{wxcore}
282 @category{events}
23324ae1 283*/
0e097789
VZ
284class wxKeyEvent : public wxEvent,
285 public wxKeyboardState
23324ae1
FM
286{
287public:
288 /**
289 Constructor.
42013f4c 290 Currently, the only valid event types are @c wxEVT_CHAR and @c wxEVT_CHAR_HOOK.
23324ae1 291 */
42013f4c 292 wxKeyEvent(wxEventType keyEventType = wxEVT_NULL);
23324ae1 293
42013f4c 294 /**
b6885972
VZ
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
ecad2757
VZ
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.
b6885972
VZ
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 {
9a1b36af
VZ
316 wxChar uc = event.GetUnicodeKey();
317 if ( uc != WXK_NONE )
b6885972 318 {
9a1b36af
VZ
319 // It's a "normal" character. Notice that this includes
320 // control characters in 1..31 range, e.g. WXK_RETURN or
6b7bcbf1
VZ
321 // WXK_BACK, so check for them explicitly.
322 if ( uc >= 32 )
9a1b36af
VZ
323 {
324 wxLogMessage("You pressed '%c'", uc);
325 }
326 else
327 {
328 // It's a control character
329 ...
330 }
b6885972 331 }
9a1b36af 332 else // No Unicode equivalent.
b6885972
VZ
333 {
334 // It's a special key, deal with all the known ones:
95aced61 335 switch ( GetKeyCode() )
b6885972
VZ
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
42013f4c
FM
349 */
350 int GetKeyCode() const;
351
7a34307e
VZ
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
42013f4c
FM
362 //@{
363 /**
364 Obtains the position (in client coordinates) at which the key was pressed.
2f7baaec
VZ
365
366 Notice that this position is simply the current mouse pointer position
367 and has no special relationship to the key event itself.
42013f4c
FM
368 */
369 wxPoint GetPosition() const;
370 void GetPosition(long* x, long* y) const;
371 //@}
372
373 /**
5995a84f
VZ
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.
42013f4c
FM
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 /**
5995a84f
VZ
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.
42013f4c
FM
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
0d2f3b9d 415 If the key pressed doesn't have any character value (e.g. a cursor key)
86408a03
VZ
416 this method will return @c WXK_NONE. In this case you should use
417 GetKeyCode() to retrieve the value of the key.
0d2f3b9d 418
42013f4c
FM
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.
2f7baaec
VZ
426
427 @see GetPosition()
42013f4c
FM
428 */
429 wxCoord GetX() const;
430
431 /**
432 Returns the Y position (in client coordinates) of the event.
2f7baaec
VZ
433
434 @see GetPosition()
42013f4c
FM
435 */
436 wxCoord GetY() const;
4cf1a9bf
VZ
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;
23324ae1
FM
465};
466
467
e54c96f1 468
50e55c13
RD
469enum
470{
471 wxJOYSTICK1,
472 wxJOYSTICK2
473};
474
475// Which button is down?
476enum
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
23324ae1 486/**
42013f4c 487 @class wxJoystickEvent
7c913512 488
42013f4c
FM
489 This event class contains information about joystick events, particularly
490 events received by windows.
1f1d2182 491
42013f4c 492 @beginEventTable{wxJoystickEvent}
3051a44a
FM
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)}
42013f4c 502 Processes all joystick events.
1f1d2182
FM
503 @endEventTable
504
23324ae1
FM
505 @library{wxcore}
506 @category{events}
7c913512 507
42013f4c 508 @see wxJoystick
23324ae1 509*/
42013f4c 510class wxJoystickEvent : public wxEvent
23324ae1
FM
511{
512public:
513 /**
514 Constructor.
515 */
42013f4c
FM
516 wxJoystickEvent(wxEventType eventType = wxEVT_NULL, int state = 0,
517 int joystick = wxJOYSTICK1,
518 int change = 0);
23324ae1
FM
519
520 /**
42013f4c
FM
521 Returns @true if the event was a down event from the specified button
522 (or any button).
23324ae1 523
42013f4c
FM
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.
23324ae1 527 */
42013f4c 528 bool ButtonDown(int button = wxJOY_BUTTON_ANY) const;
23324ae1
FM
529
530 /**
42013f4c 531 Returns @true if the specified button (or any button) was in a down state.
23324ae1 532
42013f4c
FM
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.
23324ae1 536 */
42013f4c 537 bool ButtonIsDown(int button = wxJOY_BUTTON_ANY) const;
23324ae1
FM
538
539 /**
42013f4c
FM
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.
23324ae1 546 */
42013f4c 547 bool ButtonUp(int button = wxJOY_BUTTON_ANY) const;
23324ae1
FM
548
549 /**
42013f4c
FM
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.
23324ae1 553 */
42013f4c 554 int GetButtonChange() const;
23324ae1
FM
555
556 /**
42013f4c
FM
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.
23324ae1 560 */
42013f4c 561 int GetButtonState() const;
23324ae1
FM
562
563 /**
42013f4c
FM
564 Returns the identifier of the joystick generating the event - one of
565 wxJOYSTICK1 and wxJOYSTICK2.
23324ae1 566 */
42013f4c 567 int GetJoystick() const;
23324ae1
FM
568
569 /**
42013f4c 570 Returns the x, y position of the joystick event.
3b2f80c2
VZ
571
572 These coordinates are valid for all the events except wxEVT_JOY_ZMOVE.
23324ae1 573 */
42013f4c 574 wxPoint GetPosition() const;
23324ae1
FM
575
576 /**
42013f4c 577 Returns the z position of the joystick event.
3b2f80c2
VZ
578
579 This method can only be used for wxEVT_JOY_ZMOVE events.
23324ae1 580 */
42013f4c 581 int GetZPosition() const;
23324ae1
FM
582
583 /**
42013f4c
FM
584 Returns @true if this was a button up or down event
585 (@e not 'is any button down?').
23324ae1 586 */
42013f4c 587 bool IsButton() const;
23324ae1
FM
588
589 /**
42013f4c 590 Returns @true if this was an x, y move event.
23324ae1 591 */
42013f4c 592 bool IsMove() const;
23324ae1
FM
593
594 /**
42013f4c 595 Returns @true if this was a z move event.
23324ae1 596 */
42013f4c
FM
597 bool IsZMove() const;
598};
23324ae1 599
3c4f71cc 600
23324ae1 601
42013f4c
FM
602/**
603 @class wxScrollWinEvent
42013f4c
FM
604
605 A scroll event holds information about events sent from scrolling windows.
606
3051a44a
FM
607 Note that you can use the EVT_SCROLLWIN* macros for intercepting scroll window events
608 from the receiving window.
23324ae1 609
42013f4c 610 @beginEventTable{wxScrollWinEvent}
8c6791e4 611 @event{EVT_SCROLLWIN(func)}
42013f4c 612 Process all scroll events.
8c6791e4 613 @event{EVT_SCROLLWIN_TOP(func)}
3a194bda 614 Process @c wxEVT_SCROLLWIN_TOP scroll-to-top events.
8c6791e4 615 @event{EVT_SCROLLWIN_BOTTOM(func)}
3a194bda 616 Process @c wxEVT_SCROLLWIN_BOTTOM scroll-to-bottom events.
8c6791e4 617 @event{EVT_SCROLLWIN_LINEUP(func)}
3a194bda 618 Process @c wxEVT_SCROLLWIN_LINEUP line up events.
8c6791e4 619 @event{EVT_SCROLLWIN_LINEDOWN(func)}
3a194bda 620 Process @c wxEVT_SCROLLWIN_LINEDOWN line down events.
8c6791e4 621 @event{EVT_SCROLLWIN_PAGEUP(func)}
3a194bda 622 Process @c wxEVT_SCROLLWIN_PAGEUP page up events.
8c6791e4 623 @event{EVT_SCROLLWIN_PAGEDOWN(func)}
3a194bda 624 Process @c wxEVT_SCROLLWIN_PAGEDOWN page down events.
8c6791e4 625 @event{EVT_SCROLLWIN_THUMBTRACK(func)}
3a194bda 626 Process @c wxEVT_SCROLLWIN_THUMBTRACK thumbtrack events
42013f4c 627 (frequent events sent as the user drags the thumbtrack).
8c6791e4 628 @event{EVT_SCROLLWIN_THUMBRELEASE(func)}
3a194bda 629 Process @c wxEVT_SCROLLWIN_THUMBRELEASE thumb release events.
42013f4c
FM
630 @endEventTable
631
632
633 @library{wxcore}
634 @category{events}
635
3e083d65 636 @see wxScrollEvent, @ref overview_events
42013f4c
FM
637*/
638class wxScrollWinEvent : public wxEvent
639{
640public:
23324ae1 641 /**
42013f4c 642 Constructor.
23324ae1 643 */
42013f4c
FM
644 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, int pos = 0,
645 int orientation = 0);
23324ae1
FM
646
647 /**
42013f4c
FM
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
23324ae1 652 */
42013f4c 653 int GetOrientation() const;
23324ae1
FM
654
655 /**
42013f4c
FM
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.
23324ae1 660 */
42013f4c 661 int GetPosition() const;
a90e69f7
RD
662
663 void SetOrientation(int orient);
664 void SetPosition(int pos);
23324ae1
FM
665};
666
667
e54c96f1 668
23324ae1 669/**
42013f4c 670 @class wxSysColourChangedEvent
7c913512 671
42013f4c
FM
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.
7c913512 675
42013f4c
FM
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.
3d6c68c1 681
42013f4c 682 @beginEventTable{wxSysColourChangedEvent}
8c6791e4 683 @event{EVT_SYS_COLOUR_CHANGED(func)}
3051a44a 684 Process a @c wxEVT_SYS_COLOUR_CHANGED event.
3d6c68c1
VS
685 @endEventTable
686
23324ae1
FM
687 @library{wxcore}
688 @category{events}
7c913512 689
3e083d65 690 @see @ref overview_events
23324ae1 691*/
42013f4c 692class wxSysColourChangedEvent : public wxEvent
23324ae1
FM
693{
694public:
695 /**
3d6c68c1 696 Constructor.
23324ae1 697 */
42013f4c 698 wxSysColourChangedEvent();
23324ae1
FM
699};
700
701
e54c96f1 702
23324ae1 703/**
42013f4c 704 @class wxWindowCreateEvent
7c913512 705
42013f4c
FM
706 This event is sent just after the actual window associated with a wxWindow
707 object has been created.
7c913512 708
42013f4c
FM
709 Since it is derived from wxCommandEvent, the event propagates up
710 the window hierarchy.
7c913512 711
42013f4c 712 @beginEventTable{wxWindowCreateEvent}
8c6791e4 713 @event{EVT_WINDOW_CREATE(func)}
3051a44a 714 Process a @c wxEVT_CREATE event.
42013f4c 715 @endEventTable
7c913512 716
23324ae1
FM
717 @library{wxcore}
718 @category{events}
7c913512 719
3e083d65 720 @see @ref overview_events, wxWindowDestroyEvent
23324ae1 721*/
42013f4c 722class wxWindowCreateEvent : public wxCommandEvent
23324ae1
FM
723{
724public:
725 /**
42013f4c
FM
726 Constructor.
727 */
728 wxWindowCreateEvent(wxWindow* win = NULL);
a79a6671 729
57ab6f23 730 /// Return the window being created.
a79a6671 731 wxWindow *GetWindow() const;
42013f4c 732};
3c4f71cc 733
23324ae1 734
23324ae1 735
42013f4c
FM
736/**
737 @class wxPaintEvent
23324ae1 738
42013f4c 739 A paint event is sent when a window's contents needs to be repainted.
23324ae1 740
7ca106e8
VZ
741 The handler of this event must create a wxPaintDC object and use it for
742 painting the window contents. For example:
42013f4c
FM
743 @code
744 void MyWindow::OnPaint(wxPaintEvent& event)
745 {
746 wxPaintDC dc(this);
23324ae1 747
42013f4c
FM
748 DrawMyDocument(dc);
749 }
750 @endcode
7ca106e8
VZ
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
42013f4c
FM
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);
23324ae1 767
42013f4c
FM
768 // Find Out where the window is scrolled to
769 int vbX,vbY; // Top left corner of client
770 GetViewStart(&vbX,&vbY);
23324ae1 771
42013f4c
FM
772 int vX,vY,vW,vH; // Dimensions of client area in pixels
773 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
23324ae1 774
42013f4c
FM
775 while (upd)
776 {
777 vX = upd.GetX();
778 vY = upd.GetY();
779 vW = upd.GetW();
780 vH = upd.GetH();
23324ae1 781
42013f4c
FM
782 // Alternatively we can do this:
783 // wxRect rect(upd.GetRect());
3c4f71cc 784
42013f4c
FM
785 // Repaint this rectangle
786 ...some code...
3c4f71cc 787
42013f4c
FM
788 upd ++ ;
789 }
790 }
791 @endcode
3c4f71cc 792
7ca106e8
VZ
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
3c4f71cc 799
42013f4c 800 @beginEventTable{wxPaintEvent}
8c6791e4 801 @event{EVT_PAINT(func)}
3051a44a 802 Process a @c wxEVT_PAINT event.
42013f4c 803 @endEventTable
3c4f71cc 804
42013f4c
FM
805 @library{wxcore}
806 @category{events}
3c4f71cc 807
3e083d65 808 @see @ref overview_events
42013f4c
FM
809*/
810class wxPaintEvent : public wxEvent
811{
812public:
813 /**
814 Constructor.
815 */
816 wxPaintEvent(int id = 0);
817};
3c4f71cc 818
3c4f71cc 819
3c4f71cc 820
42013f4c
FM
821/**
822 @class wxMaximizeEvent
3c4f71cc 823
42013f4c
FM
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.
3c4f71cc 827
89c6e024 828 Currently this event is only generated in wxMSW, wxGTK, wxOSX/Cocoa and wxOS2
e22e5ee4
VZ
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
42013f4c 832 @beginEventTable{wxMaximizeEvent}
8c6791e4 833 @event{EVT_MAXIMIZE(func)}
3051a44a 834 Process a @c wxEVT_MAXIMIZE event.
42013f4c 835 @endEventTable
3c4f71cc 836
42013f4c
FM
837 @library{wxcore}
838 @category{events}
23324ae1 839
3e083d65 840 @see @ref overview_events, wxTopLevelWindow::Maximize,
42013f4c
FM
841 wxTopLevelWindow::IsMaximized
842*/
843class wxMaximizeEvent : public wxEvent
844{
845public:
23324ae1 846 /**
42013f4c 847 Constructor. Only used by wxWidgets internally.
23324ae1 848 */
42013f4c
FM
849 wxMaximizeEvent(int id = 0);
850};
23324ae1 851
42013f4c
FM
852/**
853 The possibles modes to pass to wxUpdateUIEvent::SetMode().
854*/
855enum wxUpdateUIMode
856{
857 /** Send UI update events to all windows. */
858 wxUPDATE_UI_PROCESS_ALL,
23324ae1 859
42013f4c
FM
860 /** Send UI update events to windows that have
861 the wxWS_EX_PROCESS_UI_UPDATES flag specified. */
862 wxUPDATE_UI_PROCESS_SPECIFIED
863};
23324ae1 864
3c4f71cc 865
42013f4c
FM
866/**
867 @class wxUpdateUIEvent
23324ae1 868
42013f4c
FM
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.
23324ae1 871
42013f4c
FM
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.
3c4f71cc 876
42013f4c
FM
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.
23324ae1 880
42013f4c
FM
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.
23324ae1 887
42013f4c
FM
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.
23324ae1 891
42013f4c
FM
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.
3c4f71cc 901
42013f4c
FM
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.
23324ae1 905
42013f4c
FM
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.
23324ae1 909
23324ae1 910
42013f4c 911 @beginEventTable{wxUpdateUIEvent}
8c6791e4 912 @event{EVT_UPDATE_UI(id, func)}
3051a44a 913 Process a @c wxEVT_UPDATE_UI event for the command with the given id.
8c6791e4 914 @event{EVT_UPDATE_UI_RANGE(id1, id2, func)}
3051a44a 915 Process a @c wxEVT_UPDATE_UI event for any command with id included in the given range.
42013f4c 916 @endEventTable
23324ae1 917
42013f4c
FM
918 @library{wxcore}
919 @category{events}
23324ae1 920
3e083d65 921 @see @ref overview_events
42013f4c
FM
922*/
923class wxUpdateUIEvent : public wxCommandEvent
924{
925public:
23324ae1 926 /**
42013f4c 927 Constructor.
23324ae1 928 */
42013f4c 929 wxUpdateUIEvent(wxWindowID commandId = 0);
23324ae1
FM
930
931 /**
42013f4c
FM
932 Returns @true if it is appropriate to update (send UI update events to)
933 this window.
23324ae1 934
42013f4c
FM
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.
23324ae1 943
42013f4c 944 @see ResetUpdateTime(), SetUpdateInterval(), SetMode()
23324ae1 945 */
42013f4c 946 static bool CanUpdate(wxWindow* window);
23324ae1
FM
947
948 /**
42013f4c 949 Check or uncheck the UI element.
23324ae1 950 */
42013f4c 951 void Check(bool check);
23324ae1
FM
952
953 /**
42013f4c 954 Enable or disable the UI element.
23324ae1 955 */
42013f4c 956 void Enable(bool enable);
23324ae1
FM
957
958 /**
42013f4c 959 Returns @true if the UI element should be checked.
23324ae1 960 */
42013f4c 961 bool GetChecked() const;
23324ae1
FM
962
963 /**
42013f4c 964 Returns @true if the UI element should be enabled.
23324ae1 965 */
42013f4c 966 bool GetEnabled() const;
23324ae1
FM
967
968 /**
42013f4c
FM
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.
23324ae1 972
42013f4c 973 @see SetMode()
23324ae1 974 */
42013f4c 975 static wxUpdateUIMode GetMode();
23324ae1
FM
976
977 /**
42013f4c
FM
978 Returns @true if the application has called Check().
979 For wxWidgets internal use only.
23324ae1 980 */
42013f4c 981 bool GetSetChecked() const;
23324ae1
FM
982
983 /**
42013f4c
FM
984 Returns @true if the application has called Enable().
985 For wxWidgets internal use only.
23324ae1 986 */
42013f4c 987 bool GetSetEnabled() const;
23324ae1
FM
988
989 /**
42013f4c
FM
990 Returns @true if the application has called Show().
991 For wxWidgets internal use only.
23324ae1 992 */
42013f4c 993 bool GetSetShown() const;
23324ae1
FM
994
995 /**
42013f4c
FM
996 Returns @true if the application has called SetText().
997 For wxWidgets internal use only.
23324ae1 998 */
42013f4c 999 bool GetSetText() const;
23324ae1
FM
1000
1001 /**
42013f4c 1002 Returns @true if the UI element should be shown.
23324ae1 1003 */
42013f4c 1004 bool GetShown() const;
23324ae1
FM
1005
1006 /**
42013f4c 1007 Returns the text that should be set for the UI element.
23324ae1 1008 */
42013f4c 1009 wxString GetText() const;
23324ae1
FM
1010
1011 /**
42013f4c
FM
1012 Returns the current interval between updates in milliseconds.
1013 The value -1 disables updates, 0 updates as frequently as possible.
23324ae1 1014
42013f4c 1015 @see SetUpdateInterval().
23324ae1 1016 */
42013f4c 1017 static long GetUpdateInterval();
23324ae1
FM
1018
1019 /**
42013f4c 1020 Used internally to reset the last-updated time to the current time.
23324ae1 1021
42013f4c
FM
1022 It is assumed that update events are normally sent in idle time, so this
1023 is called at the end of idle processing.
23324ae1 1024
42013f4c 1025 @see CanUpdate(), SetUpdateInterval(), SetMode()
23324ae1 1026 */
42013f4c 1027 static void ResetUpdateTime();
23324ae1
FM
1028
1029 /**
42013f4c
FM
1030 Specify how wxWidgets will send update events: to all windows, or only to
1031 those which specify that they will process the events.
23324ae1 1032
42013f4c
FM
1033 @param mode
1034 this parameter may be one of the ::wxUpdateUIMode enumeration values.
1035 The default mode is wxUPDATE_UI_PROCESS_ALL.
23324ae1 1036 */
42013f4c 1037 static void SetMode(wxUpdateUIMode mode);
23324ae1
FM
1038
1039 /**
42013f4c 1040 Sets the text for this UI element.
23324ae1 1041 */
42013f4c 1042 void SetText(const wxString& text);
23324ae1
FM
1043
1044 /**
42013f4c 1045 Sets the interval between updates in milliseconds.
23324ae1 1046
42013f4c
FM
1047 Set to -1 to disable updates, or to 0 to update as frequently as possible.
1048 The default is 0.
23324ae1 1049
42013f4c
FM
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.
23324ae1 1054 */
42013f4c 1055 static void SetUpdateInterval(long updateInterval);
23324ae1
FM
1056
1057 /**
42013f4c 1058 Show or hide the UI element.
23324ae1 1059 */
42013f4c
FM
1060 void Show(bool show);
1061};
23324ae1
FM
1062
1063
23324ae1 1064
42013f4c
FM
1065/**
1066 @class wxClipboardTextEvent
23324ae1 1067
42013f4c
FM
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.
23324ae1 1071
3a194bda
SL
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.
23324ae1 1074
42013f4c
FM
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.
23324ae1 1081
42013f4c
FM
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.
23324ae1 1085
42013f4c 1086 @note
75aaa4c5
VZ
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.
23324ae1 1089
42013f4c 1090 @beginEventTable{wxClipboardTextEvent}
8c6791e4 1091 @event{EVT_TEXT_COPY(id, func)}
42013f4c 1092 Some or all of the controls content was copied to the clipboard.
8c6791e4 1093 @event{EVT_TEXT_CUT(id, func)}
42013f4c
FM
1094 Some or all of the controls content was cut (i.e. copied and
1095 deleted).
8c6791e4 1096 @event{EVT_TEXT_PASTE(id, func)}
42013f4c
FM
1097 Clipboard content was pasted into the control.
1098 @endEventTable
23324ae1 1099
23324ae1 1100
42013f4c
FM
1101 @library{wxcore}
1102 @category{events}
23324ae1 1103
42013f4c
FM
1104 @see wxClipboard
1105*/
1106class wxClipboardTextEvent : public wxCommandEvent
1107{
1108public:
23324ae1 1109 /**
42013f4c 1110 Constructor.
23324ae1 1111 */
42013f4c 1112 wxClipboardTextEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
23324ae1
FM
1113};
1114
41469c9e
VZ
1115/**
1116 Possible axis values for mouse wheel scroll events.
1117
1118 @since 2.9.4
1119 */
1120enum wxMouseWheelAxis
1121{
1122 wxMOUSE_WHEEL_VERTICAL, ///< Vertical scroll event.
1123 wxMOUSE_WHEEL_HORIZONTAL ///< Horizontal scroll event.
1124};
23324ae1 1125
e54c96f1 1126
23324ae1 1127/**
42013f4c 1128 @class wxMouseEvent
7c913512 1129
42013f4c
FM
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.
7c913512 1132
42013f4c
FM
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
92dbce73
VZ
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
42013f4c
FM
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
ab826fd8
VZ
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.
42013f4c
FM
1170
1171
1172 @beginEventTable{wxMouseEvent}
8c6791e4 1173 @event{EVT_LEFT_DOWN(func)}
3051a44a 1174 Process a @c wxEVT_LEFT_DOWN event. The handler of this event should normally
42013f4c
FM
1175 call event.Skip() to allow the default processing to take place as otherwise
1176 the window under mouse wouldn't get the focus.
8c6791e4 1177 @event{EVT_LEFT_UP(func)}
3051a44a 1178 Process a @c wxEVT_LEFT_UP event.
8c6791e4 1179 @event{EVT_LEFT_DCLICK(func)}
3051a44a 1180 Process a @c wxEVT_LEFT_DCLICK event.
8c6791e4 1181 @event{EVT_MIDDLE_DOWN(func)}
3051a44a 1182 Process a @c wxEVT_MIDDLE_DOWN event.
8c6791e4 1183 @event{EVT_MIDDLE_UP(func)}
3051a44a 1184 Process a @c wxEVT_MIDDLE_UP event.
8c6791e4 1185 @event{EVT_MIDDLE_DCLICK(func)}
3051a44a 1186 Process a @c wxEVT_MIDDLE_DCLICK event.
8c6791e4 1187 @event{EVT_RIGHT_DOWN(func)}
3051a44a 1188 Process a @c wxEVT_RIGHT_DOWN event.
8c6791e4 1189 @event{EVT_RIGHT_UP(func)}
3051a44a 1190 Process a @c wxEVT_RIGHT_UP event.
8c6791e4 1191 @event{EVT_RIGHT_DCLICK(func)}
3051a44a 1192 Process a @c wxEVT_RIGHT_DCLICK event.
8c6791e4 1193 @event{EVT_MOUSE_AUX1_DOWN(func)}
7f4f5e8c 1194 Process a @c wxEVT_AUX1_DOWN event.
8c6791e4 1195 @event{EVT_MOUSE_AUX1_UP(func)}
7f4f5e8c 1196 Process a @c wxEVT_AUX1_UP event.
8c6791e4 1197 @event{EVT_MOUSE_AUX1_DCLICK(func)}
7f4f5e8c 1198 Process a @c wxEVT_AUX1_DCLICK event.
8c6791e4 1199 @event{EVT_MOUSE_AUX2_DOWN(func)}
7f4f5e8c 1200 Process a @c wxEVT_AUX2_DOWN event.
8c6791e4 1201 @event{EVT_MOUSE_AUX2_UP(func)}
7f4f5e8c 1202 Process a @c wxEVT_AUX2_UP event.
8c6791e4 1203 @event{EVT_MOUSE_AUX2_DCLICK(func)}
7f4f5e8c 1204 Process a @c wxEVT_AUX2_DCLICK event.
8c6791e4 1205 @event{EVT_MOTION(func)}
3051a44a 1206 Process a @c wxEVT_MOTION event.
8c6791e4 1207 @event{EVT_ENTER_WINDOW(func)}
3051a44a 1208 Process a @c wxEVT_ENTER_WINDOW event.
8c6791e4 1209 @event{EVT_LEAVE_WINDOW(func)}
3051a44a 1210 Process a @c wxEVT_LEAVE_WINDOW event.
8c6791e4 1211 @event{EVT_MOUSEWHEEL(func)}
3051a44a 1212 Process a @c wxEVT_MOUSEWHEEL event.
8c6791e4 1213 @event{EVT_MOUSE_EVENTS(func)}
42013f4c
FM
1214 Process all mouse events.
1215 @endEventTable
7c913512 1216
23324ae1
FM
1217 @library{wxcore}
1218 @category{events}
7c913512 1219
0e097789 1220 @see wxKeyEvent
23324ae1 1221*/
0e097789
VZ
1222class wxMouseEvent : public wxEvent,
1223 public wxMouseState
23324ae1
FM
1224{
1225public:
1226 /**
42013f4c 1227 Constructor. Valid event types are:
23324ae1 1228
3a194bda
SL
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
31a9fc93
VZ
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
3a194bda
SL
1246 @li @c wxEVT_MOTION
1247 @li @c wxEVT_MOUSEWHEEL
42013f4c
FM
1248 */
1249 wxMouseEvent(wxEventType mouseEventType = wxEVT_NULL);
23324ae1 1250
23324ae1 1251 /**
42013f4c 1252 Returns @true if the event was a first extra button double click.
23324ae1 1253 */
42013f4c 1254 bool Aux1DClick() const;
23324ae1
FM
1255
1256 /**
42013f4c 1257 Returns @true if the first extra button mouse button changed to down.
23324ae1 1258 */
42013f4c 1259 bool Aux1Down() const;
7c913512 1260
23324ae1 1261 /**
42013f4c 1262 Returns @true if the first extra button mouse button changed to up.
23324ae1 1263 */
42013f4c 1264 bool Aux1Up() const;
23324ae1
FM
1265
1266 /**
42013f4c 1267 Returns @true if the event was a second extra button double click.
23324ae1 1268 */
42013f4c 1269 bool Aux2DClick() const;
23324ae1
FM
1270
1271 /**
42013f4c 1272 Returns @true if the second extra button mouse button changed to down.
23324ae1 1273 */
42013f4c 1274 bool Aux2Down() const;
23324ae1 1275
23324ae1 1276 /**
42013f4c 1277 Returns @true if the second extra button mouse button changed to up.
23324ae1 1278 */
42013f4c 1279 bool Aux2Up() const;
23324ae1
FM
1280
1281 /**
ab826fd8 1282 Returns @true if the event was generated by the specified button.
42013f4c 1283
ab826fd8 1284 @see wxMouseState::ButtoinIsDown()
23324ae1 1285 */
ab826fd8 1286 bool Button(wxMouseButton but) const;
23324ae1
FM
1287
1288 /**
42013f4c
FM
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).
23324ae1 1292 */
ab826fd8 1293 bool ButtonDClick(wxMouseButton but = wxMOUSE_BTN_ANY) const;
23324ae1
FM
1294
1295 /**
42013f4c
FM
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).
23324ae1 1299 */
ab826fd8 1300 bool ButtonDown(wxMouseButton but = wxMOUSE_BTN_ANY) const;
23324ae1
FM
1301
1302 /**
42013f4c
FM
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).
23324ae1 1306 */
ab826fd8 1307 bool ButtonUp(wxMouseButton but = wxMOUSE_BTN_ANY) const;
23324ae1 1308
23324ae1 1309 /**
42013f4c
FM
1310 Returns @true if this was a dragging event (motion while a button is depressed).
1311
1312 @see Moving()
23324ae1 1313 */
42013f4c 1314 bool Dragging() const;
23324ae1
FM
1315
1316 /**
42013f4c
FM
1317 Returns @true if the mouse was entering the window.
1318
1319 @see Leaving()
23324ae1 1320 */
42013f4c 1321 bool Entering() const;
23324ae1
FM
1322
1323 /**
42013f4c
FM
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.
23324ae1 1329 */
42013f4c 1330 int GetButton() const;
e54c96f1 1331
42013f4c
FM
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.
7c913512 1335
42013f4c
FM
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).
7c913512 1339
1e24c2af 1340 @since 2.9.0
42013f4c
FM
1341 */
1342 int GetClickCount() const;
7c913512 1343
23324ae1 1344 /**
42013f4c
FM
1345 Returns the configured number of lines (or whatever) to be scrolled per
1346 wheel action. Defaults to three.
23324ae1 1347 */
42013f4c 1348 int GetLinesPerAction() const;
23324ae1
FM
1349
1350 /**
42013f4c
FM
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).
23324ae1 1354 */
42013f4c 1355 wxPoint GetLogicalPosition(const wxDC& dc) const;
23324ae1 1356
42013f4c
FM
1357 /**
1358 Get wheel delta, normally 120.
7c913512 1359
42013f4c
FM
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;
7c913512 1364
42013f4c
FM
1365 /**
1366 Get wheel rotation, positive or negative indicates direction of rotation.
7c913512 1367
42013f4c
FM
1368 Current devices all send an event when rotation is at least +/-WheelDelta, but
1369 finer resolution devices can be created in the future.
7c913512 1370
42013f4c
FM
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.
23324ae1 1374 */
42013f4c 1375 int GetWheelRotation() const;
23324ae1 1376
ec6278a1 1377 /**
41469c9e
VZ
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.
ec6278a1 1384
41469c9e 1385 Notice that before wxWidgets 2.9.4 this method returned @c int.
ec6278a1 1386 */
41469c9e 1387 wxMouseWheelAxis GetWheelAxis() const;
ec6278a1 1388
23324ae1 1389 /**
42013f4c
FM
1390 Returns @true if the event was a mouse button event (not necessarily a button
1391 down event - that may be tested using ButtonDown()).
23324ae1 1392 */
42013f4c 1393 bool IsButton() const;
23324ae1
FM
1394
1395 /**
42013f4c
FM
1396 Returns @true if the system has been setup to do page scrolling with
1397 the mouse wheel instead of line scrolling.
23324ae1 1398 */
42013f4c 1399 bool IsPageScroll() const;
7c913512 1400
42013f4c
FM
1401 /**
1402 Returns @true if the mouse was leaving the window.
7c913512 1403
42013f4c
FM
1404 @see Entering().
1405 */
1406 bool Leaving() const;
7c913512 1407
23324ae1 1408 /**
42013f4c 1409 Returns @true if the event was a left double click.
23324ae1 1410 */
42013f4c 1411 bool LeftDClick() const;
23324ae1
FM
1412
1413 /**
42013f4c 1414 Returns @true if the left mouse button changed to down.
23324ae1 1415 */
42013f4c 1416 bool LeftDown() const;
7c913512 1417
42013f4c
FM
1418 /**
1419 Returns @true if the left mouse button changed to up.
1420 */
1421 bool LeftUp() const;
7c913512 1422
23324ae1 1423 /**
42013f4c
FM
1424 Returns @true if the Meta key was down at the time of the event.
1425 */
1426 bool MetaDown() const;
3c4f71cc 1427
42013f4c
FM
1428 /**
1429 Returns @true if the event was a middle double click.
23324ae1 1430 */
42013f4c 1431 bool MiddleDClick() const;
23324ae1
FM
1432
1433 /**
42013f4c 1434 Returns @true if the middle mouse button changed to down.
23324ae1 1435 */
42013f4c 1436 bool MiddleDown() const;
23324ae1 1437
42013f4c
FM
1438 /**
1439 Returns @true if the middle mouse button changed to up.
1440 */
1441 bool MiddleUp() const;
e54c96f1 1442
42013f4c
FM
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;
7c913512 1449
42013f4c
FM
1450 /**
1451 Returns @true if the event was a right double click.
1452 */
1453 bool RightDClick() const;
7c913512 1454
42013f4c
FM
1455 /**
1456 Returns @true if the right mouse button changed to down.
1457 */
1458 bool RightDown() const;
7c913512 1459
42013f4c
FM
1460 /**
1461 Returns @true if the right mouse button changed to up.
1462 */
1463 bool RightUp() const;
23324ae1
FM
1464};
1465
1466
e54c96f1 1467
23324ae1 1468/**
42013f4c 1469 @class wxDropFilesEvent
7c913512 1470
42013f4c
FM
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.
7c913512 1473
42013f4c
FM
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}
8c6791e4 1482 @event{EVT_DROP_FILES(func)}
3051a44a 1483 Process a @c wxEVT_DROP_FILES event.
42013f4c
FM
1484 @endEventTable
1485
1486 @onlyfor{wxmsw}
7c913512 1487
23324ae1
FM
1488 @library{wxcore}
1489 @category{events}
7c913512 1490
3e083d65 1491 @see @ref overview_events
23324ae1 1492*/
42013f4c 1493class wxDropFilesEvent : public wxEvent
23324ae1
FM
1494{
1495public:
1496 /**
42013f4c 1497 Constructor.
23324ae1 1498 */
42013f4c
FM
1499 wxDropFilesEvent(wxEventType id = 0, int noFiles = 0,
1500 wxString* files = NULL);
23324ae1
FM
1501
1502 /**
42013f4c 1503 Returns an array of filenames.
23324ae1 1504 */
42013f4c 1505 wxString* GetFiles() const;
23324ae1
FM
1506
1507 /**
42013f4c 1508 Returns the number of files dropped.
23324ae1 1509 */
42013f4c 1510 int GetNumberOfFiles() const;
23324ae1
FM
1511
1512 /**
42013f4c
FM
1513 Returns the position at which the files were dropped.
1514 Returns an array of filenames.
23324ae1 1515 */
42013f4c 1516 wxPoint GetPosition() const;
23324ae1
FM
1517};
1518
1519
e54c96f1 1520
23324ae1 1521/**
42013f4c 1522 @class wxCommandEvent
7c913512 1523
42013f4c
FM
1524 This event class contains information about command events, which originate
1525 from a variety of simple controls.
1526
3a567740
FM
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
42013f4c
FM
1532 More complex controls, such as wxTreeCtrl, have separate command event classes.
1533
1534 @beginEventTable{wxCommandEvent}
8c6791e4 1535 @event{EVT_COMMAND(id, event, func)}
42013f4c
FM
1536 Process a command, supplying the window identifier, command event identifier,
1537 and member function.
8c6791e4 1538 @event{EVT_COMMAND_RANGE(id1, id2, event, func)}
42013f4c
FM
1539 Process a command for a range of window identifiers, supplying the minimum and
1540 maximum window identifiers, command event identifier, and member function.
8c6791e4 1541 @event{EVT_BUTTON(id, func)}
b476cde6 1542 Process a @c wxEVT_COMMAND_BUTTON_CLICKED command, which is generated by a wxButton control.
8c6791e4 1543 @event{EVT_CHECKBOX(id, func)}
b476cde6 1544 Process a @c wxEVT_COMMAND_CHECKBOX_CLICKED command, which is generated by a wxCheckBox control.
8c6791e4 1545 @event{EVT_CHOICE(id, func)}
b476cde6 1546 Process a @c wxEVT_COMMAND_CHOICE_SELECTED command, which is generated by a wxChoice control.
8c6791e4 1547 @event{EVT_COMBOBOX(id, func)}
b476cde6 1548 Process a @c wxEVT_COMMAND_COMBOBOX_SELECTED command, which is generated by a wxComboBox control.
8c6791e4 1549 @event{EVT_LISTBOX(id, func)}
b476cde6 1550 Process a @c wxEVT_COMMAND_LISTBOX_SELECTED command, which is generated by a wxListBox control.
8c6791e4 1551 @event{EVT_LISTBOX_DCLICK(id, func)}
b476cde6 1552 Process a @c wxEVT_COMMAND_LISTBOX_DOUBLECLICKED command, which is generated by a wxListBox control.
51fbe4cc
RR
1553 @event{EVT_CHECKLISTBOX(id, func)}
1554 Process a @c wxEVT_COMMAND_CHECKLISTBOX_TOGGLED command, which is generated by a wxCheckListBox control.
8c6791e4 1555 @event{EVT_MENU(id, func)}
b476cde6 1556 Process a @c wxEVT_COMMAND_MENU_SELECTED command, which is generated by a menu item.
8c6791e4 1557 @event{EVT_MENU_RANGE(id1, id2, func)}
b476cde6 1558 Process a @c wxEVT_COMMAND_MENU_RANGE command, which is generated by a range of menu items.
8c6791e4 1559 @event{EVT_CONTEXT_MENU(func)}
42013f4c
FM
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.
8c6791e4 1562 @event{EVT_RADIOBOX(id, func)}
b476cde6 1563 Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED command, which is generated by a wxRadioBox control.
8c6791e4 1564 @event{EVT_RADIOBUTTON(id, func)}
b476cde6 1565 Process a @c wxEVT_COMMAND_RADIOBUTTON_SELECTED command, which is generated by a wxRadioButton control.
8c6791e4 1566 @event{EVT_SCROLLBAR(id, func)}
b476cde6 1567 Process a @c wxEVT_COMMAND_SCROLLBAR_UPDATED command, which is generated by a wxScrollBar
42013f4c
FM
1568 control. This is provided for compatibility only; more specific scrollbar event macros
1569 should be used instead (see wxScrollEvent).
8c6791e4 1570 @event{EVT_SLIDER(id, func)}
b476cde6 1571 Process a @c wxEVT_COMMAND_SLIDER_UPDATED command, which is generated by a wxSlider control.
8c6791e4 1572 @event{EVT_TEXT(id, func)}
b476cde6 1573 Process a @c wxEVT_COMMAND_TEXT_UPDATED command, which is generated by a wxTextCtrl control.
8c6791e4 1574 @event{EVT_TEXT_ENTER(id, func)}
b476cde6 1575 Process a @c wxEVT_COMMAND_TEXT_ENTER command, which is generated by a wxTextCtrl control.
42013f4c
FM
1576 Note that you must use wxTE_PROCESS_ENTER flag when creating the control if you want it
1577 to generate such events.
8c6791e4 1578 @event{EVT_TEXT_MAXLEN(id, func)}
b476cde6 1579 Process a @c wxEVT_COMMAND_TEXT_MAXLEN command, which is generated by a wxTextCtrl control
42013f4c
FM
1580 when the user tries to enter more characters into it than the limit previously set
1581 with SetMaxLength().
8c6791e4 1582 @event{EVT_TOGGLEBUTTON(id, func)}
b476cde6 1583 Process a @c wxEVT_COMMAND_TOGGLEBUTTON_CLICKED event.
8c6791e4 1584 @event{EVT_TOOL(id, func)}
b476cde6 1585 Process a @c wxEVT_COMMAND_TOOL_CLICKED event (a synonym for @c wxEVT_COMMAND_MENU_SELECTED).
42013f4c 1586 Pass the id of the tool.
8c6791e4 1587 @event{EVT_TOOL_RANGE(id1, id2, func)}
b476cde6 1588 Process a @c wxEVT_COMMAND_TOOL_CLICKED event for a range of identifiers. Pass the ids of the tools.
8c6791e4 1589 @event{EVT_TOOL_RCLICKED(id, func)}
e431dd05 1590 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event. Pass the id of the tool. (Not available on wxOSX.)
8c6791e4 1591 @event{EVT_TOOL_RCLICKED_RANGE(id1, id2, func)}
e431dd05 1592 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event for a range of ids. Pass the ids of the tools. (Not available on wxOSX.)
8c6791e4 1593 @event{EVT_TOOL_ENTER(id, func)}
b476cde6 1594 Process a @c wxEVT_COMMAND_TOOL_ENTER event. Pass the id of the toolbar itself.
42013f4c 1595 The value of wxCommandEvent::GetSelection() is the tool id, or -1 if the mouse cursor
e431dd05 1596 has moved off a tool. (Not available on wxOSX.)
8c6791e4 1597 @event{EVT_COMMAND_LEFT_CLICK(id, func)}
b476cde6 1598 Process a @c wxEVT_COMMAND_LEFT_CLICK command, which is generated by a control (wxMSW only).
8c6791e4 1599 @event{EVT_COMMAND_LEFT_DCLICK(id, func)}
b476cde6 1600 Process a @c wxEVT_COMMAND_LEFT_DCLICK command, which is generated by a control (wxMSW only).
8c6791e4 1601 @event{EVT_COMMAND_RIGHT_CLICK(id, func)}
b476cde6 1602 Process a @c wxEVT_COMMAND_RIGHT_CLICK command, which is generated by a control (wxMSW only).
8c6791e4 1603 @event{EVT_COMMAND_SET_FOCUS(id, func)}
b476cde6 1604 Process a @c wxEVT_COMMAND_SET_FOCUS command, which is generated by a control (wxMSW only).
8c6791e4 1605 @event{EVT_COMMAND_KILL_FOCUS(id, func)}
b476cde6 1606 Process a @c wxEVT_COMMAND_KILL_FOCUS command, which is generated by a control (wxMSW only).
8c6791e4 1607 @event{EVT_COMMAND_ENTER(id, func)}
b476cde6 1608 Process a @c wxEVT_COMMAND_ENTER command, which is generated by a control.
42013f4c 1609 @endEventTable
7c913512 1610
23324ae1 1611 @library{wxcore}
1f1d2182 1612 @category{events}
23324ae1 1613*/
42013f4c 1614class wxCommandEvent : public wxEvent
23324ae1
FM
1615{
1616public:
1617 /**
1618 Constructor.
1619 */
408776d0 1620 wxCommandEvent(wxEventType commandEventType = wxEVT_NULL, int id = 0);
23324ae1
FM
1621
1622 /**
42013f4c
FM
1623 Returns client data pointer for a listbox or choice selection event
1624 (not valid for a deselection).
1625 */
1626 void* GetClientData() const;
3c4f71cc 1627
42013f4c
FM
1628 /**
1629 Returns client object pointer for a listbox or choice selection event
1630 (not valid for a deselection).
1631 */
1632 wxClientData* GetClientObject() const;
3c4f71cc 1633
42013f4c 1634 /**
8cddee2d 1635 Returns extra information dependent on the event objects type.
3c4f71cc 1636
42013f4c
FM
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;
3c4f71cc 1644
42013f4c
FM
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.
e23e368b
VZ
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.
42013f4c
FM
1653 */
1654 int GetInt() const;
3c4f71cc 1655
42013f4c
FM
1656 /**
1657 Returns item index for a listbox or choice selection event (not valid for
1658 a deselection).
23324ae1 1659 */
42013f4c 1660 int GetSelection() const;
23324ae1
FM
1661
1662 /**
85339748
RR
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.
23324ae1 1667 */
42013f4c 1668 wxString GetString() const;
23324ae1
FM
1669
1670 /**
42013f4c
FM
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).
3c4f71cc 1675
57ab6f23 1676 Notice that this method cannot be used with wxCheckListBox currently.
23324ae1 1677 */
42013f4c 1678 bool IsChecked() const;
23324ae1
FM
1679
1680 /**
85339748
RR
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.
23324ae1 1684 */
42013f4c 1685 bool IsSelection() const;
e54c96f1 1686
42013f4c
FM
1687 /**
1688 Sets the client data for this event.
1689 */
1690 void SetClientData(void* clientData);
7c913512 1691
42013f4c
FM
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.
7c913512 1695
42013f4c
FM
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);
7c913512 1700
23324ae1 1701 /**
42013f4c 1702 Sets the @b m_extraLong member.
23324ae1 1703 */
42013f4c 1704 void SetExtraLong(long extraLong);
23324ae1
FM
1705
1706 /**
42013f4c 1707 Sets the @b m_commandInt member.
23324ae1 1708 */
42013f4c 1709 void SetInt(int intCommand);
23324ae1
FM
1710
1711 /**
42013f4c 1712 Sets the @b m_commandString member.
23324ae1 1713 */
42013f4c 1714 void SetString(const wxString& string);
23324ae1
FM
1715};
1716
1717
e54c96f1 1718
23324ae1 1719/**
42013f4c 1720 @class wxActivateEvent
7c913512 1721
42013f4c
FM
1722 An activate event is sent when a window or application is being activated
1723 or deactivated.
7c913512 1724
42013f4c 1725 @beginEventTable{wxActivateEvent}
8c6791e4 1726 @event{EVT_ACTIVATE(func)}
3051a44a 1727 Process a @c wxEVT_ACTIVATE event.
8c6791e4 1728 @event{EVT_ACTIVATE_APP(func)}
3051a44a
FM
1729 Process a @c wxEVT_ACTIVATE_APP event.
1730 This event is received by the wxApp-derived instance only.
8c6791e4 1731 @event{EVT_HIBERNATE(func)}
42013f4c
FM
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
3a194bda 1736 a @c wxEVT_ACTIVATE or @c wxEVT_ACTIVATE_APP event.
42013f4c
FM
1737 @endEventTable
1738
42013f4c 1739 @library{wxcore}
23324ae1 1740 @category{events}
7c913512 1741
3e083d65 1742 @see @ref overview_events, wxApp::IsActive
23324ae1 1743*/
42013f4c 1744class wxActivateEvent : public wxEvent
23324ae1
FM
1745{
1746public:
1747 /**
1748 Constructor.
1749 */
42013f4c
FM
1750 wxActivateEvent(wxEventType eventType = wxEVT_NULL, bool active = true,
1751 int id = 0);
23324ae1
FM
1752
1753 /**
42013f4c 1754 Returns @true if the application or window is being activated, @false otherwise.
23324ae1 1755 */
42013f4c 1756 bool GetActive() const;
23324ae1
FM
1757};
1758
1759
e54c96f1 1760
23324ae1 1761/**
42013f4c 1762 @class wxContextMenuEvent
7c913512 1763
42013f4c 1764 This class is used for context menu events, sent to give
3051a44a 1765 the application a chance to show a context (popup) menu for a wxWindow.
42013f4c
FM
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
2abce4af
VZ
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.
42013f4c
FM
1780
1781 @beginEventTable{wxContextMenuEvent}
8c6791e4 1782 @event{EVT_CONTEXT_MENU(func)}
42013f4c
FM
1783 A right click (or other context menu command depending on platform) has been detected.
1784 @endEventTable
1785
7c913512 1786
23324ae1
FM
1787 @library{wxcore}
1788 @category{events}
7c913512 1789
3e083d65 1790 @see wxCommandEvent, @ref overview_events
23324ae1 1791*/
42013f4c 1792class wxContextMenuEvent : public wxCommandEvent
23324ae1
FM
1793{
1794public:
1795 /**
1796 Constructor.
1797 */
a90e69f7 1798 wxContextMenuEvent(wxEventType type = wxEVT_NULL, int id = 0,
42013f4c
FM
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);
23324ae1
FM
1817};
1818
1819
e54c96f1 1820
23324ae1 1821/**
42013f4c 1822 @class wxEraseEvent
7c913512 1823
42013f4c 1824 An erase event is sent when a window's background needs to be repainted.
7c913512 1825
42013f4c
FM
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
5fafec4d
VZ
1834 You must use the device context returned by GetDC() to draw on, don't create
1835 a wxPaintDC in the event handler.
7c913512 1836
42013f4c 1837 @beginEventTable{wxEraseEvent}
8c6791e4 1838 @event{EVT_ERASE_BACKGROUND(func)}
3051a44a 1839 Process a @c wxEVT_ERASE_BACKGROUND event.
42013f4c 1840 @endEventTable
7c913512 1841
23324ae1
FM
1842 @library{wxcore}
1843 @category{events}
7c913512 1844
3e083d65 1845 @see @ref overview_events
23324ae1 1846*/
42013f4c 1847class wxEraseEvent : public wxEvent
23324ae1
FM
1848{
1849public:
1850 /**
1851 Constructor.
1852 */
42013f4c
FM
1853 wxEraseEvent(int id = 0, wxDC* dc = NULL);
1854
1855 /**
1856 Returns the device context associated with the erase event to draw on.
5fafec4d
VZ
1857
1858 The returned pointer is never @NULL.
42013f4c
FM
1859 */
1860 wxDC* GetDC() const;
23324ae1
FM
1861};
1862
1863
e54c96f1 1864
23324ae1 1865/**
42013f4c 1866 @class wxFocusEvent
7c913512 1867
42013f4c
FM
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.
7c913512 1870
42013f4c
FM
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
9a25f336
VZ
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
42013f4c 1883 @beginEventTable{wxFocusEvent}
8c6791e4 1884 @event{EVT_SET_FOCUS(func)}
3051a44a 1885 Process a @c wxEVT_SET_FOCUS event.
8c6791e4 1886 @event{EVT_KILL_FOCUS(func)}
3051a44a 1887 Process a @c wxEVT_KILL_FOCUS event.
42013f4c 1888 @endEventTable
7c913512 1889
23324ae1
FM
1890 @library{wxcore}
1891 @category{events}
7c913512 1892
3e083d65 1893 @see @ref overview_events
23324ae1 1894*/
42013f4c 1895class wxFocusEvent : public wxEvent
23324ae1
FM
1896{
1897public:
23324ae1
FM
1898 /**
1899 Constructor.
1900 */
42013f4c 1901 wxFocusEvent(wxEventType eventType = wxEVT_NULL, int id = 0);
23324ae1
FM
1902
1903 /**
42013f4c
FM
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.
23324ae1 1907
42013f4c 1908 Warning: the window pointer may be @NULL!
23324ae1 1909 */
42013f4c 1910 wxWindow *GetWindow() const;
a90e69f7
RD
1911
1912 void SetWindow(wxWindow *win);
42013f4c 1913};
23324ae1 1914
23324ae1 1915
23324ae1 1916
42013f4c
FM
1917/**
1918 @class wxChildFocusEvent
23324ae1 1919
42013f4c
FM
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.
23324ae1 1923
42013f4c 1924 Notice that child window is the direct child of the window receiving event.
57ab6f23 1925 Use wxWindow::FindFocus() to retrieve the window which is actually getting focus.
42013f4c
FM
1926
1927 @beginEventTable{wxChildFocusEvent}
8c6791e4 1928 @event{EVT_CHILD_FOCUS(func)}
3051a44a 1929 Process a @c wxEVT_CHILD_FOCUS event.
42013f4c
FM
1930 @endEventTable
1931
1932 @library{wxcore}
1933 @category{events}
23324ae1 1934
3e083d65 1935 @see @ref overview_events
42013f4c
FM
1936*/
1937class wxChildFocusEvent : public wxCommandEvent
1938{
1939public:
23324ae1 1940 /**
42013f4c
FM
1941 Constructor.
1942
1943 @param win
1944 The direct child which is (or which contains the window which is) receiving
1945 the focus.
23324ae1 1946 */
42013f4c 1947 wxChildFocusEvent(wxWindow* win = NULL);
23324ae1
FM
1948
1949 /**
42013f4c
FM
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.
23324ae1 1954 */
42013f4c 1955 wxWindow *GetWindow() const;
23324ae1
FM
1956};
1957
1958
e54c96f1 1959
23324ae1 1960/**
42013f4c 1961 @class wxMouseCaptureLostEvent
7c913512 1962
0af4bd16
VZ
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).
42013f4c 1966
0af4bd16 1967 If this happens, this event is sent to all windows that are on the capture stack
42013f4c
FM
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}
8c6791e4 1975 @event{EVT_MOUSE_CAPTURE_LOST(func)}
3051a44a 1976 Process a @c wxEVT_MOUSE_CAPTURE_LOST event.
42013f4c 1977 @endEventTable
7c913512 1978
42013f4c 1979 @onlyfor{wxmsw}
7c913512 1980
23324ae1
FM
1981 @library{wxcore}
1982 @category{events}
7c913512 1983
3e083d65 1984 @see wxMouseCaptureChangedEvent, @ref overview_events,
3051a44a 1985 wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
23324ae1 1986*/
42013f4c 1987class wxMouseCaptureLostEvent : public wxEvent
23324ae1
FM
1988{
1989public:
1990 /**
1991 Constructor.
1992 */
42013f4c 1993 wxMouseCaptureLostEvent(wxWindowID windowId = 0);
23324ae1
FM
1994};
1995
1996
e54c96f1 1997
a90e69f7
RD
1998class wxDisplayChangedEvent : public wxEvent
1999{
2000public:
2001 wxDisplayChangedEvent();
2002};
2003
2004
2005class wxPaletteChangedEvent : public wxEvent
2006{
2007public:
2008 wxPaletteChangedEvent(wxWindowID winid = 0);
2009
2010 void SetChangedWindow(wxWindow* win);
2011 wxWindow* GetChangedWindow() const;
2012};
2013
2014
2015class wxQueryNewPaletteEvent : public wxEvent
2016{
2017public:
2018 wxQueryNewPaletteEvent(wxWindowID winid = 0);
2019
2020 void SetPaletteRealized(bool realized);
2021 bool GetPaletteRealized();
2022};
2023
2024
2025
2026
23324ae1 2027/**
42013f4c 2028 @class wxNotifyEvent
7c913512 2029
42013f4c 2030 This class is not used by the event handlers by itself, but is a base class
3e97a905 2031 for other event classes (such as wxBookCtrlEvent).
7c913512 2032
42013f4c
FM
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.
7c913512 2036
23324ae1
FM
2037 @library{wxcore}
2038 @category{events}
7c913512 2039
3e97a905 2040 @see wxBookCtrlEvent
23324ae1 2041*/
42013f4c 2042class wxNotifyEvent : public wxCommandEvent
23324ae1
FM
2043{
2044public:
2045 /**
42013f4c 2046 Constructor (used internally by wxWidgets only).
23324ae1 2047 */
42013f4c 2048 wxNotifyEvent(wxEventType eventType = wxEVT_NULL, int id = 0);
23324ae1
FM
2049
2050 /**
42013f4c
FM
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).
23324ae1 2055 */
42013f4c 2056 void Allow();
23324ae1
FM
2057
2058 /**
42013f4c
FM
2059 Returns @true if the change is allowed (Veto() hasn't been called) or @false
2060 otherwise (if it was).
23324ae1 2061 */
42013f4c 2062 bool IsAllowed() const;
23324ae1
FM
2063
2064 /**
42013f4c 2065 Prevents the change announced by this event from happening.
23324ae1 2066
42013f4c
FM
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.
23324ae1 2070 */
42013f4c
FM
2071 void Veto();
2072};
2073
23324ae1 2074
d48b06bd
FM
2075/**
2076 @class wxThreadEvent
23324ae1 2077
5d4a0504
VZ
2078 This class adds some simple functionality to wxEvent to facilitate
2079 inter-thread communication.
23324ae1 2080
5d4a0504
VZ
2081 This event is not natively emitted by any control/class: it is just
2082 a helper class for the user.
3a567740 2083 Its most important feature is the GetEventCategory() implementation which
5d4a0504 2084 allows thread events @b NOT to be processed by wxEventLoopBase::YieldFor calls
3a567740
FM
2085 (unless the @c wxEVT_CATEGORY_THREAD is specified - which is never in wx code).
2086
d48b06bd 2087 @library{wxcore}
3c99e2fd 2088 @category{events,threading}
d48b06bd 2089
dde19c21 2090 @see @ref overview_thread, wxEventLoopBase::YieldFor
c1b293bb
VS
2091
2092 @since 2.9.0
d48b06bd 2093*/
c1b293bb 2094class wxThreadEvent : public wxEvent
42013f4c 2095{
d48b06bd
FM
2096public:
2097 /**
2098 Constructor.
d48b06bd 2099 */
c1b293bb 2100 wxThreadEvent(wxEventType eventType = wxEVT_THREAD, int id = wxID_ANY);
23324ae1 2101
d48b06bd
FM
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
74d60f66 2112 This is important to avoid unwanted processing of thread events
dde19c21 2113 when calling wxEventLoopBase::YieldFor().
d48b06bd
FM
2114 */
2115 virtual wxEventCategory GetEventCategory() const;
dae60aee
VS
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;
c1b293bb
VS
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);
42013f4c 2178};
e54c96f1 2179
d48b06bd 2180
23324ae1 2181/**
42013f4c 2182 @class wxHelpEvent
7c913512 2183
42013f4c
FM
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.
7c913512 2188
42013f4c
FM
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}
8c6791e4 2203 @event{EVT_HELP(id, func)}
3051a44a 2204 Process a @c wxEVT_HELP event.
8c6791e4 2205 @event{EVT_HELP_RANGE(id1, id2, func)}
3051a44a 2206 Process a @c wxEVT_HELP event for a range of ids.
42013f4c 2207 @endEventTable
7c913512 2208
23324ae1
FM
2209 @library{wxcore}
2210 @category{events}
7c913512 2211
3e083d65 2212 @see wxContextHelp, wxDialog, @ref overview_events
23324ae1 2213*/
42013f4c 2214class wxHelpEvent : public wxCommandEvent
23324ae1
FM
2215{
2216public:
a44f3b5a
FM
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
23324ae1
FM
2230 /**
2231 Constructor.
2232 */
42013f4c
FM
2233 wxHelpEvent(wxEventType type = wxEVT_NULL,
2234 wxWindowID winid = 0,
2235 const wxPoint& pt = wxDefaultPosition,
a44f3b5a 2236 wxHelpEvent::Origin origin = Origin_Unknown);
42013f4c
FM
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 */
43c48e1e 2247 wxHelpEvent::Origin GetOrigin() const;
23324ae1
FM
2248
2249 /**
42013f4c
FM
2250 Returns the left-click position of the mouse, in screen coordinates.
2251 This allows the application to position the help appropriately.
23324ae1 2252 */
42013f4c 2253 const wxPoint& GetPosition() const;
23324ae1
FM
2254
2255 /**
42013f4c
FM
2256 Set the help event origin, only used internally by wxWidgets normally.
2257
2258 @see GetOrigin()
23324ae1 2259 */
43c48e1e 2260 void SetOrigin(wxHelpEvent::Origin origin);
23324ae1
FM
2261
2262 /**
42013f4c 2263 Sets the left-click position of the mouse, in screen coordinates.
23324ae1 2264 */
42013f4c 2265 void SetPosition(const wxPoint& pt);
23324ae1
FM
2266};
2267
2268
e54c96f1 2269
23324ae1 2270/**
42013f4c 2271 @class wxScrollEvent
7c913512 2272
42013f4c
FM
2273 A scroll event holds information about events sent from stand-alone
2274 scrollbars (see wxScrollBar) and sliders (see wxSlider).
7c913512 2275
42013f4c
FM
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.
7c913512 2280
3a74a290 2281 @section scrollevent_diff The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED
7c913512 2282
42013f4c
FM
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).
7c913512 2286
42013f4c
FM
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).
7c913512 2290
42013f4c
FM
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.
8c6791e4 2305 @event{EVT_SCROLL(func)}
42013f4c 2306 Process all scroll events.
8c6791e4 2307 @event{EVT_SCROLL_TOP(func)}
3a194bda 2308 Process @c wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
8c6791e4 2309 @event{EVT_SCROLL_BOTTOM(func)}
3a194bda 2310 Process @c wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
8c6791e4 2311 @event{EVT_SCROLL_LINEUP(func)}
3a194bda 2312 Process @c wxEVT_SCROLL_LINEUP line up events.
8c6791e4 2313 @event{EVT_SCROLL_LINEDOWN(func)}
3a194bda 2314 Process @c wxEVT_SCROLL_LINEDOWN line down events.
8c6791e4 2315 @event{EVT_SCROLL_PAGEUP(func)}
3a194bda 2316 Process @c wxEVT_SCROLL_PAGEUP page up events.
8c6791e4 2317 @event{EVT_SCROLL_PAGEDOWN(func)}
3a194bda 2318 Process @c wxEVT_SCROLL_PAGEDOWN page down events.
8c6791e4 2319 @event{EVT_SCROLL_THUMBTRACK(func)}
3a194bda 2320 Process @c wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent as the
42013f4c 2321 user drags the thumbtrack).
8c6791e4 2322 @event{EVT_SCROLL_THUMBRELEASE(func)}
3a194bda 2323 Process @c wxEVT_SCROLL_THUMBRELEASE thumb release events.
8c6791e4 2324 @event{EVT_SCROLL_CHANGED(func)}
3a194bda 2325 Process @c wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).
8c6791e4 2326 @event{EVT_COMMAND_SCROLL(id, func)}
42013f4c 2327 Process all scroll events.
8c6791e4 2328 @event{EVT_COMMAND_SCROLL_TOP(id, func)}
3a194bda 2329 Process @c wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
8c6791e4 2330 @event{EVT_COMMAND_SCROLL_BOTTOM(id, func)}
3a194bda 2331 Process @c wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
8c6791e4 2332 @event{EVT_COMMAND_SCROLL_LINEUP(id, func)}
3a194bda 2333 Process @c wxEVT_SCROLL_LINEUP line up events.
8c6791e4 2334 @event{EVT_COMMAND_SCROLL_LINEDOWN(id, func)}
3a194bda 2335 Process @c wxEVT_SCROLL_LINEDOWN line down events.
8c6791e4 2336 @event{EVT_COMMAND_SCROLL_PAGEUP(id, func)}
3a194bda 2337 Process @c wxEVT_SCROLL_PAGEUP page up events.
8c6791e4 2338 @event{EVT_COMMAND_SCROLL_PAGEDOWN(id, func)}
3a194bda 2339 Process @c wxEVT_SCROLL_PAGEDOWN page down events.
8c6791e4 2340 @event{EVT_COMMAND_SCROLL_THUMBTRACK(id, func)}
3a194bda 2341 Process @c wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent
42013f4c 2342 as the user drags the thumbtrack).
8c6791e4 2343 @event{EVT_COMMAND_SCROLL_THUMBRELEASE(func)}
3a194bda 2344 Process @c wxEVT_SCROLL_THUMBRELEASE thumb release events.
8c6791e4 2345 @event{EVT_COMMAND_SCROLL_CHANGED(func)}
3a194bda 2346 Process @c wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).
42013f4c 2347 @endEventTable
7c913512 2348
23324ae1 2349 @library{wxcore}
1f1d2182 2350 @category{events}
7c913512 2351
3e083d65 2352 @see wxScrollBar, wxSlider, wxSpinButton, wxScrollWinEvent, @ref overview_events
23324ae1 2353*/
42013f4c 2354class wxScrollEvent : public wxCommandEvent
23324ae1
FM
2355{
2356public:
2357 /**
42013f4c 2358 Constructor.
23324ae1 2359 */
42013f4c
FM
2360 wxScrollEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int pos = 0,
2361 int orientation = 0);
23324ae1
FM
2362
2363 /**
42013f4c
FM
2364 Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the
2365 scrollbar.
23324ae1 2366 */
42013f4c 2367 int GetOrientation() const;
23324ae1
FM
2368
2369 /**
42013f4c 2370 Returns the position of the scrollbar.
23324ae1 2371 */
42013f4c 2372 int GetPosition() const;
a90e69f7
RD
2373
2374
2375 void SetOrientation(int orient);
2376 void SetPosition(int pos);
23324ae1
FM
2377};
2378
23324ae1 2379
3c4f71cc 2380
23324ae1 2381
42013f4c
FM
2382/**
2383 @class wxInitDialogEvent
3c4f71cc 2384
42013f4c
FM
2385 A wxInitDialogEvent is sent as a dialog or panel is being initialised.
2386 Handlers for this event can transfer data to the window.
23324ae1 2387
42013f4c 2388 The default handler calls wxWindow::TransferDataToWindow.
3c4f71cc 2389
42013f4c 2390 @beginEventTable{wxInitDialogEvent}
8c6791e4 2391 @event{EVT_INIT_DIALOG(func)}
3051a44a 2392 Process a @c wxEVT_INIT_DIALOG event.
42013f4c
FM
2393 @endEventTable
2394
2395 @library{wxcore}
2396 @category{events}
23324ae1 2397
3e083d65 2398 @see @ref overview_events
42013f4c
FM
2399*/
2400class wxInitDialogEvent : public wxEvent
2401{
2402public:
23324ae1 2403 /**
42013f4c
FM
2404 Constructor.
2405 */
2406 wxInitDialogEvent(int id = 0);
2407};
3c4f71cc 2408
3c4f71cc 2409
3c4f71cc 2410
42013f4c
FM
2411/**
2412 @class wxWindowDestroyEvent
3c4f71cc 2413
a79a6671
VZ
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.
23324ae1 2422
a79a6671
VZ
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).
3c4f71cc 2427
a79a6671
VZ
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.
3c4f71cc 2431
42013f4c
FM
2432 @library{wxcore}
2433 @category{events}
3c4f71cc 2434
3e083d65 2435 @see @ref overview_events, wxWindowCreateEvent
42013f4c
FM
2436*/
2437class wxWindowDestroyEvent : public wxCommandEvent
2438{
2439public:
2440 /**
2441 Constructor.
23324ae1 2442 */
42013f4c 2443 wxWindowDestroyEvent(wxWindow* win = NULL);
a79a6671 2444
57ab6f23 2445 /// Return the window being destroyed.
a79a6671 2446 wxWindow *GetWindow() const;
42013f4c 2447};
23324ae1 2448
3c4f71cc 2449
42013f4c
FM
2450/**
2451 @class wxNavigationKeyEvent
3c4f71cc 2452
42013f4c
FM
2453 This event class contains information about navigation events,
2454 generated by navigation keys such as tab and page down.
23324ae1 2455
42013f4c
FM
2456 This event is mainly used by wxWidgets implementations.
2457 A wxNavigationKeyEvent handler is automatically provided by wxWidgets
90230407
VZ
2458 when you enable keyboard navigation inside a window by inheriting it from
2459 wxNavigationEnabled<>.
3c4f71cc 2460
42013f4c 2461 @beginEventTable{wxNavigationKeyEvent}
8c6791e4 2462 @event{EVT_NAVIGATION_KEY(func)}
42013f4c
FM
2463 Process a navigation key event.
2464 @endEventTable
3c4f71cc 2465
42013f4c
FM
2466 @library{wxcore}
2467 @category{events}
3c4f71cc 2468
42013f4c
FM
2469 @see wxWindow::Navigate, wxWindow::NavigateIn
2470*/
2471class wxNavigationKeyEvent : public wxEvent
2472{
2473public:
3051a44a
FM
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
42013f4c
FM
2485 wxNavigationKeyEvent();
2486 wxNavigationKeyEvent(const wxNavigationKeyEvent& event);
23324ae1
FM
2487
2488 /**
42013f4c 2489 Returns the child that has the focus, or @NULL.
23324ae1 2490 */
42013f4c 2491 wxWindow* GetCurrentFocus() const;
23324ae1
FM
2492
2493 /**
42013f4c
FM
2494 Returns @true if the navigation was in the forward direction.
2495 */
2496 bool GetDirection() const;
3c4f71cc 2497
42013f4c
FM
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;
3c4f71cc 2503
42013f4c
FM
2504 /**
2505 Returns @true if the navigation event represents a window change
2506 (for example, from Ctrl-Page Down in a notebook).
23324ae1 2507 */
42013f4c 2508 bool IsWindowChange() const;
23324ae1
FM
2509
2510 /**
42013f4c
FM
2511 Sets the current focus window member.
2512 */
2513 void SetCurrentFocus(wxWindow* currentFocus);
3c4f71cc 2514
42013f4c
FM
2515 /**
2516 Sets the direction to forward if @a direction is @true, or backward
2517 if @false.
2518 */
2519 void SetDirection(bool direction);
3c4f71cc 2520
42013f4c
FM
2521 /**
2522 Sets the flags for this event.
2523 The @a flags can be a combination of the ::wxNavigationKeyEventFlags values.
23324ae1 2524 */
42013f4c 2525 void SetFlags(long flags);
23324ae1
FM
2526
2527 /**
42013f4c
FM
2528 Marks the navigation event as from a tab key.
2529 */
2530 void SetFromTab(bool fromTab);
3c4f71cc 2531
42013f4c
FM
2532 /**
2533 Marks the event as a window change event.
23324ae1 2534 */
42013f4c 2535 void SetWindowChange(bool windowChange);
23324ae1
FM
2536};
2537
2538
e54c96f1 2539
23324ae1 2540/**
42013f4c 2541 @class wxMouseCaptureChangedEvent
7c913512 2542
42013f4c 2543 An mouse capture changed event is sent to a window that loses its
3051a44a 2544 mouse capture. This is called even if wxWindow::ReleaseMouse
42013f4c
FM
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.
7c913512 2548
42013f4c
FM
2549 @onlyfor{wxmsw}
2550
2551 @beginEventTable{wxMouseCaptureChangedEvent}
8c6791e4 2552 @event{EVT_MOUSE_CAPTURE_CHANGED(func)}
3051a44a 2553 Process a @c wxEVT_MOUSE_CAPTURE_CHANGED event.
42013f4c 2554 @endEventTable
7c913512 2555
23324ae1
FM
2556 @library{wxcore}
2557 @category{events}
7c913512 2558
3e083d65 2559 @see wxMouseCaptureLostEvent, @ref overview_events,
3051a44a 2560 wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
23324ae1 2561*/
42013f4c 2562class wxMouseCaptureChangedEvent : public wxEvent
23324ae1
FM
2563{
2564public:
2565 /**
2566 Constructor.
2567 */
42013f4c
FM
2568 wxMouseCaptureChangedEvent(wxWindowID windowId = 0,
2569 wxWindow* gainedCapture = NULL);
23324ae1
FM
2570
2571 /**
42013f4c
FM
2572 Returns the window that gained the capture, or @NULL if it was a
2573 non-wxWidgets window.
23324ae1 2574 */
42013f4c 2575 wxWindow* GetCapturedWindow() const;
23324ae1
FM
2576};
2577
2578
e54c96f1 2579
23324ae1 2580/**
42013f4c 2581 @class wxCloseEvent
7c913512 2582
42013f4c
FM
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
195be56d
FM
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
9fb99466
VZ
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
42013f4c 2635 @beginEventTable{wxCloseEvent}
8c6791e4 2636 @event{EVT_CLOSE(func)}
869aa92d 2637 Process a @c wxEVT_CLOSE_WINDOW command event, supplying the member function.
42013f4c 2638 This event applies to wxFrame and wxDialog classes.
8c6791e4 2639 @event{EVT_QUERY_END_SESSION(func)}
869aa92d 2640 Process a @c wxEVT_QUERY_END_SESSION session event, supplying the member function.
9fb99466 2641 This event can be handled in wxApp-derived class only.
8c6791e4 2642 @event{EVT_END_SESSION(func)}
869aa92d 2643 Process a @c wxEVT_END_SESSION session event, supplying the member function.
9fb99466 2644 This event can be handled in wxApp-derived class only.
42013f4c 2645 @endEventTable
7c913512 2646
23324ae1
FM
2647 @library{wxcore}
2648 @category{events}
7c913512 2649
42013f4c 2650 @see wxWindow::Close, @ref overview_windowdeletion
23324ae1 2651*/
42013f4c 2652class wxCloseEvent : public wxEvent
23324ae1
FM
2653{
2654public:
2655 /**
2656 Constructor.
2657 */
42013f4c 2658 wxCloseEvent(wxEventType commandEventType = wxEVT_NULL, int id = 0);
23324ae1
FM
2659
2660 /**
42013f4c
FM
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.
23324ae1 2664 */
42013f4c
FM
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
42013f4c
FM
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);
23324ae1
FM
2691};
2692
2693
e54c96f1 2694
23324ae1 2695/**
42013f4c 2696 @class wxMenuEvent
7c913512 2697
42013f4c
FM
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.
7c913512 2701
b476cde6 2702 The default handler for @c wxEVT_MENU_HIGHLIGHT displays help
42013f4c 2703 text in the first field of the status bar.
7c913512 2704
42013f4c 2705 @beginEventTable{wxMenuEvent}
8c6791e4 2706 @event{EVT_MENU_OPEN(func)}
42013f4c
FM
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).
8c6791e4 2709 @event{EVT_MENU_CLOSE(func)}
42013f4c 2710 A menu has been just closed.
8c6791e4 2711 @event{EVT_MENU_HIGHLIGHT(id, func)}
42013f4c
FM
2712 The menu item with the specified id has been highlighted: used to show
2713 help prompts in the status bar by wxFrame
8c6791e4 2714 @event{EVT_MENU_HIGHLIGHT_ALL(func)}
42013f4c
FM
2715 A menu item has been highlighted, i.e. the currently selected menu item has changed.
2716 @endEventTable
7c913512 2717
42013f4c 2718 @library{wxcore}
23324ae1 2719 @category{events}
7c913512 2720
3e083d65 2721 @see wxCommandEvent, @ref overview_events
23324ae1 2722*/
42013f4c 2723class wxMenuEvent : public wxEvent
23324ae1
FM
2724{
2725public:
2726 /**
42013f4c 2727 Constructor.
23324ae1 2728 */
a90e69f7 2729 wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0, wxMenu* menu = NULL);
23324ae1
FM
2730
2731 /**
7f3f059a
VZ
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.
23324ae1 2738 */
42013f4c 2739 wxMenu* GetMenu() const;
23324ae1
FM
2740
2741 /**
42013f4c
FM
2742 Returns the menu identifier associated with the event.
2743 This method should be only used with the @c HIGHLIGHT events.
23324ae1 2744 */
42013f4c 2745 int GetMenuId() const;
23324ae1
FM
2746
2747 /**
42013f4c
FM
2748 Returns @true if the menu which is being opened or closed is a popup menu,
2749 @false if it is a normal one.
23324ae1 2750
42013f4c 2751 This method should only be used with the @c OPEN and @c CLOSE events.
23324ae1 2752 */
42013f4c
FM
2753 bool IsPopup() const;
2754};
23324ae1 2755
d317fdeb
VZ
2756/**
2757 @class wxShowEvent
d317fdeb
VZ
2758
2759 An event being sent when the window is shown or hidden.
a183ec70
VZ
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.
d317fdeb 2765
d317fdeb
VZ
2766 @onlyfor{wxmsw,wxgtk,wxos2}
2767
2768 @beginEventTable{wxShowEvent}
2769 @event{EVT_SHOW(func)}
3051a44a 2770 Process a @c wxEVT_SHOW event.
d317fdeb
VZ
2771 @endEventTable
2772
2773 @library{wxcore}
2774 @category{events}
2775
3e083d65 2776 @see @ref overview_events, wxWindow::Show,
d317fdeb
VZ
2777 wxWindow::IsShown
2778*/
2779
2780class wxShowEvent : public wxEvent
2781{
2782public:
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
23324ae1 2806
42013f4c
FM
2807/**
2808 @class wxIconizeEvent
23324ae1 2809
42013f4c 2810 An event being sent when the frame is iconized (minimized) or restored.
23324ae1 2811
42013f4c 2812 Currently only wxMSW and wxGTK generate such events.
23324ae1 2813
42013f4c 2814 @onlyfor{wxmsw,wxgtk}
23324ae1 2815
42013f4c 2816 @beginEventTable{wxIconizeEvent}
8c6791e4 2817 @event{EVT_ICONIZE(func)}
3051a44a 2818 Process a @c wxEVT_ICONIZE event.
42013f4c 2819 @endEventTable
23324ae1 2820
42013f4c
FM
2821 @library{wxcore}
2822 @category{events}
23324ae1 2823
3e083d65 2824 @see @ref overview_events, wxTopLevelWindow::Iconize,
42013f4c
FM
2825 wxTopLevelWindow::IsIconized
2826*/
2827class wxIconizeEvent : public wxEvent
2828{
2829public:
23324ae1 2830 /**
42013f4c 2831 Constructor.
23324ae1 2832 */
42013f4c 2833 wxIconizeEvent(int id = 0, bool iconized = true);
23324ae1
FM
2834
2835 /**
42013f4c
FM
2836 Returns @true if the frame has been iconized, @false if it has been
2837 restored.
23324ae1 2838 */
d317fdeb
VZ
2839 bool IsIconized() const;
2840
2841 /**
2842 @deprecated This function is deprecated in favour of IsIconized().
2843 */
42013f4c
FM
2844 bool Iconized() const;
2845};
23324ae1 2846
23324ae1 2847
42013f4c
FM
2848
2849/**
2850 @class wxMoveEvent
42013f4c 2851
3051a44a 2852 A move event holds information about wxTopLevelWindow move change events.
42013f4c 2853
77211166
VZ
2854 These events are currently only generated by wxMSW port.
2855
42013f4c 2856 @beginEventTable{wxMoveEvent}
8c6791e4 2857 @event{EVT_MOVE(func)}
3051a44a 2858 Process a @c wxEVT_MOVE event, which is generated when a window is moved.
8c6791e4 2859 @event{EVT_MOVE_START(func)}
3051a44a 2860 Process a @c wxEVT_MOVE_START event, which is generated when the user starts
42013f4c 2861 to move or size a window. wxMSW only.
37fff49c
VZ
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.
8c6791e4 2865 @event{EVT_MOVE_END(func)}
3051a44a 2866 Process a @c wxEVT_MOVE_END event, which is generated when the user stops
42013f4c
FM
2867 moving or sizing a window. wxMSW only.
2868 @endEventTable
2869
2870 @library{wxcore}
2871 @category{events}
2872
3e083d65 2873 @see wxPoint, @ref overview_events
42013f4c
FM
2874*/
2875class wxMoveEvent : public wxEvent
2876{
2877public:
23324ae1 2878 /**
42013f4c 2879 Constructor.
23324ae1 2880 */
42013f4c 2881 wxMoveEvent(const wxPoint& pt, int id = 0);
23324ae1
FM
2882
2883 /**
42013f4c 2884 Returns the position of the window generating the move change event.
23324ae1 2885 */
42013f4c 2886 wxPoint GetPosition() const;
a90e69f7
RD
2887
2888 wxRect GetRect() const;
2889 void SetRect(const wxRect& rect);
2890 void SetPosition(const wxPoint& pos);
23324ae1
FM
2891};
2892
2893
2894/**
2895 @class wxSizeEvent
7c913512 2896
3051a44a 2897 A size event holds information about size change events of wxWindow.
7c913512 2898
23324ae1 2899 The EVT_SIZE handler function will be called when the window has been resized.
7c913512 2900
42013f4c 2901 You may wish to use this for frames to resize their child windows as appropriate.
7c913512 2902
0ddf0ac6 2903 Note that the size passed is of the whole window: call wxWindow::GetClientSize()
42013f4c 2904 for the area which may be used by the application.
7c913512 2905
23324ae1 2906 When a window is resized, usually only a small part of the window is damaged
42013f4c
FM
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
b0162e32
SC
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
42013f4c 2915 @beginEventTable{wxSizeEvent}
8c6791e4 2916 @event{EVT_SIZE(func)}
3051a44a 2917 Process a @c wxEVT_SIZE event.
42013f4c 2918 @endEventTable
7c913512 2919
23324ae1
FM
2920 @library{wxcore}
2921 @category{events}
7c913512 2922
3e083d65 2923 @see wxSize, @ref overview_events
23324ae1
FM
2924*/
2925class wxSizeEvent : public wxEvent
2926{
2927public:
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.
0ddf0ac6
VZ
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.
23324ae1 2940 */
328f5751 2941 wxSize GetSize() const;
a90e69f7
RD
2942 void SetSize(wxSize size);
2943
2944 wxRect GetRect() const;
2945 void SetRect(wxRect rect);
23324ae1
FM
2946};
2947
2948
e54c96f1 2949
23324ae1
FM
2950/**
2951 @class wxSetCursorEvent
7c913512 2952
3051a44a
FM
2953 A wxSetCursorEvent is generated from wxWindow when the mouse cursor is about
2954 to be set as a result of mouse motion.
42013f4c
FM
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}
8c6791e4 2961 @event{EVT_SET_CURSOR(func)}
3051a44a 2962 Process a @c wxEVT_SET_CURSOR event.
42013f4c 2963 @endEventTable
7c913512 2964
23324ae1 2965 @library{wxcore}
1f1d2182 2966 @category{events}
7c913512 2967
e54c96f1 2968 @see ::wxSetCursor, wxWindow::wxSetCursor
23324ae1
FM
2969*/
2970class wxSetCursorEvent : public wxEvent
2971{
2972public:
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 */
a6052817 2982 const wxCursor& GetCursor() const;
23324ae1
FM
2983
2984 /**
2985 Returns the X coordinate of the mouse in client coordinates.
2986 */
328f5751 2987 wxCoord GetX() const;
23324ae1
FM
2988
2989 /**
2990 Returns the Y coordinate of the mouse in client coordinates.
2991 */
328f5751 2992 wxCoord GetY() const;
23324ae1
FM
2993
2994 /**
2995 Returns @true if the cursor specified by this event is a valid cursor.
3c4f71cc 2996
23324ae1 2997 @remarks You cannot specify wxNullCursor with this event, as it is not
4cc4bfaf 2998 considered a valid cursor.
23324ae1 2999 */
328f5751 3000 bool HasCursor() const;
23324ae1
FM
3001
3002 /**
3003 Sets the cursor associated with this event.
3004 */
3005 void SetCursor(const wxCursor& cursor);
3006};
e54c96f1 3007
39fb8056
FM
3008
3009
7fa7088e
BP
3010// ============================================================================
3011// Global functions/macros
3012// ============================================================================
3013
b21126db 3014/** @addtogroup group_funcmacro_events */
7fa7088e
BP
3015//@{
3016
a90e69f7
RD
3017
3018wxEventType wxEVT_COMMAND_BUTTON_CLICKED;
3019wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED;
3020wxEventType wxEVT_COMMAND_CHOICE_SELECTED;
3021wxEventType wxEVT_COMMAND_LISTBOX_SELECTED;
3022wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED;
3023wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED;
3024wxEventType wxEVT_COMMAND_MENU_SELECTED;
3025wxEventType wxEVT_COMMAND_SLIDER_UPDATED;
3026wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED;
3027wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED;
3028wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED;
3029wxEventType wxEVT_COMMAND_VLBOX_SELECTED;
3030wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED;
3031wxEventType wxEVT_COMMAND_TOOL_RCLICKED;
3032wxEventType wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED;
3033wxEventType wxEVT_COMMAND_TOOL_ENTER;
3034wxEventType wxEVT_COMMAND_COMBOBOX_DROPDOWN;
3035wxEventType wxEVT_COMMAND_COMBOBOX_CLOSEUP;
c1b293bb 3036wxEventType wxEVT_THREAD;
a90e69f7
RD
3037wxEventType wxEVT_LEFT_DOWN;
3038wxEventType wxEVT_LEFT_UP;
3039wxEventType wxEVT_MIDDLE_DOWN;
3040wxEventType wxEVT_MIDDLE_UP;
3041wxEventType wxEVT_RIGHT_DOWN;
3042wxEventType wxEVT_RIGHT_UP;
3043wxEventType wxEVT_MOTION;
3044wxEventType wxEVT_ENTER_WINDOW;
3045wxEventType wxEVT_LEAVE_WINDOW;
3046wxEventType wxEVT_LEFT_DCLICK;
3047wxEventType wxEVT_MIDDLE_DCLICK;
3048wxEventType wxEVT_RIGHT_DCLICK;
3049wxEventType wxEVT_SET_FOCUS;
3050wxEventType wxEVT_KILL_FOCUS;
3051wxEventType wxEVT_CHILD_FOCUS;
3052wxEventType wxEVT_MOUSEWHEEL;
3053wxEventType wxEVT_AUX1_DOWN;
3054wxEventType wxEVT_AUX1_UP;
3055wxEventType wxEVT_AUX1_DCLICK;
3056wxEventType wxEVT_AUX2_DOWN;
3057wxEventType wxEVT_AUX2_UP;
3058wxEventType wxEVT_AUX2_DCLICK;
3059wxEventType wxEVT_CHAR;
3060wxEventType wxEVT_CHAR_HOOK;
3061wxEventType wxEVT_NAVIGATION_KEY;
3062wxEventType wxEVT_KEY_DOWN;
3063wxEventType wxEVT_KEY_UP;
3064wxEventType wxEVT_HOTKEY;
3065wxEventType wxEVT_SET_CURSOR;
3066wxEventType wxEVT_SCROLL_TOP;
3067wxEventType wxEVT_SCROLL_BOTTOM;
3068wxEventType wxEVT_SCROLL_LINEUP;
3069wxEventType wxEVT_SCROLL_LINEDOWN;
3070wxEventType wxEVT_SCROLL_PAGEUP;
3071wxEventType wxEVT_SCROLL_PAGEDOWN;
3072wxEventType wxEVT_SCROLL_THUMBTRACK;
3073wxEventType wxEVT_SCROLL_THUMBRELEASE;
3074wxEventType wxEVT_SCROLL_CHANGED;
3075wxEventType wxEVT_SPIN_UP;
3076wxEventType wxEVT_SPIN_DOWN;
3077wxEventType wxEVT_SPIN;
3078wxEventType wxEVT_SCROLLWIN_TOP;
3079wxEventType wxEVT_SCROLLWIN_BOTTOM;
3080wxEventType wxEVT_SCROLLWIN_LINEUP;
3081wxEventType wxEVT_SCROLLWIN_LINEDOWN;
3082wxEventType wxEVT_SCROLLWIN_PAGEUP;
3083wxEventType wxEVT_SCROLLWIN_PAGEDOWN;
3084wxEventType wxEVT_SCROLLWIN_THUMBTRACK;
3085wxEventType wxEVT_SCROLLWIN_THUMBRELEASE;
3086wxEventType wxEVT_SIZE;
3087wxEventType wxEVT_MOVE;
3088wxEventType wxEVT_CLOSE_WINDOW;
3089wxEventType wxEVT_END_SESSION;
3090wxEventType wxEVT_QUERY_END_SESSION;
3091wxEventType wxEVT_ACTIVATE_APP;
3092wxEventType wxEVT_ACTIVATE;
3093wxEventType wxEVT_CREATE;
3094wxEventType wxEVT_DESTROY;
3095wxEventType wxEVT_SHOW;
3096wxEventType wxEVT_ICONIZE;
3097wxEventType wxEVT_MAXIMIZE;
3098wxEventType wxEVT_MOUSE_CAPTURE_CHANGED;
3099wxEventType wxEVT_MOUSE_CAPTURE_LOST;
3100wxEventType wxEVT_PAINT;
3101wxEventType wxEVT_ERASE_BACKGROUND;
3102wxEventType wxEVT_NC_PAINT;
3103wxEventType wxEVT_MENU_OPEN;
3104wxEventType wxEVT_MENU_CLOSE;
3105wxEventType wxEVT_MENU_HIGHLIGHT;
3106wxEventType wxEVT_CONTEXT_MENU;
3107wxEventType wxEVT_SYS_COLOUR_CHANGED;
3108wxEventType wxEVT_DISPLAY_CHANGED;
3109wxEventType wxEVT_QUERY_NEW_PALETTE;
3110wxEventType wxEVT_PALETTE_CHANGED;
3111wxEventType wxEVT_JOY_BUTTON_DOWN;
3112wxEventType wxEVT_JOY_BUTTON_UP;
3113wxEventType wxEVT_JOY_MOVE;
3114wxEventType wxEVT_JOY_ZMOVE;
3115wxEventType wxEVT_DROP_FILES;
3116wxEventType wxEVT_INIT_DIALOG;
3117wxEventType wxEVT_IDLE;
3118wxEventType wxEVT_UPDATE_UI;
3119wxEventType wxEVT_SIZING;
3120wxEventType wxEVT_MOVING;
3121wxEventType wxEVT_MOVE_START;
3122wxEventType wxEVT_MOVE_END;
3123wxEventType wxEVT_HIBERNATE;
3124wxEventType wxEVT_COMMAND_TEXT_COPY;
3125wxEventType wxEVT_COMMAND_TEXT_CUT;
3126wxEventType wxEVT_COMMAND_TEXT_PASTE;
3127wxEventType wxEVT_COMMAND_LEFT_CLICK;
3128wxEventType wxEVT_COMMAND_LEFT_DCLICK;
3129wxEventType wxEVT_COMMAND_RIGHT_CLICK;
3130wxEventType wxEVT_COMMAND_RIGHT_DCLICK;
3131wxEventType wxEVT_COMMAND_SET_FOCUS;
3132wxEventType wxEVT_COMMAND_KILL_FOCUS;
3133wxEventType wxEVT_COMMAND_ENTER;
3134wxEventType wxEVT_HELP;
3135wxEventType wxEVT_DETAILED_HELP;
3136wxEventType wxEVT_COMMAND_TEXT_UPDATED;
e83c4d40 3137wxEventType wxEVT_COMMAND_TEXT_ENTER;
a90e69f7 3138wxEventType wxEVT_COMMAND_TOOL_CLICKED;
ea8fa3c4 3139wxEventType wxEVT_WINDOW_MODAL_DIALOG_CLOSED;
a90e69f7
RD
3140
3141
3142
7fa7088e
BP
3143//@}
3144