1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxEvtHandler, wxEventBlocker and many
4 // wxEvent-derived classes
5 // Author: wxWidgets team
7 // Licence: wxWindows license
8 /////////////////////////////////////////////////////////////////////////////
14 An event is a structure holding information about an event passed to a
15 callback or member function.
17 wxEvent used to be a multipurpose event object, and is an abstract base class
18 for other event classes (see below).
20 For more information about events, see the @ref overview_eventhandling overview.
23 In wxPerl custom event classes should be derived from
24 @c Wx::PlEvent and @c Wx::PlCommandEvent.
30 @see wxCommandEvent, wxMouseEvent
32 class wxEvent
: public wxObject
38 Notice that events are usually created by wxWidgets itself and creating
39 e.g. a wxPaintEvent in your code and sending it to e.g. a wxTextCtrl
40 will not usually affect it at all as native controls have no specific
41 knowledge about wxWidgets events. However you may construct objects of
42 specific types and pass them to wxEvtHandler::ProcessEvent() if you
43 want to create your own custom control and want to process its events
44 in the same manner as the standard ones.
46 Also please notice that the order of parameters in this constructor is
47 different from almost all the derived classes which specify the event
48 type as the first argument.
51 The identifier of the object (window, timer, ...) which generated
54 The unique type of event, e.g. wxEVT_PAINT, wxEVT_SIZE or
55 wxEVT_COMMAND_BUTTON_CLICKED.
57 wxEvent(int id
= 0, wxEventType eventType
= wxEVT_NULL
);
60 Returns a copy of the event.
62 Any event that is posted to the wxWidgets event system for later action
63 (via wxEvtHandler::AddPendingEvent, wxEvtHandler::QueueEvent or wxPostEvent())
64 must implement this method.
66 All wxWidgets events fully implement this method, but any derived events
67 implemented by the user should also implement this method just in case they
68 (or some event derived from them) are ever posted.
70 All wxWidgets events implement a copy constructor, so the easiest way of
71 implementing the Clone function is to implement a copy constructor for
72 a new event (call it MyEvent) and then define the Clone function like this:
75 wxEvent *Clone() const { return new MyEvent(*this); }
78 virtual wxEvent
* Clone() const = 0;
81 Returns the object (usually a window) associated with the event, if any.
83 wxObject
* GetEventObject() const;
86 Returns the identifier of the given event type, such as @c wxEVT_COMMAND_BUTTON_CLICKED.
88 wxEventType
GetEventType() const;
91 Returns the identifier associated with this event, such as a button command id.
96 Returns @true if the event handler should be skipped, @false otherwise.
98 bool GetSkipped() const;
101 Gets the timestamp for the event. The timestamp is the time in milliseconds
102 since some fixed moment (not necessarily the standard Unix Epoch, so only
103 differences between the timestamps and not their absolute values usually make sense).
106 wxWidgets returns a non-NULL timestamp only for mouse and key events
107 (see wxMouseEvent and wxKeyEvent).
109 long GetTimestamp() const;
112 Returns @true if the event is or is derived from wxCommandEvent else it returns @false.
114 @note exists only for optimization purposes.
116 bool IsCommandEvent() const;
119 Sets the propagation level to the given value (for example returned from an
120 earlier call to wxEvent::StopPropagation).
122 void ResumePropagation(int propagationLevel
);
125 Sets the originating object.
127 void SetEventObject(wxObject
* object
);
132 void SetEventType(wxEventType type
);
135 Sets the identifier associated with this event, such as a button command id.
140 Sets the timestamp for the event.
142 void SetTimestamp(long timeStamp
= 0);
145 Test if this event should be propagated or not, i.e. if the propagation level
146 is currently greater than 0.
148 bool ShouldPropagate() const;
151 This method can be used inside an event handler to control whether further
152 event handlers bound to this event will be called after the current one returns.
154 Without Skip() (or equivalently if Skip(@false) is used), the event will not
155 be processed any more. If Skip(@true) is called, the event processing system
156 continues searching for a further handler function for this event, even though
157 it has been processed already in the current handler.
159 In general, it is recommended to skip all non-command events to allow the
160 default handling to take place. The command events are, however, normally not
161 skipped as usually a single command such as a button click or menu item
162 selection must only be processed by one handler.
164 void Skip(bool skip
= true);
167 Stop the event from propagating to its parent window.
169 Returns the old propagation level value which may be later passed to
170 ResumePropagation() to allow propagating the event again.
172 int StopPropagation();
176 Indicates how many levels the event can propagate.
178 This member is protected and should typically only be set in the constructors
179 of the derived classes. It may be temporarily changed by StopPropagation()
180 and ResumePropagation() and tested with ShouldPropagate().
182 The initial value is set to either @c wxEVENT_PROPAGATE_NONE (by default)
183 meaning that the event shouldn't be propagated at all or to
184 @c wxEVENT_PROPAGATE_MAX (for command events) meaning that it should be
185 propagated as much as necessary.
187 Any positive number means that the event should be propagated but no more than
188 the given number of times. E.g. the propagation level may be set to 1 to
189 propagate the event to its parent only, but not to its grandparent.
191 int m_propagationLevel
;
195 @class wxEventBlocker
197 This class is a special event handler which allows to discard
198 any event (or a set of event types) directed to a specific window.
203 void MyWindow::DoSomething()
206 // block all events directed to this window while
207 // we do the 1000 FunctionWhichSendsEvents() calls
208 wxEventBlocker blocker(this);
210 for ( int i = 0; i 1000; i++ )
211 FunctionWhichSendsEvents(i);
213 } // ~wxEventBlocker called, old event handler is restored
215 // the event generated by this call will be processed:
216 FunctionWhichSendsEvents(0)
223 @see @ref overview_eventhandling, wxEvtHandler
225 class wxEventBlocker
: public wxEvtHandler
229 Constructs the blocker for the given window and for the given event type.
231 If @a type is @c wxEVT_ANY, then all events for that window are blocked.
232 You can call Block() after creation to add other event types to the list
235 Note that the @a win window @b must remain alive until the
236 wxEventBlocker object destruction.
238 wxEventBlocker(wxWindow
* win
, wxEventType type
= -1);
241 Destructor. The blocker will remove itself from the chain of event handlers for
242 the window provided in the constructor, thus restoring normal processing of events.
244 virtual ~wxEventBlocker();
247 Adds to the list of event types which should be blocked the given @a eventType.
249 void Block(wxEventType eventType
);
257 A class that can handle events from the windowing system.
258 wxWindow is (and therefore all window classes are) derived from this class.
260 When events are received, wxEvtHandler invokes the method listed in the
261 event table using itself as the object. When using multiple inheritance
262 <b>it is imperative that the wxEvtHandler(-derived) class is the first
263 class inherited</b> such that the @c this pointer for the overall object
264 will be identical to the @c this pointer of the wxEvtHandler portion.
269 @see @ref overview_eventhandling
271 class wxEvtHandler
: public wxObject
282 If the handler is part of a chain, the destructor will unlink itself
285 virtual ~wxEvtHandler();
289 @name Event queuing and processing
294 Queue event for a later processing.
296 This method is similar to ProcessEvent() but while the latter is
297 synchronous, i.e. the event is processed immediately, before the
298 function returns, this one is asynchronous and returns immediately
299 while the event will be processed at some later time (usually during
300 the next event loop iteration).
302 Another important difference is that this method takes ownership of the
303 @a event parameter, i.e. it will delete it itself. This implies that
304 the event should be allocated on the heap and that the pointer can't be
305 used any more after the function returns (as it can be deleted at any
308 QueueEvent() can be used for inter-thread communication from the worker
309 threads to the main thread, it is safe in the sense that it uses
310 locking internally and avoids the problem mentioned in AddPendingEvent()
311 documentation by ensuring that the @a event object is not used by the
312 calling thread any more. Care should still be taken to avoid that some
313 fields of this object are used by it, notably any wxString members of
314 the event object must not be shallow copies of another wxString object
315 as this would result in them still using the same string buffer behind
316 the scenes. For example
318 void FunctionInAWorkerThread(const wxString& str)
320 wxCommandEvent* evt = new wxCommandEvent;
322 // NOT evt->SetString(str) as this would be a shallow copy
323 evt->SetString(str.c_str()); // make a deep copy
325 wxTheApp->QueueEvent( evt );
329 Finally notice that this method automatically wakes up the event loop
330 if it is currently idle by calling ::wxWakeUpIdle() so there is no need
331 to do it manually when using it.
336 A heap-allocated event to be queued, QueueEvent() takes ownership
337 of it. This parameter shouldn't be @c NULL.
339 virtual void QueueEvent(wxEvent
*event
);
342 Post an event to be processed later.
344 This function is similar to QueueEvent() but can't be used to post
345 events from worker threads for the event objects with wxString fields
346 (i.e. in practice most of them) because of an unsafe use of the same
347 wxString object which happens because the wxString field in the
348 original @a event object and its copy made internally by this function
349 share the same string buffer internally. Use QueueEvent() to avoid
352 A copy of @a event is made by the function, so the original can be deleted
353 as soon as function returns (it is common that the original is created
354 on the stack). This requires that the wxEvent::Clone() method be
355 implemented by event so that it can be duplicated and stored until it
359 Event to add to the pending events queue.
361 virtual void AddPendingEvent(const wxEvent
& event
);
364 Processes an event, searching event tables and calling zero or more suitable
365 event handler function(s).
367 Normally, your application would not call this function: it is called in the
368 wxWidgets implementation to dispatch incoming user interface events to the
369 framework (and application).
371 However, you might need to call it if implementing new functionality
372 (such as a new control) where you define new event types, as opposed to
373 allowing the user to override virtual functions.
375 An instance where you might actually override the ProcessEvent() function is where
376 you want to direct event processing to event handlers not normally noticed by
377 wxWidgets. For example, in the document/view architecture, documents and views
378 are potential event handlers. When an event reaches a frame, ProcessEvent() will
379 need to be called on the associated document and view in case event handler functions
380 are associated with these objects. The property classes library (wxProperty) also
381 overrides ProcessEvent() for similar reasons.
383 The normal order of event table searching is as follows:
384 -# If the object is disabled (via a call to wxEvtHandler::SetEvtHandlerEnabled)
385 the function skips to step (6).
386 -# If the object is a wxWindow, ProcessEvent() is recursively called on the
387 window's wxValidator. If this returns @true, the function exits.
388 -# SearchEventTable() is called for this event handler. If this fails, the base
389 class table is tried, and so on until no more tables exist or an appropriate
390 function was found, in which case the function exits.
391 -# The search is applied down the entire chain of event handlers (usually the
392 chain has a length of one). This chain can be formed using wxEvtHandler::SetNextHandler():
393 @image html overview_eventhandling_chain.png
394 (referring to the image, if @c A->ProcessEvent is called and it doesn't handle
395 the event, @c B->ProcessEvent will be called and so on...).
396 Note that in the case of wxWindow you can build a stack of event handlers
397 (see wxWindow::PushEventHandler() for more info).
398 If any of the handlers of the chain return @true, the function exits.
399 -# If the object is a wxWindow and the event is a wxCommandEvent, ProcessEvent()
400 is recursively applied to the parent window's event handler.
401 If this returns @true, the function exits.
402 -# Finally, ProcessEvent() is called on the wxApp object.
407 @return @true if a suitable event handler function was found and
408 executed, and the function did not call wxEvent::Skip.
410 @see SearchEventTable()
412 virtual bool ProcessEvent(wxEvent
& event
);
415 Processes an event by calling ProcessEvent() and handles any exceptions
416 that occur in the process.
417 If an exception is thrown in event handler, wxApp::OnExceptionInMainLoop is called.
422 @return @true if the event was processed, @false if no handler was found
423 or an exception was thrown.
425 @see wxWindow::HandleWindowEvent
427 bool SafelyProcessEvent(wxEvent
& event
);
430 Searches the event table, executing an event handler function if an appropriate
434 Event table to be searched.
436 Event to be matched against an event table entry.
438 @return @true if a suitable event handler function was found and
439 executed, and the function did not call wxEvent::Skip.
441 @remarks This function looks through the object's event table and tries
442 to find an entry that will match the event.
443 An entry will match if:
444 @li The event type matches, and
445 @li the identifier or identifier range matches, or the event table
446 entry's identifier is zero.
448 If a suitable function is called but calls wxEvent::Skip, this
449 function will fail, and searching will continue.
453 virtual bool SearchEventTable(wxEventTable
& table
,
460 @name Connecting and disconnecting
465 Connects the given function dynamically with the event handler, id and
468 This is an alternative to the use of static event tables. It is more
469 flexible as it allows to connect events generated by some object to an
470 event handler defined in a different object of a different class (which
471 is impossible to do directly with the event tables -- the events can be
472 only handled in another object if they are propagated upwards to it).
473 Do make sure to specify the correct @a eventSink when connecting to an
474 event of a different object.
476 See @ref overview_eventhandling_connect for more detailed explanation
477 of this function and the @ref page_samples_event sample for usage
480 This specific overload allows you to connect an event handler to a @e range
482 Do not confuse @e source IDs with event @e types: source IDs identify the
483 event generator objects (typically wxMenuItem or wxWindow objects) while the
484 event @e type identify which type of events should be handled by the
485 given @e function (an event generator object may generate many different
489 The first ID of the identifier range to be associated with the event
492 The last ID of the identifier range to be associated with the event
495 The event type to be associated with this event handler.
497 The event handler function. Note that this function should
498 be explicitly converted to the correct type which can be done using a macro
499 called @c wxFooEventHandler for the handler for any @c wxFooEvent.
501 Data to be associated with the event table entry.
503 Object whose member function should be called. It must be specified
504 when connecting an event generated by one object to a member
505 function of a different object. If it is omitted, @c this is used.
507 void Connect(int id
, int lastId
, wxEventType eventType
,
508 wxObjectEventFunction function
,
509 wxObject
* userData
= NULL
,
510 wxEvtHandler
* eventSink
= NULL
);
513 See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*)
514 overload for more info.
516 This overload can be used to attach an event handler to a single source ID:
520 frame->Connect( wxID_EXIT,
521 wxEVT_COMMAND_MENU_SELECTED,
522 wxCommandEventHandler(MyFrame::OnQuit) );
525 void Connect(int id
, wxEventType eventType
,
526 wxObjectEventFunction function
,
527 wxObject
* userData
= NULL
,
528 wxEvtHandler
* eventSink
= NULL
);
531 See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*)
532 overload for more info.
534 This overload will connect the given event handler so that regardless of the
535 ID of the event source, the handler will be called.
537 void Connect(wxEventType eventType
,
538 wxObjectEventFunction function
,
539 wxObject
* userData
= NULL
,
540 wxEvtHandler
* eventSink
= NULL
);
543 Disconnects the given function dynamically from the event handler, using the
544 specified parameters as search criteria and returning @true if a matching
545 function has been found and removed.
547 This method can only disconnect functions which have been added using the
548 Connect() method. There is no way to disconnect functions connected using
549 the (static) event tables.
552 The event type associated with this event handler.
554 The event handler function.
556 Data associated with the event table entry.
558 Object whose member function should be called.
560 bool Disconnect(wxEventType eventType
,
561 wxObjectEventFunction function
,
562 wxObject
* userData
= NULL
,
563 wxEvtHandler
* eventSink
= NULL
);
566 See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*)
567 overload for more info.
569 This overload takes the additional @a id parameter.
571 bool Disconnect(int id
= wxID_ANY
,
572 wxEventType eventType
= wxEVT_NULL
,
573 wxObjectEventFunction function
= NULL
,
574 wxObject
* userData
= NULL
,
575 wxEvtHandler
* eventSink
= NULL
);
578 See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*)
579 overload for more info.
581 This overload takes an additional range of source IDs.
583 bool Disconnect(int id
, int lastId
,
584 wxEventType eventType
,
585 wxObjectEventFunction function
= NULL
,
586 wxObject
* userData
= NULL
,
587 wxEvtHandler
* eventSink
= NULL
);
592 @name User-supplied data
597 Returns user-supplied client data.
599 @remarks Normally, any extra data the programmer wishes to associate with
600 the object should be made available by deriving a new class with
605 void* GetClientData() const;
608 Returns a pointer to the user-supplied client data object.
610 @see SetClientObject(), wxClientData
612 wxClientData
* GetClientObject() const;
615 Sets user-supplied client data.
618 Data to be associated with the event handler.
620 @remarks Normally, any extra data the programmer wishes to associate
621 with the object should be made available by deriving a new
622 class with new data members. You must not call this method
623 and SetClientObject on the same class - only one of them.
627 void SetClientData(void* data
);
630 Set the client data object. Any previous object will be deleted.
632 @see GetClientObject(), wxClientData
634 void SetClientObject(wxClientData
* data
);
640 @name Event handler chaining
642 wxEvtHandler can be arranged in a double-linked list of handlers
643 which is automatically iterated by ProcessEvent() if needed.
648 Returns @true if the event handler is enabled, @false otherwise.
650 @see SetEvtHandlerEnabled()
652 bool GetEvtHandlerEnabled() const;
655 Returns the pointer to the next handler in the chain.
657 @see SetNextHandler(), GetPreviousHandler(), SetPreviousHandler(),
658 wxWindow::PushEventHandler, wxWindow::PopEventHandler
660 wxEvtHandler
* GetNextHandler() const;
663 Returns the pointer to the previous handler in the chain.
665 @see SetPreviousHandler(), GetNextHandler(), SetNextHandler(),
666 wxWindow::PushEventHandler, wxWindow::PopEventHandler
668 wxEvtHandler
* GetPreviousHandler() const;
671 Enables or disables the event handler.
674 @true if the event handler is to be enabled, @false if it is to be disabled.
676 @remarks You can use this function to avoid having to remove the event
677 handler from the chain, for example when implementing a
678 dialog editor and changing from edit to test mode.
680 @see GetEvtHandlerEnabled()
682 void SetEvtHandlerEnabled(bool enabled
);
685 Sets the pointer to the next handler.
688 See ProcessEvent() for more info about how the chains of event handlers
690 Also remember that wxEvtHandler uses double-linked lists and thus if you
691 use this function, you should also call SetPreviousHandler() on the
692 argument passed to this function:
694 handlerA->SetNextHandler(handlerB);
695 handlerB->SetPreviousHandler(handlerA);
699 The event handler to be set as the next handler.
702 @see @ref overview_eventhandling_processing
704 virtual void SetNextHandler(wxEvtHandler
* handler
);
707 Sets the pointer to the previous handler.
708 All remarks about SetNextHandler() apply to this function as well.
711 The event handler to be set as the previous handler.
714 @see @ref overview_eventhandling_processing
716 virtual void SetPreviousHandler(wxEvtHandler
* handler
);
719 Unlinks this event handler from the chain it's part of (if any);
720 then links the "previous" event handler to the "next" one
721 (so that the chain won't be interrupted).
723 E.g. if before calling Unlink() you have the following chain:
724 @image html evthandler_unlink_before.png
725 then after calling @c B->Unlink() you'll have:
726 @image html evthandler_unlink_after.png
733 Returns @true if the next and the previous handler pointers of this
734 event handler instance are @NULL.
738 @see SetPreviousHandler(), SetNextHandler()
740 bool IsUnlinked() const;
749 This event class contains information about keypress (character) events.
751 Notice that there are three different kinds of keyboard events in wxWidgets:
752 key down and up events and char events. The difference between the first two
753 is clear - the first corresponds to a key press and the second to a key
754 release - otherwise they are identical. Just note that if the key is
755 maintained in a pressed state you will typically get a lot of (automatically
756 generated) down events but only one up so it is wrong to assume that there is
757 one up event corresponding to each down one.
759 Both key events provide untranslated key codes while the char event carries
760 the translated one. The untranslated code for alphanumeric keys is always
761 an upper case value. For the other keys it is one of @c WXK_XXX values
762 from the ::wxKeyCode enumeration.
763 The translated key is, in general, the character the user expects to appear
764 as the result of the key combination when typing the text into a text entry
767 A few examples to clarify this (all assume that CAPS LOCK is unpressed
768 and the standard US keyboard): when the @c 'A' key is pressed, the key down
769 event key code is equal to @c ASCII A == 65. But the char event key code
770 is @c ASCII a == 97. On the other hand, if you press both SHIFT and
771 @c 'A' keys simultaneously , the key code in key down event will still be
772 just @c 'A' while the char event key code parameter will now be @c 'A'
775 Although in this simple case it is clear that the correct key code could be
776 found in the key down event handler by checking the value returned by
777 wxKeyEvent::ShiftDown(), in general you should use @c EVT_CHAR for this as
778 for non-alphanumeric keys the translation is keyboard-layout dependent and
779 can only be done properly by the system itself.
781 Another kind of translation is done when the control key is pressed: for
782 example, for CTRL-A key press the key down event still carries the
783 same key code @c 'a' as usual but the char event will have key code of 1,
784 the ASCII value of this key combination.
786 You may discover how the other keys on your system behave interactively by
787 running the @ref page_samples_text wxWidgets sample and pressing some keys
788 in any of the text controls shown in it.
790 @b Tip: be sure to call @c event.Skip() for events that you don't process in
791 key event function, otherwise menu shortcuts may cease to work under Windows.
793 @note If a key down (@c EVT_KEY_DOWN) event is caught and the event handler
794 does not call @c event.Skip() then the corresponding char event
795 (@c EVT_CHAR) will not happen.
796 This is by design and enables the programs that handle both types of
797 events to be a bit simpler.
799 @note For Windows programmers: The key and char events in wxWidgets are
800 similar to but slightly different from Windows @c WM_KEYDOWN and
801 @c WM_CHAR events. In particular, Alt-x combination will generate a
802 char event in wxWidgets (unless it is used as an accelerator).
805 @beginEventTable{wxKeyEvent}
806 @event{EVT_KEY_DOWN(func)}
807 Process a wxEVT_KEY_DOWN event (any key has been pressed).
808 @event{EVT_KEY_UP(func)}
809 Process a wxEVT_KEY_UP event (any key has been released).
810 @event{EVT_CHAR(func)}
811 Process a wxEVT_CHAR event.
819 class wxKeyEvent
: public wxEvent
,
820 public wxKeyboardState
825 Currently, the only valid event types are @c wxEVT_CHAR and @c wxEVT_CHAR_HOOK.
827 wxKeyEvent(wxEventType keyEventType
= wxEVT_NULL
);
830 Returns the virtual key code. ASCII events return normal ASCII values,
831 while non-ASCII events return values such as @b WXK_LEFT for the left cursor
832 key. See ::wxKeyCode for a full list of the virtual key codes.
834 Note that in Unicode build, the returned value is meaningful only if the
835 user entered a character that can be represented in current locale's default
836 charset. You can obtain the corresponding Unicode character using GetUnicodeKey().
838 int GetKeyCode() const;
842 Obtains the position (in client coordinates) at which the key was pressed.
844 wxPoint
GetPosition() const;
845 void GetPosition(long* x
, long* y
) const;
849 Returns the raw key code for this event. This is a platform-dependent scan code
850 which should only be used in advanced applications.
852 @note Currently the raw key codes are not supported by all ports, use
853 @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available.
855 wxUint32
GetRawKeyCode() const;
858 Returns the low level key flags for this event. The flags are
859 platform-dependent and should only be used in advanced applications.
861 @note Currently the raw key flags are not supported by all ports, use
862 @ifdef_ wxHAS_RAW_KEY_CODES to determine if this feature is available.
864 wxUint32
GetRawKeyFlags() const;
867 Returns the Unicode character corresponding to this key event.
869 This function is only available in Unicode build, i.e. when
870 @c wxUSE_UNICODE is 1.
872 wxChar
GetUnicodeKey() const;
875 Returns the X position (in client coordinates) of the event.
877 wxCoord
GetX() const;
880 Returns the Y position (in client coordinates) of the event.
882 wxCoord
GetY() const;
888 @class wxJoystickEvent
890 This event class contains information about joystick events, particularly
891 events received by windows.
893 @beginEventTable{wxJoystickEvent}
894 @style{EVT_JOY_BUTTON_DOWN(func)}
895 Process a wxEVT_JOY_BUTTON_DOWN event.
896 @style{EVT_JOY_BUTTON_UP(func)}
897 Process a wxEVT_JOY_BUTTON_UP event.
898 @style{EVT_JOY_MOVE(func)}
899 Process a wxEVT_JOY_MOVE event.
900 @style{EVT_JOY_ZMOVE(func)}
901 Process a wxEVT_JOY_ZMOVE event.
902 @style{EVT_JOYSTICK_EVENTS(func)}
903 Processes all joystick events.
911 class wxJoystickEvent
: public wxEvent
917 wxJoystickEvent(wxEventType eventType
= wxEVT_NULL
, int state
= 0,
918 int joystick
= wxJOYSTICK1
,
922 Returns @true if the event was a down event from the specified button
926 Can be @c wxJOY_BUTTONn where @c n is 1, 2, 3 or 4; or @c wxJOY_BUTTON_ANY to
927 indicate any button down event.
929 bool ButtonDown(int button
= wxJOY_BUTTON_ANY
) const;
932 Returns @true if the specified button (or any button) was in a down state.
935 Can be @c wxJOY_BUTTONn where @c n is 1, 2, 3 or 4; or @c wxJOY_BUTTON_ANY to
936 indicate any button down event.
938 bool ButtonIsDown(int button
= wxJOY_BUTTON_ANY
) const;
941 Returns @true if the event was an up event from the specified button
945 Can be @c wxJOY_BUTTONn where @c n is 1, 2, 3 or 4; or @c wxJOY_BUTTON_ANY to
946 indicate any button down event.
948 bool ButtonUp(int button
= wxJOY_BUTTON_ANY
) const;
951 Returns the identifier of the button changing state.
953 This is a @c wxJOY_BUTTONn identifier, where @c n is one of 1, 2, 3, 4.
955 int GetButtonChange() const;
958 Returns the down state of the buttons.
960 This is a @c wxJOY_BUTTONn identifier, where @c n is one of 1, 2, 3, 4.
962 int GetButtonState() const;
965 Returns the identifier of the joystick generating the event - one of
966 wxJOYSTICK1 and wxJOYSTICK2.
968 int GetJoystick() const;
971 Returns the x, y position of the joystick event.
973 wxPoint
GetPosition() const;
976 Returns the z position of the joystick event.
978 int GetZPosition() const;
981 Returns @true if this was a button up or down event
982 (@e not 'is any button down?').
984 bool IsButton() const;
987 Returns @true if this was an x, y move event.
992 Returns @true if this was a z move event.
994 bool IsZMove() const;
1000 @class wxScrollWinEvent
1002 A scroll event holds information about events sent from scrolling windows.
1005 @beginEventTable{wxScrollWinEvent}
1006 You can use the EVT_SCROLLWIN* macros for intercepting scroll window events
1007 from the receiving window.
1008 @event{EVT_SCROLLWIN(func)}
1009 Process all scroll events.
1010 @event{EVT_SCROLLWIN_TOP(func)}
1011 Process wxEVT_SCROLLWIN_TOP scroll-to-top events.
1012 @event{EVT_SCROLLWIN_BOTTOM(func)}
1013 Process wxEVT_SCROLLWIN_BOTTOM scroll-to-bottom events.
1014 @event{EVT_SCROLLWIN_LINEUP(func)}
1015 Process wxEVT_SCROLLWIN_LINEUP line up events.
1016 @event{EVT_SCROLLWIN_LINEDOWN(func)}
1017 Process wxEVT_SCROLLWIN_LINEDOWN line down events.
1018 @event{EVT_SCROLLWIN_PAGEUP(func)}
1019 Process wxEVT_SCROLLWIN_PAGEUP page up events.
1020 @event{EVT_SCROLLWIN_PAGEDOWN(func)}
1021 Process wxEVT_SCROLLWIN_PAGEDOWN page down events.
1022 @event{EVT_SCROLLWIN_THUMBTRACK(func)}
1023 Process wxEVT_SCROLLWIN_THUMBTRACK thumbtrack events
1024 (frequent events sent as the user drags the thumbtrack).
1025 @event{EVT_SCROLLWIN_THUMBRELEASE(func)}
1026 Process wxEVT_SCROLLWIN_THUMBRELEASE thumb release events.
1033 @see wxScrollEvent, @ref overview_eventhandling
1035 class wxScrollWinEvent
: public wxEvent
1041 wxScrollWinEvent(wxEventType commandType
= wxEVT_NULL
, int pos
= 0,
1042 int orientation
= 0);
1045 Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the
1048 @todo wxHORIZONTAL and wxVERTICAL should go in their own enum
1050 int GetOrientation() const;
1053 Returns the position of the scrollbar for the thumb track and release events.
1055 Note that this field can't be used for the other events, you need to query
1056 the window itself for the current position in that case.
1058 int GetPosition() const;
1064 @class wxSysColourChangedEvent
1066 This class is used for system colour change events, which are generated
1067 when the user changes the colour settings using the control panel.
1068 This is only appropriate under Windows.
1071 The default event handler for this event propagates the event to child windows,
1072 since Windows only sends the events to top-level windows.
1073 If intercepting this event for a top-level window, remember to call the base
1074 class handler, or to pass the event on to the window's children explicitly.
1076 @beginEventTable{wxSysColourChangedEvent}
1077 @event{EVT_SYS_COLOUR_CHANGED(func)}
1078 Process a wxEVT_SYS_COLOUR_CHANGED event.
1084 @see @ref overview_eventhandling
1086 class wxSysColourChangedEvent
: public wxEvent
1092 wxSysColourChangedEvent();
1098 @class wxWindowCreateEvent
1100 This event is sent just after the actual window associated with a wxWindow
1101 object has been created.
1103 Since it is derived from wxCommandEvent, the event propagates up
1104 the window hierarchy.
1106 @beginEventTable{wxWindowCreateEvent}
1107 @event{EVT_WINDOW_CREATE(func)}
1108 Process a wxEVT_CREATE event.
1114 @see @ref overview_eventhandling, wxWindowDestroyEvent
1116 class wxWindowCreateEvent
: public wxCommandEvent
1122 wxWindowCreateEvent(wxWindow
* win
= NULL
);
1124 /// Retutn the window being created.
1125 wxWindow
*GetWindow() const;
1133 A paint event is sent when a window's contents needs to be repainted.
1135 Please notice that in general it is impossible to change the drawing of a
1136 standard control (such as wxButton) and so you shouldn't attempt to handle
1137 paint events for them as even if it might work on some platforms, this is
1138 inherently not portable and won't work everywhere.
1141 Note that in a paint event handler, the application must always create a
1142 wxPaintDC object, even if you do not use it. Otherwise, under MS Windows,
1143 refreshing for this and other windows will go wrong.
1146 void MyWindow::OnPaint(wxPaintEvent& event)
1153 You can optimize painting by retrieving the rectangles that have been damaged
1154 and only repainting these. The rectangles are in terms of the client area,
1155 and are unscrolled, so you will need to do some calculations using the current
1156 view position to obtain logical, scrolled units.
1157 Here is an example of using the wxRegionIterator class:
1159 // Called when window needs to be repainted.
1160 void MyWindow::OnPaint(wxPaintEvent& event)
1164 // Find Out where the window is scrolled to
1165 int vbX,vbY; // Top left corner of client
1166 GetViewStart(&vbX,&vbY);
1168 int vX,vY,vW,vH; // Dimensions of client area in pixels
1169 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1178 // Alternatively we can do this:
1179 // wxRect rect(upd.GetRect());
1181 // Repaint this rectangle
1190 @beginEventTable{wxPaintEvent}
1191 @event{EVT_PAINT(func)}
1192 Process a wxEVT_PAINT event.
1198 @see @ref overview_eventhandling
1200 class wxPaintEvent
: public wxEvent
1206 wxPaintEvent(int id
= 0);
1212 @class wxMaximizeEvent
1214 An event being sent when a top level window is maximized. Notice that it is
1215 not sent when the window is restored to its original size after it had been
1216 maximized, only a normal wxSizeEvent is generated in this case.
1218 @beginEventTable{wxMaximizeEvent}
1219 @event{EVT_MAXIMIZE(func)}
1220 Process a wxEVT_MAXIMIZE event.
1226 @see @ref overview_eventhandling, wxTopLevelWindow::Maximize,
1227 wxTopLevelWindow::IsMaximized
1229 class wxMaximizeEvent
: public wxEvent
1233 Constructor. Only used by wxWidgets internally.
1235 wxMaximizeEvent(int id
= 0);
1239 The possibles modes to pass to wxUpdateUIEvent::SetMode().
1243 /** Send UI update events to all windows. */
1244 wxUPDATE_UI_PROCESS_ALL
,
1246 /** Send UI update events to windows that have
1247 the wxWS_EX_PROCESS_UI_UPDATES flag specified. */
1248 wxUPDATE_UI_PROCESS_SPECIFIED
1253 @class wxUpdateUIEvent
1255 This class is used for pseudo-events which are called by wxWidgets
1256 to give an application the chance to update various user interface elements.
1258 Without update UI events, an application has to work hard to check/uncheck,
1259 enable/disable, show/hide, and set the text for elements such as menu items
1260 and toolbar buttons. The code for doing this has to be mixed up with the code
1261 that is invoked when an action is invoked for a menu item or button.
1263 With update UI events, you define an event handler to look at the state of the
1264 application and change UI elements accordingly. wxWidgets will call your member
1265 functions in idle time, so you don't have to worry where to call this code.
1267 In addition to being a clearer and more declarative method, it also means you don't
1268 have to worry whether you're updating a toolbar or menubar identifier. The same
1269 handler can update a menu item and toolbar button, if the identifier is the same.
1270 Instead of directly manipulating the menu or button, you call functions in the event
1271 object, such as wxUpdateUIEvent::Check. wxWidgets will determine whether such a
1272 call has been made, and which UI element to update.
1274 These events will work for popup menus as well as menubars. Just before a menu is
1275 popped up, wxMenu::UpdateUI is called to process any UI events for the window that
1278 If you find that the overhead of UI update processing is affecting your application,
1279 you can do one or both of the following:
1280 @li Call wxUpdateUIEvent::SetMode with a value of wxUPDATE_UI_PROCESS_SPECIFIED,
1281 and set the extra style wxWS_EX_PROCESS_UI_UPDATES for every window that should
1282 receive update events. No other windows will receive update events.
1283 @li Call wxUpdateUIEvent::SetUpdateInterval with a millisecond value to set the delay
1284 between updates. You may need to call wxWindow::UpdateWindowUI at critical points,
1285 for example when a dialog is about to be shown, in case the user sees a slight
1286 delay before windows are updated.
1288 Note that although events are sent in idle time, defining a wxIdleEvent handler
1289 for a window does not affect this because the events are sent from wxWindow::OnInternalIdle
1290 which is always called in idle time.
1292 wxWidgets tries to optimize update events on some platforms.
1293 On Windows and GTK+, events for menubar items are only sent when the menu is about
1294 to be shown, and not in idle time.
1297 @beginEventTable{wxUpdateUIEvent}
1298 @event{EVT_UPDATE_UI(id, func)}
1299 Process a wxEVT_UPDATE_UI event for the command with the given id.
1300 @event{EVT_UPDATE_UI_RANGE(id1, id2, func)}
1301 Process a wxEVT_UPDATE_UI event for any command with id included in the given range.
1307 @see @ref overview_eventhandling
1309 class wxUpdateUIEvent
: public wxCommandEvent
1315 wxUpdateUIEvent(wxWindowID commandId
= 0);
1318 Returns @true if it is appropriate to update (send UI update events to)
1321 This function looks at the mode used (see wxUpdateUIEvent::SetMode),
1322 the wxWS_EX_PROCESS_UI_UPDATES flag in @a window, the time update events
1323 were last sent in idle time, and the update interval, to determine whether
1324 events should be sent to this window now. By default this will always
1325 return @true because the update mode is initially wxUPDATE_UI_PROCESS_ALL
1326 and the interval is set to 0; so update events will be sent as often as
1327 possible. You can reduce the frequency that events are sent by changing the
1328 mode and/or setting an update interval.
1330 @see ResetUpdateTime(), SetUpdateInterval(), SetMode()
1332 static bool CanUpdate(wxWindow
* window
);
1335 Check or uncheck the UI element.
1337 void Check(bool check
);
1340 Enable or disable the UI element.
1342 void Enable(bool enable
);
1345 Returns @true if the UI element should be checked.
1347 bool GetChecked() const;
1350 Returns @true if the UI element should be enabled.
1352 bool GetEnabled() const;
1355 Static function returning a value specifying how wxWidgets will send update
1356 events: to all windows, or only to those which specify that they will process
1361 static wxUpdateUIMode
GetMode();
1364 Returns @true if the application has called Check().
1365 For wxWidgets internal use only.
1367 bool GetSetChecked() const;
1370 Returns @true if the application has called Enable().
1371 For wxWidgets internal use only.
1373 bool GetSetEnabled() const;
1376 Returns @true if the application has called Show().
1377 For wxWidgets internal use only.
1379 bool GetSetShown() const;
1382 Returns @true if the application has called SetText().
1383 For wxWidgets internal use only.
1385 bool GetSetText() const;
1388 Returns @true if the UI element should be shown.
1390 bool GetShown() const;
1393 Returns the text that should be set for the UI element.
1395 wxString
GetText() const;
1398 Returns the current interval between updates in milliseconds.
1399 The value -1 disables updates, 0 updates as frequently as possible.
1401 @see SetUpdateInterval().
1403 static long GetUpdateInterval();
1406 Used internally to reset the last-updated time to the current time.
1408 It is assumed that update events are normally sent in idle time, so this
1409 is called at the end of idle processing.
1411 @see CanUpdate(), SetUpdateInterval(), SetMode()
1413 static void ResetUpdateTime();
1416 Specify how wxWidgets will send update events: to all windows, or only to
1417 those which specify that they will process the events.
1420 this parameter may be one of the ::wxUpdateUIMode enumeration values.
1421 The default mode is wxUPDATE_UI_PROCESS_ALL.
1423 static void SetMode(wxUpdateUIMode mode
);
1426 Sets the text for this UI element.
1428 void SetText(const wxString
& text
);
1431 Sets the interval between updates in milliseconds.
1433 Set to -1 to disable updates, or to 0 to update as frequently as possible.
1436 Use this to reduce the overhead of UI update events if your application
1437 has a lot of windows. If you set the value to -1 or greater than 0,
1438 you may also need to call wxWindow::UpdateWindowUI at appropriate points
1439 in your application, such as when a dialog is about to be shown.
1441 static void SetUpdateInterval(long updateInterval
);
1444 Show or hide the UI element.
1446 void Show(bool show
);
1452 @class wxClipboardTextEvent
1454 This class represents the events generated by a control (typically a
1455 wxTextCtrl but other windows can generate these events as well) when its
1456 content gets copied or cut to, or pasted from the clipboard.
1458 There are three types of corresponding events wxEVT_COMMAND_TEXT_COPY,
1459 wxEVT_COMMAND_TEXT_CUT and wxEVT_COMMAND_TEXT_PASTE.
1461 If any of these events is processed (without being skipped) by an event
1462 handler, the corresponding operation doesn't take place which allows to
1463 prevent the text from being copied from or pasted to a control. It is also
1464 possible to examine the clipboard contents in the PASTE event handler and
1465 transform it in some way before inserting in a control -- for example,
1466 changing its case or removing invalid characters.
1468 Finally notice that a CUT event is always preceded by the COPY event which
1469 makes it possible to only process the latter if it doesn't matter if the
1470 text was copied or cut.
1473 These events are currently only generated by wxTextCtrl under GTK+.
1474 They are generated by all controls under Windows.
1476 @beginEventTable{wxClipboardTextEvent}
1477 @event{EVT_TEXT_COPY(id, func)}
1478 Some or all of the controls content was copied to the clipboard.
1479 @event{EVT_TEXT_CUT(id, func)}
1480 Some or all of the controls content was cut (i.e. copied and
1482 @event{EVT_TEXT_PASTE(id, func)}
1483 Clipboard content was pasted into the control.
1492 class wxClipboardTextEvent
: public wxCommandEvent
1498 wxClipboardTextEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0);
1506 This event class contains information about the events generated by the mouse:
1507 they include mouse buttons press and release events and mouse move events.
1509 All mouse events involving the buttons use @c wxMOUSE_BTN_LEFT for the
1510 left mouse button, @c wxMOUSE_BTN_MIDDLE for the middle one and
1511 @c wxMOUSE_BTN_RIGHT for the right one. And if the system supports more
1512 buttons, the @c wxMOUSE_BTN_AUX1 and @c wxMOUSE_BTN_AUX2 events
1513 can also be generated. Note that not all mice have even a middle button so a
1514 portable application should avoid relying on the events from it (but the right
1515 button click can be emulated using the left mouse button with the control key
1516 under Mac platforms with a single button mouse).
1518 For the @c wxEVT_ENTER_WINDOW and @c wxEVT_LEAVE_WINDOW events
1519 purposes, the mouse is considered to be inside the window if it is in the
1520 window client area and not inside one of its children. In other words, the
1521 parent window receives @c wxEVT_LEAVE_WINDOW event not only when the
1522 mouse leaves the window entirely but also when it enters one of its children.
1524 The position associated with a mouse event is expressed in the window
1525 coordinates of the window which generated the event, you can use
1526 wxWindow::ClientToScreen() to convert it to screen coordinates and possibly
1527 call wxWindow::ScreenToClient() next to convert it to window coordinates of
1530 @note Note that under Windows CE mouse enter and leave events are not natively
1531 supported by the system but are generated by wxWidgets itself. This has several
1532 drawbacks: the LEAVE_WINDOW event might be received some time after the mouse
1533 left the window and the state variables for it may have changed during this time.
1535 @note Note the difference between methods like wxMouseEvent::LeftDown and
1536 wxMouseEvent::LeftIsDown: the former returns @true when the event corresponds
1537 to the left mouse button click while the latter returns @true if the left
1538 mouse button is currently being pressed. For example, when the user is dragging
1539 the mouse you can use wxMouseEvent::LeftIsDown to test whether the left mouse
1540 button is (still) depressed. Also, by convention, if wxMouseEvent::LeftDown
1541 returns @true, wxMouseEvent::LeftIsDown will also return @true in wxWidgets
1542 whatever the underlying GUI behaviour is (which is platform-dependent).
1543 The same applies, of course, to other mouse buttons as well.
1546 @beginEventTable{wxMouseEvent}
1547 @event{EVT_LEFT_DOWN(func)}
1548 Process a wxEVT_LEFT_DOWN event. The handler of this event should normally
1549 call event.Skip() to allow the default processing to take place as otherwise
1550 the window under mouse wouldn't get the focus.
1551 @event{EVT_LEFT_UP(func)}
1552 Process a wxEVT_LEFT_UP event.
1553 @event{EVT_LEFT_DCLICK(func)}
1554 Process a wxEVT_LEFT_DCLICK event.
1555 @event{EVT_MIDDLE_DOWN(func)}
1556 Process a wxEVT_MIDDLE_DOWN event.
1557 @event{EVT_MIDDLE_UP(func)}
1558 Process a wxEVT_MIDDLE_UP event.
1559 @event{EVT_MIDDLE_DCLICK(func)}
1560 Process a wxEVT_MIDDLE_DCLICK event.
1561 @event{EVT_RIGHT_DOWN(func)}
1562 Process a wxEVT_RIGHT_DOWN event.
1563 @event{EVT_RIGHT_UP(func)}
1564 Process a wxEVT_RIGHT_UP event.
1565 @event{EVT_RIGHT_DCLICK(func)}
1566 Process a wxEVT_RIGHT_DCLICK event.
1567 @event{EVT_MOUSE_AUX1_DOWN(func)}
1568 Process a wxEVT_MOUSE_AUX1_DOWN event.
1569 @event{EVT_MOUSE_AUX1_UP(func)}
1570 Process a wxEVT_MOUSE_AUX1_UP event.
1571 @event{EVT_MOUSE_AUX1_DCLICK(func)}
1572 Process a wxEVT_MOUSE_AUX1_DCLICK event.
1573 @event{EVT_MOUSE_AUX2_DOWN(func)}
1574 Process a wxEVT_MOUSE_AUX2_DOWN event.
1575 @event{EVT_MOUSE_AUX2_UP(func)}
1576 Process a wxEVT_MOUSE_AUX2_UP event.
1577 @event{EVT_MOUSE_AUX2_DCLICK(func)}
1578 Process a wxEVT_MOUSE_AUX2_DCLICK event.
1579 @event{EVT_MOTION(func)}
1580 Process a wxEVT_MOTION event.
1581 @event{EVT_ENTER_WINDOW(func)}
1582 Process a wxEVT_ENTER_WINDOW event.
1583 @event{EVT_LEAVE_WINDOW(func)}
1584 Process a wxEVT_LEAVE_WINDOW event.
1585 @event{EVT_MOUSEWHEEL(func)}
1586 Process a wxEVT_MOUSEWHEEL event.
1587 @event{EVT_MOUSE_EVENTS(func)}
1588 Process all mouse events.
1596 class wxMouseEvent
: public wxEvent
,
1601 Constructor. Valid event types are:
1603 @li wxEVT_ENTER_WINDOW
1604 @li wxEVT_LEAVE_WINDOW
1607 @li wxEVT_LEFT_DCLICK
1608 @li wxEVT_MIDDLE_DOWN
1610 @li wxEVT_MIDDLE_DCLICK
1611 @li wxEVT_RIGHT_DOWN
1613 @li wxEVT_RIGHT_DCLICK
1614 @li wxEVT_MOUSE_AUX1_DOWN
1615 @li wxEVT_MOUSE_AUX1_UP
1616 @li wxEVT_MOUSE_AUX1_DCLICK
1617 @li wxEVT_MOUSE_AUX2_DOWN
1618 @li wxEVT_MOUSE_AUX2_UP
1619 @li wxEVT_MOUSE_AUX2_DCLICK
1621 @li wxEVT_MOUSEWHEEL
1623 wxMouseEvent(wxEventType mouseEventType
= wxEVT_NULL
);
1626 Returns @true if the event was a first extra button double click.
1628 bool Aux1DClick() const;
1631 Returns @true if the first extra button mouse button changed to down.
1633 bool Aux1Down() const;
1636 Returns @true if the first extra button mouse button is currently down,
1637 independent of the current event type.
1639 bool Aux1IsDown() const;
1642 Returns @true if the first extra button mouse button changed to up.
1644 bool Aux1Up() const;
1647 Returns @true if the event was a second extra button double click.
1649 bool Aux2DClick() const;
1652 Returns @true if the second extra button mouse button changed to down.
1654 bool Aux2Down() const;
1657 Returns @true if the second extra button mouse button is currently down,
1658 independent of the current event type.
1660 bool Aux2IsDown() const;
1663 Returns @true if the second extra button mouse button changed to up.
1665 bool Aux2Up() const;
1668 Returns @true if the identified mouse button is changing state.
1669 Valid values of @a button are:
1671 @li @c wxMOUSE_BTN_LEFT: check if left button was pressed
1672 @li @c wxMOUSE_BTN_MIDDLE: check if middle button was pressed
1673 @li @c wxMOUSE_BTN_RIGHT: check if right button was pressed
1674 @li @c wxMOUSE_BTN_AUX1: check if the first extra button was pressed
1675 @li @c wxMOUSE_BTN_AUX2: check if the second extra button was pressed
1676 @li @c wxMOUSE_BTN_ANY: check if any button was pressed
1678 @todo introduce wxMouseButton enum
1680 bool Button(int button
) const;
1683 If the argument is omitted, this returns @true if the event was a mouse
1684 double click event. Otherwise the argument specifies which double click event
1685 was generated (see Button() for the possible values).
1687 bool ButtonDClick(int but
= wxMOUSE_BTN_ANY
) const;
1690 If the argument is omitted, this returns @true if the event was a mouse
1691 button down event. Otherwise the argument specifies which button-down event
1692 was generated (see Button() for the possible values).
1694 bool ButtonDown(int = wxMOUSE_BTN_ANY
) const;
1697 If the argument is omitted, this returns @true if the event was a mouse
1698 button up event. Otherwise the argument specifies which button-up event
1699 was generated (see Button() for the possible values).
1701 bool ButtonUp(int = wxMOUSE_BTN_ANY
) const;
1704 Returns @true if this was a dragging event (motion while a button is depressed).
1708 bool Dragging() const;
1711 Returns @true if the mouse was entering the window.
1715 bool Entering() const;
1718 Returns the mouse button which generated this event or @c wxMOUSE_BTN_NONE
1719 if no button is involved (for mouse move, enter or leave event, for example).
1720 Otherwise @c wxMOUSE_BTN_LEFT is returned for the left button down, up and
1721 double click events, @c wxMOUSE_BTN_MIDDLE and @c wxMOUSE_BTN_RIGHT
1722 for the same events for the middle and the right buttons respectively.
1724 int GetButton() const;
1727 Returns the number of mouse clicks for this event: 1 for a simple click, 2
1728 for a double-click, 3 for a triple-click and so on.
1730 Currently this function is implemented only in wxMac and returns -1 for the
1731 other platforms (you can still distinguish simple clicks from double-clicks as
1732 they generate different kinds of events however).
1736 int GetClickCount() const;
1739 Returns the configured number of lines (or whatever) to be scrolled per
1740 wheel action. Defaults to three.
1742 int GetLinesPerAction() const;
1745 Returns the logical mouse position in pixels (i.e. translated according to the
1746 translation set for the DC, which usually indicates that the window has been
1749 wxPoint
GetLogicalPosition(const wxDC
& dc
) const;
1753 Sets *x and *y to the position at which the event occurred.
1754 Returns the physical mouse position in pixels.
1756 Note that if the mouse event has been artificially generated from a special
1757 keyboard combination (e.g. under Windows when the "menu" key is pressed), the
1758 returned position is ::wxDefaultPosition.
1760 wxPoint
GetPosition() const;
1761 void GetPosition(wxCoord
* x
, wxCoord
* y
) const;
1762 void GetPosition(long* x
, long* y
) const;
1766 Get wheel delta, normally 120.
1768 This is the threshold for action to be taken, and one such action
1769 (for example, scrolling one increment) should occur for each delta.
1771 int GetWheelDelta() const;
1774 Get wheel rotation, positive or negative indicates direction of rotation.
1776 Current devices all send an event when rotation is at least +/-WheelDelta, but
1777 finer resolution devices can be created in the future.
1779 Because of this you shouldn't assume that one event is equal to 1 line, but you
1780 should be able to either do partial line scrolling or wait until several
1781 events accumulate before scrolling.
1783 int GetWheelRotation() const;
1786 Gets the axis the wheel operation concerns; @c 0 is the Y axis as on
1787 most mouse wheels, @c 1 is the X axis.
1789 Note that only some models of mouse have horizontal wheel axis.
1791 int GetWheelAxis() const;
1794 Returns X coordinate of the physical mouse event position.
1796 wxCoord
GetX() const;
1799 Returns Y coordinate of the physical mouse event position.
1801 wxCoord
GetY() const;
1804 Returns @true if the event was a mouse button event (not necessarily a button
1805 down event - that may be tested using ButtonDown()).
1807 bool IsButton() const;
1810 Returns @true if the system has been setup to do page scrolling with
1811 the mouse wheel instead of line scrolling.
1813 bool IsPageScroll() const;
1816 Returns @true if the mouse was leaving the window.
1820 bool Leaving() const;
1823 Returns @true if the event was a left double click.
1825 bool LeftDClick() const;
1828 Returns @true if the left mouse button changed to down.
1830 bool LeftDown() const;
1833 Returns @true if the left mouse button is currently down, independent
1834 of the current event type.
1836 Please notice that it is not the same as LeftDown() which returns @true if the
1837 event was generated by the left mouse button being pressed. Rather, it simply
1838 describes the state of the left mouse button at the time when the event was
1839 generated (so while it will be @true for a left click event, it can also be @true
1840 for a right click if it happened while the left mouse button was pressed).
1842 This event is usually used in the mouse event handlers which process "move
1843 mouse" messages to determine whether the user is (still) dragging the mouse.
1845 bool LeftIsDown() const;
1848 Returns @true if the left mouse button changed to up.
1850 bool LeftUp() const;
1853 Returns @true if the Meta key was down at the time of the event.
1855 bool MetaDown() const;
1858 Returns @true if the event was a middle double click.
1860 bool MiddleDClick() const;
1863 Returns @true if the middle mouse button changed to down.
1865 bool MiddleDown() const;
1868 Returns @true if the middle mouse button is currently down, independent
1869 of the current event type.
1871 bool MiddleIsDown() const;
1874 Returns @true if the middle mouse button changed to up.
1876 bool MiddleUp() const;
1879 Returns @true if this was a motion event and no mouse buttons were pressed.
1880 If any mouse button is held pressed, then this method returns @false and
1881 Dragging() returns @true.
1883 bool Moving() const;
1886 Returns @true if the event was a right double click.
1888 bool RightDClick() const;
1891 Returns @true if the right mouse button changed to down.
1893 bool RightDown() const;
1896 Returns @true if the right mouse button is currently down, independent
1897 of the current event type.
1899 bool RightIsDown() const;
1902 Returns @true if the right mouse button changed to up.
1904 bool RightUp() const;
1910 @class wxDropFilesEvent
1912 This class is used for drop files events, that is, when files have been dropped
1913 onto the window. This functionality is currently only available under Windows.
1915 The window must have previously been enabled for dropping by calling
1916 wxWindow::DragAcceptFiles().
1918 Important note: this is a separate implementation to the more general drag and drop
1919 implementation documented in the @ref overview_dnd. It uses the older, Windows
1920 message-based approach of dropping files.
1922 @beginEventTable{wxDropFilesEvent}
1923 @event{EVT_DROP_FILES(func)}
1924 Process a wxEVT_DROP_FILES event.
1932 @see @ref overview_eventhandling
1934 class wxDropFilesEvent
: public wxEvent
1940 wxDropFilesEvent(wxEventType id
= 0, int noFiles
= 0,
1941 wxString
* files
= NULL
);
1944 Returns an array of filenames.
1946 wxString
* GetFiles() const;
1949 Returns the number of files dropped.
1951 int GetNumberOfFiles() const;
1954 Returns the position at which the files were dropped.
1955 Returns an array of filenames.
1957 wxPoint
GetPosition() const;
1963 @class wxCommandEvent
1965 This event class contains information about command events, which originate
1966 from a variety of simple controls.
1968 More complex controls, such as wxTreeCtrl, have separate command event classes.
1970 @beginEventTable{wxCommandEvent}
1971 @event{EVT_COMMAND(id, event, func)}
1972 Process a command, supplying the window identifier, command event identifier,
1973 and member function.
1974 @event{EVT_COMMAND_RANGE(id1, id2, event, func)}
1975 Process a command for a range of window identifiers, supplying the minimum and
1976 maximum window identifiers, command event identifier, and member function.
1977 @event{EVT_BUTTON(id, func)}
1978 Process a @c wxEVT_COMMAND_BUTTON_CLICKED command, which is generated by a wxButton control.
1979 @event{EVT_CHECKBOX(id, func)}
1980 Process a @c wxEVT_COMMAND_CHECKBOX_CLICKED command, which is generated by a wxCheckBox control.
1981 @event{EVT_CHOICE(id, func)}
1982 Process a @c wxEVT_COMMAND_CHOICE_SELECTED command, which is generated by a wxChoice control.
1983 @event{EVT_COMBOBOX(id, func)}
1984 Process a @c wxEVT_COMMAND_COMBOBOX_SELECTED command, which is generated by a wxComboBox control.
1985 @event{EVT_LISTBOX(id, func)}
1986 Process a @c wxEVT_COMMAND_LISTBOX_SELECTED command, which is generated by a wxListBox control.
1987 @event{EVT_LISTBOX_DCLICK(id, func)}
1988 Process a @c wxEVT_COMMAND_LISTBOX_DOUBLECLICKED command, which is generated by a wxListBox control.
1989 @event{EVT_CHECKLISTBOX(id, func)}
1990 Process a @c wxEVT_COMMAND_CHECKLISTBOX_TOGGLED command, which is generated by a wxCheckListBox control.
1991 @event{EVT_MENU(id, func)}
1992 Process a @c wxEVT_COMMAND_MENU_SELECTED command, which is generated by a menu item.
1993 @event{EVT_MENU_RANGE(id1, id2, func)}
1994 Process a @c wxEVT_COMMAND_MENU_RANGE command, which is generated by a range of menu items.
1995 @event{EVT_CONTEXT_MENU(func)}
1996 Process the event generated when the user has requested a popup menu to appear by
1997 pressing a special keyboard key (under Windows) or by right clicking the mouse.
1998 @event{EVT_RADIOBOX(id, func)}
1999 Process a @c wxEVT_COMMAND_RADIOBOX_SELECTED command, which is generated by a wxRadioBox control.
2000 @event{EVT_RADIOBUTTON(id, func)}
2001 Process a @c wxEVT_COMMAND_RADIOBUTTON_SELECTED command, which is generated by a wxRadioButton control.
2002 @event{EVT_SCROLLBAR(id, func)}
2003 Process a @c wxEVT_COMMAND_SCROLLBAR_UPDATED command, which is generated by a wxScrollBar
2004 control. This is provided for compatibility only; more specific scrollbar event macros
2005 should be used instead (see wxScrollEvent).
2006 @event{EVT_SLIDER(id, func)}
2007 Process a @c wxEVT_COMMAND_SLIDER_UPDATED command, which is generated by a wxSlider control.
2008 @event{EVT_TEXT(id, func)}
2009 Process a @c wxEVT_COMMAND_TEXT_UPDATED command, which is generated by a wxTextCtrl control.
2010 @event{EVT_TEXT_ENTER(id, func)}
2011 Process a @c wxEVT_COMMAND_TEXT_ENTER command, which is generated by a wxTextCtrl control.
2012 Note that you must use wxTE_PROCESS_ENTER flag when creating the control if you want it
2013 to generate such events.
2014 @event{EVT_TEXT_MAXLEN(id, func)}
2015 Process a @c wxEVT_COMMAND_TEXT_MAXLEN command, which is generated by a wxTextCtrl control
2016 when the user tries to enter more characters into it than the limit previously set
2017 with SetMaxLength().
2018 @event{EVT_TOGGLEBUTTON(id, func)}
2019 Process a @c wxEVT_COMMAND_TOGGLEBUTTON_CLICKED event.
2020 @event{EVT_TOOL(id, func)}
2021 Process a @c wxEVT_COMMAND_TOOL_CLICKED event (a synonym for @c wxEVT_COMMAND_MENU_SELECTED).
2022 Pass the id of the tool.
2023 @event{EVT_TOOL_RANGE(id1, id2, func)}
2024 Process a @c wxEVT_COMMAND_TOOL_CLICKED event for a range of identifiers. Pass the ids of the tools.
2025 @event{EVT_TOOL_RCLICKED(id, func)}
2026 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event. Pass the id of the tool.
2027 @event{EVT_TOOL_RCLICKED_RANGE(id1, id2, func)}
2028 Process a @c wxEVT_COMMAND_TOOL_RCLICKED event for a range of ids. Pass the ids of the tools.
2029 @event{EVT_TOOL_ENTER(id, func)}
2030 Process a @c wxEVT_COMMAND_TOOL_ENTER event. Pass the id of the toolbar itself.
2031 The value of wxCommandEvent::GetSelection() is the tool id, or -1 if the mouse cursor
2032 has moved off a tool.
2033 @event{EVT_COMMAND_LEFT_CLICK(id, func)}
2034 Process a @c wxEVT_COMMAND_LEFT_CLICK command, which is generated by a control (wxMSW only).
2035 @event{EVT_COMMAND_LEFT_DCLICK(id, func)}
2036 Process a @c wxEVT_COMMAND_LEFT_DCLICK command, which is generated by a control (wxMSW only).
2037 @event{EVT_COMMAND_RIGHT_CLICK(id, func)}
2038 Process a @c wxEVT_COMMAND_RIGHT_CLICK command, which is generated by a control (wxMSW only).
2039 @event{EVT_COMMAND_SET_FOCUS(id, func)}
2040 Process a @c wxEVT_COMMAND_SET_FOCUS command, which is generated by a control (wxMSW only).
2041 @event{EVT_COMMAND_KILL_FOCUS(id, func)}
2042 Process a @c wxEVT_COMMAND_KILL_FOCUS command, which is generated by a control (wxMSW only).
2043 @event{EVT_COMMAND_ENTER(id, func)}
2044 Process a @c wxEVT_COMMAND_ENTER command, which is generated by a control.
2050 class wxCommandEvent
: public wxEvent
2056 wxCommandEvent(wxEventType commandEventType
= wxEVT_NULL
, int id
= 0);
2059 Returns client data pointer for a listbox or choice selection event
2060 (not valid for a deselection).
2062 void* GetClientData() const;
2065 Returns client object pointer for a listbox or choice selection event
2066 (not valid for a deselection).
2068 wxClientData
* GetClientObject() const;
2071 Returns extra information dependant on the event objects type.
2073 If the event comes from a listbox selection, it is a boolean
2074 determining whether the event was a selection (@true) or a
2075 deselection (@false). A listbox deselection only occurs for
2076 multiple-selection boxes, and in this case the index and string values
2077 are indeterminate and the listbox must be examined by the application.
2079 long GetExtraLong() const;
2082 Returns the integer identifier corresponding to a listbox, choice or
2083 radiobox selection (only if the event was a selection, not a deselection),
2084 or a boolean value representing the value of a checkbox.
2089 Returns item index for a listbox or choice selection event (not valid for
2092 int GetSelection() const;
2095 Returns item string for a listbox or choice selection event. If one
2096 or several items have been deselected, returns the index of the first
2097 deselected item. If some items have been selected and others deselected
2098 at the same time, it will return the index of the first selected item.
2100 wxString
GetString() const;
2103 This method can be used with checkbox and menu events: for the checkboxes, the
2104 method returns @true for a selection event and @false for a deselection one.
2105 For the menu events, this method indicates if the menu item just has become
2106 checked or unchecked (and thus only makes sense for checkable menu items).
2108 Notice that this method can not be used with wxCheckListBox currently.
2110 bool IsChecked() const;
2113 For a listbox or similar event, returns @true if it is a selection, @false
2114 if it is a deselection. If some items have been selected and others deselected
2115 at the same time, it will return @true.
2117 bool IsSelection() const;
2120 Sets the client data for this event.
2122 void SetClientData(void* clientData
);
2125 Sets the client object for this event. The client object is not owned by the
2126 event object and the event object will not delete the client object in its destructor.
2128 The client object must be owned and deleted by another object (e.g. a control)
2129 that has longer life time than the event object.
2131 void SetClientObject(wxClientData
* clientObject
);
2134 Sets the @b m_extraLong member.
2136 void SetExtraLong(long extraLong
);
2139 Sets the @b m_commandInt member.
2141 void SetInt(int intCommand
);
2144 Sets the @b m_commandString member.
2146 void SetString(const wxString
& string
);
2152 @class wxActivateEvent
2154 An activate event is sent when a window or application is being activated
2157 @beginEventTable{wxActivateEvent}
2158 @event{EVT_ACTIVATE(func)}
2159 Process a wxEVT_ACTIVATE event.
2160 @event{EVT_ACTIVATE_APP(func)}
2161 Process a wxEVT_ACTIVATE_APP event.
2162 @event{EVT_HIBERNATE(func)}
2163 Process a hibernate event, supplying the member function. This event applies
2164 to wxApp only, and only on Windows SmartPhone and PocketPC.
2165 It is generated when the system is low on memory; the application should free
2166 up as much memory as possible, and restore full working state when it receives
2167 a wxEVT_ACTIVATE or wxEVT_ACTIVATE_APP event.
2174 @see @ref overview_eventhandling, wxApp::IsActive
2176 class wxActivateEvent
: public wxEvent
2182 wxActivateEvent(wxEventType eventType
= wxEVT_NULL
, bool active
= true,
2186 Returns @true if the application or window is being activated, @false otherwise.
2188 bool GetActive() const;
2194 @class wxContextMenuEvent
2196 This class is used for context menu events, sent to give
2197 the application a chance to show a context (popup) menu.
2199 Note that if wxContextMenuEvent::GetPosition returns wxDefaultPosition, this
2200 means that the event originated from a keyboard context button event, and you
2201 should compute a suitable position yourself, for example by calling wxGetMousePosition().
2203 When a keyboard context menu button is pressed on Windows, a right-click event
2204 with default position is sent first, and if this event is not processed, the
2205 context menu event is sent. So if you process mouse events and you find your
2206 context menu event handler is not being called, you could call wxEvent::Skip()
2207 for mouse right-down events.
2209 @beginEventTable{wxContextMenuEvent}
2210 @event{EVT_CONTEXT_MENU(func)}
2211 A right click (or other context menu command depending on platform) has been detected.
2218 @see wxCommandEvent, @ref overview_eventhandling
2220 class wxContextMenuEvent
: public wxCommandEvent
2226 wxContextMenuEvent(wxEventType id
= wxEVT_NULL
, int id
= 0,
2227 const wxPoint
& pos
= wxDefaultPosition
);
2230 Returns the position in screen coordinates at which the menu should be shown.
2231 Use wxWindow::ScreenToClient to convert to client coordinates.
2233 You can also omit a position from wxWindow::PopupMenu in order to use
2234 the current mouse pointer position.
2236 If the event originated from a keyboard event, the value returned from this
2237 function will be wxDefaultPosition.
2239 const wxPoint
& GetPosition() const;
2242 Sets the position at which the menu should be shown.
2244 void SetPosition(const wxPoint
& point
);
2252 An erase event is sent when a window's background needs to be repainted.
2254 On some platforms, such as GTK+, this event is simulated (simply generated just
2255 before the paint event) and may cause flicker. It is therefore recommended that
2256 you set the text background colour explicitly in order to prevent flicker.
2257 The default background colour under GTK+ is grey.
2259 To intercept this event, use the EVT_ERASE_BACKGROUND macro in an event table
2262 You must call wxEraseEvent::GetDC and use the returned device context if it is
2263 non-@NULL. If it is @NULL, create your own temporary wxClientDC object.
2266 Use the device context returned by GetDC to draw on, don't create
2267 a wxPaintDC in the event handler.
2269 @beginEventTable{wxEraseEvent}
2270 @event{EVT_ERASE_BACKGROUND(func)}
2271 Process a wxEVT_ERASE_BACKGROUND event.
2277 @see @ref overview_eventhandling
2279 class wxEraseEvent
: public wxEvent
2285 wxEraseEvent(int id
= 0, wxDC
* dc
= NULL
);
2288 Returns the device context associated with the erase event to draw on.
2290 wxDC
* GetDC() const;
2298 A focus event is sent when a window's focus changes. The window losing focus
2299 receives a "kill focus" event while the window gaining it gets a "set focus" one.
2301 Notice that the set focus event happens both when the user gives focus to the
2302 window (whether using the mouse or keyboard) and when it is done from the
2303 program itself using wxWindow::SetFocus.
2305 @beginEventTable{wxFocusEvent}
2306 @event{EVT_SET_FOCUS(func)}
2307 Process a wxEVT_SET_FOCUS event.
2308 @event{EVT_KILL_FOCUS(func)}
2309 Process a wxEVT_KILL_FOCUS event.
2315 @see @ref overview_eventhandling
2317 class wxFocusEvent
: public wxEvent
2323 wxFocusEvent(wxEventType eventType
= wxEVT_NULL
, int id
= 0);
2326 Returns the window associated with this event, that is the window which had the
2327 focus before for the @c wxEVT_SET_FOCUS event and the window which is
2328 going to receive focus for the @c wxEVT_KILL_FOCUS one.
2330 Warning: the window pointer may be @NULL!
2332 wxWindow
*GetWindow() const;
2338 @class wxChildFocusEvent
2340 A child focus event is sent to a (parent-)window when one of its child windows
2341 gains focus, so that the window could restore the focus back to its corresponding
2342 child if it loses it now and regains later.
2344 Notice that child window is the direct child of the window receiving event.
2345 Use wxWindow::FindFocus() to retreive the window which is actually getting focus.
2347 @beginEventTable{wxChildFocusEvent}
2348 @event{EVT_CHILD_FOCUS(func)}
2349 Process a wxEVT_CHILD_FOCUS event.
2355 @see @ref overview_eventhandling
2357 class wxChildFocusEvent
: public wxCommandEvent
2364 The direct child which is (or which contains the window which is) receiving
2367 wxChildFocusEvent(wxWindow
* win
= NULL
);
2370 Returns the direct child which receives the focus, or a (grand-)parent of the
2371 control receiving the focus.
2373 To get the actually focused control use wxWindow::FindFocus.
2375 wxWindow
*GetWindow() const;
2381 @class wxMouseCaptureLostEvent
2383 An mouse capture lost event is sent to a window that obtained mouse capture,
2384 which was subsequently loss due to "external" event, for example when a dialog
2385 box is shown or if another application captures the mouse.
2387 If this happens, this event is sent to all windows that are on capture stack
2388 (i.e. called CaptureMouse, but didn't call ReleaseMouse yet). The event is
2389 not sent if the capture changes because of a call to CaptureMouse or
2392 This event is currently emitted under Windows only.
2394 @beginEventTable{wxMouseCaptureLostEvent}
2395 @event{EVT_MOUSE_CAPTURE_LOST(func)}
2396 Process a wxEVT_MOUSE_CAPTURE_LOST event.
2404 @see wxMouseCaptureChangedEvent, @ref overview_eventhandling,
2405 wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
2407 class wxMouseCaptureLostEvent
: public wxEvent
2413 wxMouseCaptureLostEvent(wxWindowID windowId
= 0);
2419 @class wxNotifyEvent
2421 This class is not used by the event handlers by itself, but is a base class
2422 for other event classes (such as wxBookCtrlEvent).
2424 It (or an object of a derived class) is sent when the controls state is being
2425 changed and allows the program to wxNotifyEvent::Veto() this change if it wants
2426 to prevent it from happening.
2431 @see wxBookCtrlEvent
2433 class wxNotifyEvent
: public wxCommandEvent
2437 Constructor (used internally by wxWidgets only).
2439 wxNotifyEvent(wxEventType eventType
= wxEVT_NULL
, int id
= 0);
2442 This is the opposite of Veto(): it explicitly allows the event to be processed.
2443 For most events it is not necessary to call this method as the events are allowed
2444 anyhow but some are forbidden by default (this will be mentioned in the corresponding
2450 Returns @true if the change is allowed (Veto() hasn't been called) or @false
2451 otherwise (if it was).
2453 bool IsAllowed() const;
2456 Prevents the change announced by this event from happening.
2458 It is in general a good idea to notify the user about the reasons for vetoing
2459 the change because otherwise the applications behaviour (which just refuses to
2460 do what the user wants) might be quite surprising.
2468 enum wxHelpEventOrigin
2470 wxHE_ORIGIN_UNKNOWN
= -1,
2471 wxHE_ORIGIN_KEYBOARD
,
2473 /** event generated by wxContextHelp or from the [?] button on
2474 the title bar (Windows). */
2475 wxHE_ORIGIN_HELPBUTTON
2481 A help event is sent when the user has requested context-sensitive help.
2482 This can either be caused by the application requesting context-sensitive help mode
2483 via wxContextHelp, or (on MS Windows) by the system generating a WM_HELP message when
2484 the user pressed F1 or clicked on the query button in a dialog caption.
2486 A help event is sent to the window that the user clicked on, and is propagated
2487 up the window hierarchy until the event is processed or there are no more event
2490 The application should call wxEvent::GetId to check the identity of the
2491 clicked-on window, and then either show some suitable help or call wxEvent::Skip()
2492 if the identifier is unrecognised.
2494 Calling Skip is important because it allows wxWidgets to generate further
2495 events for ancestors of the clicked-on window. Otherwise it would be impossible to
2496 show help for container windows, since processing would stop after the first window
2499 @beginEventTable{wxHelpEvent}
2500 @event{EVT_HELP(id, func)}
2501 Process a wxEVT_HELP event.
2502 @event{EVT_HELP_RANGE(id1, id2, func)}
2503 Process a wxEVT_HELP event for a range of ids.
2509 @see wxContextHelp, wxDialog, @ref overview_eventhandling
2511 class wxHelpEvent
: public wxCommandEvent
2515 Indicates how a wxHelpEvent was generated.
2519 Origin_Unknown
, /**< unrecognized event source. */
2520 Origin_Keyboard
, /**< event generated from F1 key press. */
2522 /** event generated by wxContextHelp or from the [?] button on
2523 the title bar (Windows). */
2530 wxHelpEvent(wxEventType type
= wxEVT_NULL
,
2531 wxWindowID winid
= 0,
2532 const wxPoint
& pt
= wxDefaultPosition
,
2533 wxHelpEvent::Origin origin
= Origin_Unknown
);
2536 Returns the origin of the help event which is one of the ::wxHelpEventOrigin
2539 The application may handle events generated using the keyboard or mouse
2540 differently, e.g. by using wxGetMousePosition() for the mouse events.
2544 wxHelpEvent::Origin
GetOrigin() const;
2547 Returns the left-click position of the mouse, in screen coordinates.
2548 This allows the application to position the help appropriately.
2550 const wxPoint
& GetPosition() const;
2553 Set the help event origin, only used internally by wxWidgets normally.
2557 void SetOrigin(wxHelpEvent::Origin origin
);
2560 Sets the left-click position of the mouse, in screen coordinates.
2562 void SetPosition(const wxPoint
& pt
);
2568 @class wxScrollEvent
2570 A scroll event holds information about events sent from stand-alone
2571 scrollbars (see wxScrollBar) and sliders (see wxSlider).
2573 Note that scrolled windows send the wxScrollWinEvent which does not derive from
2574 wxCommandEvent, but from wxEvent directly - don't confuse these two kinds of
2575 events and use the event table macros mentioned below only for the scrollbar-like
2578 @section scrollevent_diff The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED
2580 The EVT_SCROLL_THUMBRELEASE event is only emitted when actually dragging the thumb
2581 using the mouse and releasing it (This EVT_SCROLL_THUMBRELEASE event is also followed
2582 by an EVT_SCROLL_CHANGED event).
2584 The EVT_SCROLL_CHANGED event also occurs when using the keyboard to change the thumb
2585 position, and when clicking next to the thumb (In all these cases the EVT_SCROLL_THUMBRELEASE
2586 event does not happen).
2588 In short, the EVT_SCROLL_CHANGED event is triggered when scrolling/ moving has finished
2589 independently of the way it had started. Please see the widgets sample ("Slider" page)
2590 to see the difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED in action.
2593 Note that unless specifying a scroll control identifier, you will need to test for scrollbar
2594 orientation with wxScrollEvent::GetOrientation, since horizontal and vertical scroll events
2595 are processed using the same event handler.
2597 @beginEventTable{wxScrollEvent}
2598 You can use EVT_COMMAND_SCROLL... macros with window IDs for when intercepting
2599 scroll events from controls, or EVT_SCROLL... macros without window IDs for
2600 intercepting scroll events from the receiving window -- except for this, the
2601 macros behave exactly the same.
2602 @event{EVT_SCROLL(func)}
2603 Process all scroll events.
2604 @event{EVT_SCROLL_TOP(func)}
2605 Process wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
2606 @event{EVT_SCROLL_BOTTOM(func)}
2607 Process wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
2608 @event{EVT_SCROLL_LINEUP(func)}
2609 Process wxEVT_SCROLL_LINEUP line up events.
2610 @event{EVT_SCROLL_LINEDOWN(func)}
2611 Process wxEVT_SCROLL_LINEDOWN line down events.
2612 @event{EVT_SCROLL_PAGEUP(func)}
2613 Process wxEVT_SCROLL_PAGEUP page up events.
2614 @event{EVT_SCROLL_PAGEDOWN(func)}
2615 Process wxEVT_SCROLL_PAGEDOWN page down events.
2616 @event{EVT_SCROLL_THUMBTRACK(func)}
2617 Process wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent as the
2618 user drags the thumbtrack).
2619 @event{EVT_SCROLL_THUMBRELEASE(func)}
2620 Process wxEVT_SCROLL_THUMBRELEASE thumb release events.
2621 @event{EVT_SCROLL_CHANGED(func)}
2622 Process wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).
2623 @event{EVT_COMMAND_SCROLL(id, func)}
2624 Process all scroll events.
2625 @event{EVT_COMMAND_SCROLL_TOP(id, func)}
2626 Process wxEVT_SCROLL_TOP scroll-to-top events (minimum position).
2627 @event{EVT_COMMAND_SCROLL_BOTTOM(id, func)}
2628 Process wxEVT_SCROLL_BOTTOM scroll-to-bottom events (maximum position).
2629 @event{EVT_COMMAND_SCROLL_LINEUP(id, func)}
2630 Process wxEVT_SCROLL_LINEUP line up events.
2631 @event{EVT_COMMAND_SCROLL_LINEDOWN(id, func)}
2632 Process wxEVT_SCROLL_LINEDOWN line down events.
2633 @event{EVT_COMMAND_SCROLL_PAGEUP(id, func)}
2634 Process wxEVT_SCROLL_PAGEUP page up events.
2635 @event{EVT_COMMAND_SCROLL_PAGEDOWN(id, func)}
2636 Process wxEVT_SCROLL_PAGEDOWN page down events.
2637 @event{EVT_COMMAND_SCROLL_THUMBTRACK(id, func)}
2638 Process wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent
2639 as the user drags the thumbtrack).
2640 @event{EVT_COMMAND_SCROLL_THUMBRELEASE(func)}
2641 Process wxEVT_SCROLL_THUMBRELEASE thumb release events.
2642 @event{EVT_COMMAND_SCROLL_CHANGED(func)}
2643 Process wxEVT_SCROLL_CHANGED end of scrolling events (MSW only).
2649 @see wxScrollBar, wxSlider, wxSpinButton, wxScrollWinEvent, @ref overview_eventhandling
2651 class wxScrollEvent
: public wxCommandEvent
2657 wxScrollEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0, int pos
= 0,
2658 int orientation
= 0);
2661 Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the
2664 int GetOrientation() const;
2667 Returns the position of the scrollbar.
2669 int GetPosition() const;
2673 See wxIdleEvent::SetMode() for more info.
2677 /** Send idle events to all windows */
2680 /** Send idle events to windows that have the wxWS_EX_PROCESS_IDLE flag specified */
2681 wxIDLE_PROCESS_SPECIFIED
2688 This class is used for idle events, which are generated when the system becomes
2689 idle. Note that, unless you do something specifically, the idle events are not
2690 sent if the system remains idle once it has become it, e.g. only a single idle
2691 event will be generated until something else resulting in more normal events
2692 happens and only then is the next idle event sent again.
2694 If you need to ensure a continuous stream of idle events, you can either use
2695 wxIdleEvent::RequestMore method in your handler or call wxWakeUpIdle() periodically
2696 (for example from a timer event handler), but note that both of these approaches
2697 (and especially the first one) increase the system load and so should be avoided
2700 By default, idle events are sent to all windows (and also wxApp, as usual).
2701 If this is causing a significant overhead in your application, you can call
2702 wxIdleEvent::SetMode with the value wxIDLE_PROCESS_SPECIFIED, and set the
2703 wxWS_EX_PROCESS_IDLE extra window style for every window which should receive
2706 @beginEventTable{wxIdleEvent}
2707 @event{EVT_IDLE(func)}
2708 Process a wxEVT_IDLE event.
2714 @see @ref overview_eventhandling, wxUpdateUIEvent, wxWindow::OnInternalIdle
2716 class wxIdleEvent
: public wxEvent
2725 Returns @true if it is appropriate to send idle events to this window.
2727 This function looks at the mode used (see wxIdleEvent::SetMode),
2728 and the wxWS_EX_PROCESS_IDLE style in @a window to determine whether idle
2729 events should be sent to this window now.
2731 By default this will always return @true because the update mode is initially
2732 wxIDLE_PROCESS_ALL. You can change the mode to only send idle events to
2733 windows with the wxWS_EX_PROCESS_IDLE extra window style set.
2737 static bool CanSend(wxWindow
* window
);
2740 Static function returning a value specifying how wxWidgets will send idle
2741 events: to all windows, or only to those which specify that they
2742 will process the events.
2746 static wxIdleMode
GetMode();
2749 Returns @true if the OnIdle function processing this event requested more
2754 bool MoreRequested() const;
2757 Tells wxWidgets that more processing is required.
2759 This function can be called by an OnIdle handler for a window or window event
2760 handler to indicate that wxApp::OnIdle should forward the OnIdle event once
2761 more to the application windows.
2763 If no window calls this function during OnIdle, then the application will
2764 remain in a passive event loop (not calling OnIdle) until a new event is
2765 posted to the application by the windowing system.
2767 @see MoreRequested()
2769 void RequestMore(bool needMore
= true);
2772 Static function for specifying how wxWidgets will send idle events: to
2773 all windows, or only to those which specify that they will process the events.
2776 Can be one of the ::wxIdleMode values.
2777 The default is wxIDLE_PROCESS_ALL.
2779 static void SetMode(wxIdleMode mode
);
2785 @class wxInitDialogEvent
2787 A wxInitDialogEvent is sent as a dialog or panel is being initialised.
2788 Handlers for this event can transfer data to the window.
2790 The default handler calls wxWindow::TransferDataToWindow.
2792 @beginEventTable{wxInitDialogEvent}
2793 @event{EVT_INIT_DIALOG(func)}
2794 Process a wxEVT_INIT_DIALOG event.
2800 @see @ref overview_eventhandling
2802 class wxInitDialogEvent
: public wxEvent
2808 wxInitDialogEvent(int id
= 0);
2814 @class wxWindowDestroyEvent
2816 This event is sent as early as possible during the window destruction
2819 For the top level windows, as early as possible means that this is done by
2820 wxFrame or wxDialog destructor, i.e. after the destructor of the derived
2821 class was executed and so any methods specific to the derived class can't
2822 be called any more from this event handler. If you need to do this, you
2823 must call wxWindow::SendDestroyEvent() from your derived class destructor.
2825 For the child windows, this event is generated just before deleting the
2826 window from wxWindow::Destroy() (which is also called when the parent
2827 window is deleted) or from the window destructor if operator @c delete was
2828 used directly (which is not recommended for this very reason).
2830 It is usually pointless to handle this event in the window itself but it ca
2831 be very useful to receive notifications about the window destruction in the
2832 parent window or in any other object interested in this window.
2837 @see @ref overview_eventhandling, wxWindowCreateEvent
2839 class wxWindowDestroyEvent
: public wxCommandEvent
2845 wxWindowDestroyEvent(wxWindow
* win
= NULL
);
2847 /// Retutn the window being destroyed.
2848 wxWindow
*GetWindow() const;
2853 The possible flag values for a wxNavigationKeyEvent.
2855 enum wxNavigationKeyEventFlags
2857 wxNKEF_IS_BACKWARD
= 0x0000,
2858 wxNKEF_IS_FORWARD
= 0x0001,
2859 wxNKEF_WINCHANGE
= 0x0002,
2860 wxNKEF_FROMTAB
= 0x0004
2865 @class wxNavigationKeyEvent
2867 This event class contains information about navigation events,
2868 generated by navigation keys such as tab and page down.
2870 This event is mainly used by wxWidgets implementations.
2871 A wxNavigationKeyEvent handler is automatically provided by wxWidgets
2872 when you make a class into a control container with the macro
2873 WX_DECLARE_CONTROL_CONTAINER.
2875 @beginEventTable{wxNavigationKeyEvent}
2876 @event{EVT_NAVIGATION_KEY(func)}
2877 Process a navigation key event.
2883 @see wxWindow::Navigate, wxWindow::NavigateIn
2885 class wxNavigationKeyEvent
: public wxEvent
2888 wxNavigationKeyEvent();
2889 wxNavigationKeyEvent(const wxNavigationKeyEvent
& event
);
2892 Returns the child that has the focus, or @NULL.
2894 wxWindow
* GetCurrentFocus() const;
2897 Returns @true if the navigation was in the forward direction.
2899 bool GetDirection() const;
2902 Returns @true if the navigation event was from a tab key.
2903 This is required for proper navigation over radio buttons.
2905 bool IsFromTab() const;
2908 Returns @true if the navigation event represents a window change
2909 (for example, from Ctrl-Page Down in a notebook).
2911 bool IsWindowChange() const;
2914 Sets the current focus window member.
2916 void SetCurrentFocus(wxWindow
* currentFocus
);
2919 Sets the direction to forward if @a direction is @true, or backward
2922 void SetDirection(bool direction
);
2925 Sets the flags for this event.
2926 The @a flags can be a combination of the ::wxNavigationKeyEventFlags values.
2928 void SetFlags(long flags
);
2931 Marks the navigation event as from a tab key.
2933 void SetFromTab(bool fromTab
);
2936 Marks the event as a window change event.
2938 void SetWindowChange(bool windowChange
);
2944 @class wxMouseCaptureChangedEvent
2946 An mouse capture changed event is sent to a window that loses its
2947 mouse capture. This is called even if wxWindow::ReleaseCapture
2948 was called by the application code. Handling this event allows
2949 an application to cater for unexpected capture releases which
2950 might otherwise confuse mouse handling code.
2954 @beginEventTable{wxMouseCaptureChangedEvent}
2955 @event{EVT_MOUSE_CAPTURE_CHANGED(func)}
2956 Process a wxEVT_MOUSE_CAPTURE_CHANGED event.
2962 @see wxMouseCaptureLostEvent, @ref overview_eventhandling,
2963 wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
2965 class wxMouseCaptureChangedEvent
: public wxEvent
2971 wxMouseCaptureChangedEvent(wxWindowID windowId
= 0,
2972 wxWindow
* gainedCapture
= NULL
);
2975 Returns the window that gained the capture, or @NULL if it was a
2976 non-wxWidgets window.
2978 wxWindow
* GetCapturedWindow() const;
2986 This event class contains information about window and session close events.
2988 The handler function for EVT_CLOSE is called when the user has tried to close a
2989 a frame or dialog box using the window manager (X) or system menu (Windows).
2990 It can also be invoked by the application itself programmatically, for example by
2991 calling the wxWindow::Close function.
2993 You should check whether the application is forcing the deletion of the window
2994 using wxCloseEvent::CanVeto. If this is @false, you @e must destroy the window
2995 using wxWindow::Destroy.
2997 If the return value is @true, it is up to you whether you respond by destroying
3000 If you don't destroy the window, you should call wxCloseEvent::Veto to
3001 let the calling code know that you did not destroy the window.
3002 This allows the wxWindow::Close function to return @true or @false depending
3003 on whether the close instruction was honoured or not.
3005 Example of a wxCloseEvent handler:
3008 void MyFrame::OnClose(wxCloseEvent& event)
3010 if ( event.CanVeto() && m_bFileNotSaved )
3012 if ( wxMessageBox("The file has not been saved... continue closing?",
3014 wxICON_QUESTION | wxYES_NO) != wxYES )
3021 Destroy(); // you may also do: event.Skip();
3022 // since the default event handler does call Destroy(), too
3026 The EVT_END_SESSION event is slightly different as it is sent by the system
3027 when the user session is ending (e.g. because of log out or shutdown) and
3028 so all windows are being forcefully closed. At least under MSW, after the
3029 handler for this event is executed the program is simply killed by the
3030 system. Because of this, the default handler for this event provided by
3031 wxWidgets calls all the usual cleanup code (including wxApp::OnExit()) so
3032 that it could still be executed and exit()s the process itself, without
3033 waiting for being killed. If this behaviour is for some reason undesirable,
3034 make sure that you define a handler for this event in your wxApp-derived
3035 class and do not call @c event.Skip() in it (but be aware that the system
3036 will still kill your application).
3038 @beginEventTable{wxCloseEvent}
3039 @event{EVT_CLOSE(func)}
3040 Process a close event, supplying the member function.
3041 This event applies to wxFrame and wxDialog classes.
3042 @event{EVT_QUERY_END_SESSION(func)}
3043 Process a query end session event, supplying the member function.
3044 This event can be handled in wxApp-derived class only.
3045 @event{EVT_END_SESSION(func)}
3046 Process an end session event, supplying the member function.
3047 This event can be handled in wxApp-derived class only.
3053 @see wxWindow::Close, @ref overview_windowdeletion
3055 class wxCloseEvent
: public wxEvent
3061 wxCloseEvent(wxEventType commandEventType
= wxEVT_NULL
, int id
= 0);
3064 Returns @true if you can veto a system shutdown or a window close event.
3065 Vetoing a window close event is not possible if the calling code wishes to
3066 force the application to exit, and so this function must be called to check this.
3068 bool CanVeto() const;
3071 Returns @true if the user is just logging off or @false if the system is
3072 shutting down. This method can only be called for end session and query end
3073 session events, it doesn't make sense for close window event.
3075 bool GetLoggingOff() const;
3078 Sets the 'can veto' flag.
3080 void SetCanVeto(bool canVeto
);
3083 Sets the 'logging off' flag.
3085 void SetLoggingOff(bool loggingOff
);
3088 Call this from your event handler to veto a system shutdown or to signal
3089 to the calling application that a window close did not happen.
3091 You can only veto a shutdown if CanVeto() returns @true.
3093 void Veto(bool veto
= true);
3101 This class is used for a variety of menu-related events. Note that
3102 these do not include menu command events, which are
3103 handled using wxCommandEvent objects.
3105 The default handler for @c wxEVT_MENU_HIGHLIGHT displays help
3106 text in the first field of the status bar.
3108 @beginEventTable{wxMenuEvent}
3109 @event{EVT_MENU_OPEN(func)}
3110 A menu is about to be opened. On Windows, this is only sent once for each
3111 navigation of the menubar (up until all menus have closed).
3112 @event{EVT_MENU_CLOSE(func)}
3113 A menu has been just closed.
3114 @event{EVT_MENU_HIGHLIGHT(id, func)}
3115 The menu item with the specified id has been highlighted: used to show
3116 help prompts in the status bar by wxFrame
3117 @event{EVT_MENU_HIGHLIGHT_ALL(func)}
3118 A menu item has been highlighted, i.e. the currently selected menu item has changed.
3124 @see wxCommandEvent, @ref overview_eventhandling
3126 class wxMenuEvent
: public wxEvent
3132 wxMenuEvent(wxEventType id
= wxEVT_NULL
, int id
= 0, wxMenu
* menu
= NULL
);
3135 Returns the menu which is being opened or closed. This method should only be
3136 used with the @c OPEN and @c CLOSE events and even for them the
3137 returned pointer may be @NULL in some ports.
3139 wxMenu
* GetMenu() const;
3142 Returns the menu identifier associated with the event.
3143 This method should be only used with the @c HIGHLIGHT events.
3145 int GetMenuId() const;
3148 Returns @true if the menu which is being opened or closed is a popup menu,
3149 @false if it is a normal one.
3151 This method should only be used with the @c OPEN and @c CLOSE events.
3153 bool IsPopup() const;
3159 An event being sent when the window is shown or hidden.
3161 Currently only wxMSW, wxGTK and wxOS2 generate such events.
3163 @onlyfor{wxmsw,wxgtk,wxos2}
3165 @beginEventTable{wxShowEvent}
3166 @event{EVT_SHOW(func)}
3167 Process a wxEVT_SHOW event.
3173 @see @ref overview_eventhandling, wxWindow::Show,
3177 class wxShowEvent
: public wxEvent
3183 wxShowEvent(int winid
= 0, bool show
= false);
3186 Set whether the windows was shown or hidden.
3188 void SetShow(bool show
);
3191 Return @true if the window has been shown, @false if it has been
3194 bool IsShown() const;
3197 @deprecated This function is deprecated in favour of IsShown().
3199 bool GetShow() const;
3205 @class wxIconizeEvent
3207 An event being sent when the frame is iconized (minimized) or restored.
3209 Currently only wxMSW and wxGTK generate such events.
3211 @onlyfor{wxmsw,wxgtk}
3213 @beginEventTable{wxIconizeEvent}
3214 @event{EVT_ICONIZE(func)}
3215 Process a wxEVT_ICONIZE event.
3221 @see @ref overview_eventhandling, wxTopLevelWindow::Iconize,
3222 wxTopLevelWindow::IsIconized
3224 class wxIconizeEvent
: public wxEvent
3230 wxIconizeEvent(int id
= 0, bool iconized
= true);
3233 Returns @true if the frame has been iconized, @false if it has been
3236 bool IsIconized() const;
3239 @deprecated This function is deprecated in favour of IsIconized().
3241 bool Iconized() const;
3249 A move event holds information about move change events.
3251 @beginEventTable{wxMoveEvent}
3252 @event{EVT_MOVE(func)}
3253 Process a wxEVT_MOVE event, which is generated when a window is moved.
3254 @event{EVT_MOVE_START(func)}
3255 Process a wxEVT_MOVE_START event, which is generated when the user starts
3256 to move or size a window. wxMSW only.
3257 @event{EVT_MOVE_END(func)}
3258 Process a wxEVT_MOVE_END event, which is generated when the user stops
3259 moving or sizing a window. wxMSW only.
3265 @see wxPoint, @ref overview_eventhandling
3267 class wxMoveEvent
: public wxEvent
3273 wxMoveEvent(const wxPoint
& pt
, int id
= 0);
3276 Returns the position of the window generating the move change event.
3278 wxPoint
GetPosition() const;
3285 A size event holds information about size change events.
3287 The EVT_SIZE handler function will be called when the window has been resized.
3289 You may wish to use this for frames to resize their child windows as appropriate.
3291 Note that the size passed is of the whole window: call wxWindow::GetClientSize
3292 for the area which may be used by the application.
3294 When a window is resized, usually only a small part of the window is damaged
3295 and you may only need to repaint that area. However, if your drawing depends on the
3296 size of the window, you may need to clear the DC explicitly and repaint the whole window.
3297 In which case, you may need to call wxWindow::Refresh to invalidate the entire window.
3299 @beginEventTable{wxSizeEvent}
3300 @event{EVT_SIZE(func)}
3301 Process a wxEVT_SIZE event.
3307 @see wxSize, @ref overview_eventhandling
3309 class wxSizeEvent
: public wxEvent
3315 wxSizeEvent(const wxSize
& sz
, int id
= 0);
3318 Returns the entire size of the window generating the size change event.
3320 wxSize
GetSize() const;
3326 @class wxSetCursorEvent
3328 A wxSetCursorEvent is generated when the mouse cursor is about to be set as a
3329 result of mouse motion.
3331 This event gives the application the chance to perform specific mouse cursor
3332 processing based on the current position of the mouse within the window.
3333 Use wxSetCursorEvent::SetCursor to specify the cursor you want to be displayed.
3335 @beginEventTable{wxSetCursorEvent}
3336 @event{EVT_SET_CURSOR(func)}
3337 Process a wxEVT_SET_CURSOR event.
3343 @see ::wxSetCursor, wxWindow::wxSetCursor
3345 class wxSetCursorEvent
: public wxEvent
3349 Constructor, used by the library itself internally to initialize the event
3352 wxSetCursorEvent(wxCoord x
= 0, wxCoord y
= 0);
3355 Returns a reference to the cursor specified by this event.
3357 const wxCursor
& GetCursor() const;
3360 Returns the X coordinate of the mouse in client coordinates.
3362 wxCoord
GetX() const;
3365 Returns the Y coordinate of the mouse in client coordinates.
3367 wxCoord
GetY() const;
3370 Returns @true if the cursor specified by this event is a valid cursor.
3372 @remarks You cannot specify wxNullCursor with this event, as it is not
3373 considered a valid cursor.
3375 bool HasCursor() const;
3378 Sets the cursor associated with this event.
3380 void SetCursor(const wxCursor
& cursor
);
3385 // ============================================================================
3386 // Global functions/macros
3387 // ============================================================================
3389 /** @addtogroup group_funcmacro_events */
3393 A special event type usually used to indicate that some wxEvent has yet
3396 wxEventType wxEVT_NULL
;
3399 Each wxEvent-derived class has an @e event-type associated.
3400 See the macro DEFINE_EVENT_TYPE() for more info.
3402 @see @ref overview_eventhandling_custom
3404 typedef int wxEventType
;
3407 Initializes a new event type using wxNewEventType().
3409 #define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
3412 Generates a new unique event type.
3414 wxEventType
wxNewEventType();
3417 Use this macro inside a class declaration to declare a @e static event table
3420 In the implementation file you'll need to use the BEGIN_EVENT_TABLE()
3421 and the END_EVENT_TABLE() macros, plus some additional @c EVT_xxx macro
3424 @see @ref overview_eventhandling_eventtables
3426 #define DECLARE_EVENT_TABLE()
3429 Use this macro in a source file to start listing @e static event handlers
3430 for a specific class.
3432 Use END_EVENT_TABLE() to terminate the event-declaration block.
3434 @see @ref overview_eventhandling_eventtables
3436 #define BEGIN_EVENT_TABLE(theClass, baseClass)
3439 Use this macro in a source file to end listing @e static event handlers
3440 for a specific class.
3442 Use BEGIN_EVENT_TABLE() to start the event-declaration block.
3444 @see @ref overview_eventhandling_eventtables
3446 #define END_EVENT_TABLE()
3449 In a GUI application, this function posts @a event to the specified @e dest
3450 object using wxEvtHandler::AddPendingEvent().
3452 Otherwise, it dispatches @a event immediately using
3453 wxEvtHandler::ProcessEvent(). See the respective documentation for details
3454 (and caveats). Because of limitation of wxEvtHandler::AddPendingEvent()
3455 this function is not thread-safe for event objects having wxString fields,
3456 use wxQueueEvent() instead.
3460 void wxPostEvent(wxEvtHandler
* dest
, const wxEvent
& event
);
3463 Queue an event for processing on the given object.
3465 This is a wrapper around wxEvtHandler::QueueEvent(), see its documentation
3471 The object to queue the event on, can't be @c NULL.
3473 The heap-allocated and non-@c NULL event to queue, the function takes
3476 void wxQueueEvent(wxEvtHandler
* dest
, wxEvent
*event
);