]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/event.h
use bool expression rather than implicit conversion
[wxWidgets.git] / interface / wx / event.h
index 238369e5336134e4887c1abf47a3a0f646280aa3..e453085f9421745453c0926403149a6ccbd29857 100644 (file)
@@ -7,6 +7,64 @@
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
+/**
+    The predefined constants for the number of times we propagate event
+    upwards window child-parent chain.
+*/
+enum wxEventPropagation
+{
+    /// don't propagate it at all
+    wxEVENT_PROPAGATE_NONE = 0,
+
+    /// propagate it until it is processed
+    wxEVENT_PROPAGATE_MAX = INT_MAX
+};
+
+/**
+    The different categories for a wxEvent; see wxEvent::GetEventCategory.
+
+    @note They are used as OR-combinable flags by wxEventLoopBase::YieldFor.
+*/
+enum wxEventCategory
+{
+    /**
+        This is the category for those events which are generated to update
+        the appearance of the GUI but which (usually) do not comport data
+        processing, i.e. which do not provide input or output data
+        (e.g. size events, scroll events, etc).
+        They are events NOT directly generated by the user's input devices.
+    */
+    wxEVT_CATEGORY_UI = 1,
+
+    /**
+        This category groups those events which are generated directly from the
+        user through input devices like mouse and keyboard and usually result in
+        data to be processed from the application
+        (e.g. mouse clicks, key presses, etc).
+    */
+    wxEVT_CATEGORY_USER_INPUT = 2,
+
+    /// This category is for wxSocketEvent
+    wxEVT_CATEGORY_SOCKET = 4,
+
+    /// This category is for wxTimerEvent
+    wxEVT_CATEGORY_TIMER = 8,
+
+    /**
+        This category is for any event used to send notifications from the
+        secondary threads to the main one or in general for notifications among
+        different threads (which may or may not be user-generated).
+    */
+    wxEVT_CATEGORY_THREAD = 16,
+
+    /**
+        This mask is used in wxEventLoopBase::YieldFor to specify that all event
+        categories should be processed.
+    */
+    wxEVT_CATEGORY_ALL =
+        wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_SOCKET| \
+        wxEVT_CATEGORY_TIMER|wxEVT_CATEGORY_THREAD
+};
 
 /**
     @class wxEvent
@@ -17,7 +75,7 @@
     wxEvent used to be a multipurpose event object, and is an abstract base class
     for other event classes (see below).
 
-    For more information about events, see the @ref overview_eventhandling overview.
+    For more information about events, see the @ref overview_events overview.
 
     @beginWxPerlOnly
     In wxPerl custom event classes should be derived from
@@ -87,6 +145,13 @@ public:
     */
     wxEventType GetEventType() const;
 
+    /**
+        Returns a generic category for this event.
+
+        This function is used to selectively process events in wxEventLoopBase::YieldFor.
+    */
+    virtual wxEventCategory GetEventCategory() const;
+
     /**
         Returns the identifier associated with this event, such as a button command id.
     */
@@ -220,7 +285,7 @@ protected:
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling, wxEvtHandler
+    @see @ref overview_events_processing, wxEvtHandler
 */
 class wxEventBlocker : public wxEvtHandler
 {
@@ -266,7 +331,7 @@ public:
     @library{wxbase}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events_processing
 */
 class wxEvtHandler : public wxObject
 {
@@ -390,7 +455,7 @@ public:
            function was found, in which case the function exits.
         -# The search is applied down the entire chain of event handlers (usually the
            chain has a length of one). This chain can be formed using wxEvtHandler::SetNextHandler():
-              @image html overview_eventhandling_chain.png
+              @image html overview_events_chain.png
            (referring to the image, if @c A->ProcessEvent is called and it doesn't handle
             the event, @c B->ProcessEvent will be called and so on...).
            Note that in the case of wxWindow you can build a stack of event handlers
@@ -462,10 +527,20 @@ public:
     //@{
 
     /**
-        Connects the given function dynamically with the event handler, id and event type.
-        This is an alternative to the use of static event tables.
+        Connects the given function dynamically with the event handler, id and
+        event type.
+
+        This is an alternative to the use of static event tables. It is more
+        flexible as it allows to connect events generated by some object to an
+        event handler defined in a different object of a different class (which
+        is impossible to do directly with the event tables -- the events can be
+        only handled in another object if they are propagated upwards to it).
+        Do make sure to specify the correct @a eventSink when connecting to an
+        event of a different object.
 
-        See the @ref page_samples_event sample for usage.
+        See @ref overview_events_connect for more detailed explanation
+        of this function and the @ref page_samples_event sample for usage
+        examples.
 
         This specific overload allows you to connect an event handler to a @e range
         of @e source IDs.
@@ -490,8 +565,9 @@ public:
         @param userData
             Data to be associated with the event table entry.
         @param eventSink
-            Object whose member function should be called.
-            If this is @NULL, @c *this will be used.
+            Object whose member function should be called. It must be specified
+            when connecting an event generated by one object to a member
+            function of a different object. If it is omitted, @c this is used.
     */
     void Connect(int id, int lastId, wxEventType eventType,
                  wxObjectEventFunction function,
@@ -688,7 +764,7 @@ public:
             The event handler to be set as the next handler.
             Cannot be @NULL.
 
-        @see @ref overview_eventhandling_processing
+        @see @ref overview_events_processing
     */
     virtual void SetNextHandler(wxEvtHandler* handler);
 
@@ -700,7 +776,7 @@ public:
             The event handler to be set as the previous handler.
             Cannot be @NULL.
 
-        @see @ref overview_eventhandling_processing
+        @see @ref overview_events_processing
     */
     virtual void SetPreviousHandler(wxEvtHandler* handler);
 
@@ -793,11 +869,11 @@ public:
 
     @beginEventTable{wxKeyEvent}
     @event{EVT_KEY_DOWN(func)}
-           Process a wxEVT_KEY_DOWN event (any key has been pressed).
+        Process a @c wxEVT_KEY_DOWN event (any key has been pressed).
     @event{EVT_KEY_UP(func)}
-           Process a wxEVT_KEY_UP event (any key has been released).
+        Process a @c wxEVT_KEY_UP event (any key has been released).
     @event{EVT_CHAR(func)}
-           Process a wxEVT_CHAR event.
+        Process a @c wxEVT_CHAR event.
     @endEventTable
 
     @see wxKeyboardState
@@ -880,15 +956,15 @@ public:
     events received by windows.
 
     @beginEventTable{wxJoystickEvent}
-    @style{EVT_JOY_BUTTON_DOWN(func)}
-        Process a wxEVT_JOY_BUTTON_DOWN event.
-    @style{EVT_JOY_BUTTON_UP(func)}
-        Process a wxEVT_JOY_BUTTON_UP event.
-    @style{EVT_JOY_MOVE(func)}
-        Process a wxEVT_JOY_MOVE event.
-    @style{EVT_JOY_ZMOVE(func)}
-        Process a wxEVT_JOY_ZMOVE event.
-    @style{EVT_JOYSTICK_EVENTS(func)}
+    @event{EVT_JOY_BUTTON_DOWN(func)}
+        Process a @c wxEVT_JOY_BUTTON_DOWN event.
+    @event{EVT_JOY_BUTTON_UP(func)}
+        Process a @c wxEVT_JOY_BUTTON_UP event.
+    @event{EVT_JOY_MOVE(func)}
+        Process a @c wxEVT_JOY_MOVE event.
+    @event{EVT_JOY_ZMOVE(func)}
+        Process a @c wxEVT_JOY_ZMOVE event.
+    @event{EVT_JOYSTICK_EVENTS(func)}
         Processes all joystick events.
     @endEventTable
 
@@ -990,10 +1066,10 @@ public:
 
     A scroll event holds information about events sent from scrolling windows.
 
+    Note that you can use the EVT_SCROLLWIN* macros for intercepting scroll window events
+    from the receiving window.
 
     @beginEventTable{wxScrollWinEvent}
-    You can use the EVT_SCROLLWIN* macros for intercepting scroll window events
-    from the receiving window.
     @event{EVT_SCROLLWIN(func)}
         Process all scroll events.
     @event{EVT_SCROLLWIN_TOP(func)}
@@ -1019,7 +1095,7 @@ public:
     @library{wxcore}
     @category{events}
 
-    @see wxScrollEvent, @ref overview_eventhandling
+    @see wxScrollEvent, @ref overview_events
 */
 class wxScrollWinEvent : public wxEvent
 {
@@ -1064,13 +1140,13 @@ public:
 
     @beginEventTable{wxSysColourChangedEvent}
     @event{EVT_SYS_COLOUR_CHANGED(func)}
-        Process a wxEVT_SYS_COLOUR_CHANGED event.
+        Process a @c wxEVT_SYS_COLOUR_CHANGED event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxSysColourChangedEvent : public wxEvent
 {
@@ -1094,13 +1170,13 @@ public:
 
     @beginEventTable{wxWindowCreateEvent}
     @event{EVT_WINDOW_CREATE(func)}
-        Process a wxEVT_CREATE event.
+        Process a @c wxEVT_CREATE event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling, wxWindowDestroyEvent
+    @see @ref overview_events, wxWindowDestroyEvent
 */
 class wxWindowCreateEvent : public wxCommandEvent
 {
@@ -1178,13 +1254,13 @@ public:
 
     @beginEventTable{wxPaintEvent}
     @event{EVT_PAINT(func)}
-        Process a wxEVT_PAINT event.
+        Process a @c wxEVT_PAINT event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxPaintEvent : public wxEvent
 {
@@ -1206,13 +1282,13 @@ public:
 
     @beginEventTable{wxMaximizeEvent}
     @event{EVT_MAXIMIZE(func)}
-        Process a wxEVT_MAXIMIZE event.
+        Process a @c wxEVT_MAXIMIZE event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling, wxTopLevelWindow::Maximize,
+    @see @ref overview_events, wxTopLevelWindow::Maximize,
          wxTopLevelWindow::IsMaximized
 */
 class wxMaximizeEvent : public wxEvent
@@ -1285,15 +1361,15 @@ enum wxUpdateUIMode
 
     @beginEventTable{wxUpdateUIEvent}
     @event{EVT_UPDATE_UI(id, func)}
-        Process a wxEVT_UPDATE_UI event for the command with the given id.
+        Process a @c wxEVT_UPDATE_UI event for the command with the given id.
     @event{EVT_UPDATE_UI_RANGE(id1, id2, func)}
-        Process a wxEVT_UPDATE_UI event for any command with id included in the given range.
+        Process a @c wxEVT_UPDATE_UI event for any command with id included in the given range.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxUpdateUIEvent : public wxCommandEvent
 {
@@ -1534,45 +1610,45 @@ public:
 
     @beginEventTable{wxMouseEvent}
     @event{EVT_LEFT_DOWN(func)}
-        Process a wxEVT_LEFT_DOWN event. The handler of this event should normally
+        Process a @c wxEVT_LEFT_DOWN event. The handler of this event should normally
         call event.Skip() to allow the default processing to take place as otherwise
         the window under mouse wouldn't get the focus.
     @event{EVT_LEFT_UP(func)}
-        Process a wxEVT_LEFT_UP event.
+        Process a @c wxEVT_LEFT_UP event.
     @event{EVT_LEFT_DCLICK(func)}
-        Process a wxEVT_LEFT_DCLICK event.
+        Process a @c wxEVT_LEFT_DCLICK event.
     @event{EVT_MIDDLE_DOWN(func)}
-        Process a wxEVT_MIDDLE_DOWN event.
+        Process a @c wxEVT_MIDDLE_DOWN event.
     @event{EVT_MIDDLE_UP(func)}
-        Process a wxEVT_MIDDLE_UP event.
+        Process a @c wxEVT_MIDDLE_UP event.
     @event{EVT_MIDDLE_DCLICK(func)}
-        Process a wxEVT_MIDDLE_DCLICK event.
+        Process a @c wxEVT_MIDDLE_DCLICK event.
     @event{EVT_RIGHT_DOWN(func)}
-        Process a wxEVT_RIGHT_DOWN event.
+        Process a @c wxEVT_RIGHT_DOWN event.
     @event{EVT_RIGHT_UP(func)}
-        Process a wxEVT_RIGHT_UP event.
+        Process a @c wxEVT_RIGHT_UP event.
     @event{EVT_RIGHT_DCLICK(func)}
-        Process a wxEVT_RIGHT_DCLICK event.
+        Process a @c wxEVT_RIGHT_DCLICK event.
     @event{EVT_MOUSE_AUX1_DOWN(func)}
-        Process a wxEVT_MOUSE_AUX1_DOWN event.
+        Process a @c wxEVT_MOUSE_AUX1_DOWN event.
     @event{EVT_MOUSE_AUX1_UP(func)}
-        Process a wxEVT_MOUSE_AUX1_UP event.
+        Process a @c wxEVT_MOUSE_AUX1_UP event.
     @event{EVT_MOUSE_AUX1_DCLICK(func)}
-        Process a wxEVT_MOUSE_AUX1_DCLICK event.
+        Process a @c wxEVT_MOUSE_AUX1_DCLICK event.
     @event{EVT_MOUSE_AUX2_DOWN(func)}
-        Process a wxEVT_MOUSE_AUX2_DOWN event.
+        Process a @c wxEVT_MOUSE_AUX2_DOWN event.
     @event{EVT_MOUSE_AUX2_UP(func)}
-        Process a wxEVT_MOUSE_AUX2_UP event.
+        Process a @c wxEVT_MOUSE_AUX2_UP event.
     @event{EVT_MOUSE_AUX2_DCLICK(func)}
-        Process a wxEVT_MOUSE_AUX2_DCLICK event.
+        Process a @c wxEVT_MOUSE_AUX2_DCLICK event.
     @event{EVT_MOTION(func)}
-        Process a wxEVT_MOTION event.
+        Process a @c wxEVT_MOTION event.
     @event{EVT_ENTER_WINDOW(func)}
-        Process a wxEVT_ENTER_WINDOW event.
+        Process a @c wxEVT_ENTER_WINDOW event.
     @event{EVT_LEAVE_WINDOW(func)}
-        Process a wxEVT_LEAVE_WINDOW event.
+        Process a @c wxEVT_LEAVE_WINDOW event.
     @event{EVT_MOUSEWHEEL(func)}
-        Process a wxEVT_MOUSEWHEEL event.
+        Process a @c wxEVT_MOUSEWHEEL event.
     @event{EVT_MOUSE_EVENTS(func)}
         Process all mouse events.
     @endEventTable
@@ -1910,7 +1986,7 @@ public:
 
     @beginEventTable{wxDropFilesEvent}
     @event{EVT_DROP_FILES(func)}
-        Process a wxEVT_DROP_FILES event.
+        Process a @c wxEVT_DROP_FILES event.
     @endEventTable
 
     @onlyfor{wxmsw}
@@ -1918,7 +1994,7 @@ public:
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxDropFilesEvent : public wxEvent
 {
@@ -1975,6 +2051,8 @@ public:
         Process a @c wxEVT_COMMAND_LISTBOX_SELECTED command, which is generated by a wxListBox control.
     @event{EVT_LISTBOX_DCLICK(id, func)}
         Process a @c wxEVT_COMMAND_LISTBOX_DOUBLECLICKED command, which is generated by a wxListBox control.
+    @event{EVT_CHECKLISTBOX(id, func)}
+        Process a @c wxEVT_COMMAND_CHECKLISTBOX_TOGGLED command, which is generated by a wxCheckListBox control.
     @event{EVT_MENU(id, func)}
         Process a @c wxEVT_COMMAND_MENU_SELECTED command, which is generated by a menu item.
     @event{EVT_MENU_RANGE(id1, id2, func)}
@@ -2143,9 +2221,10 @@ public:
 
     @beginEventTable{wxActivateEvent}
     @event{EVT_ACTIVATE(func)}
-        Process a wxEVT_ACTIVATE event.
+        Process a @c wxEVT_ACTIVATE event.
     @event{EVT_ACTIVATE_APP(func)}
-        Process a wxEVT_ACTIVATE_APP event.
+        Process a @c wxEVT_ACTIVATE_APP event.
+        This event is received by the wxApp-derived instance only.
     @event{EVT_HIBERNATE(func)}
         Process a hibernate event, supplying the member function. This event applies
         to wxApp only, and only on Windows SmartPhone and PocketPC.
@@ -2154,11 +2233,10 @@ public:
         a wxEVT_ACTIVATE or wxEVT_ACTIVATE_APP event.
     @endEventTable
 
-
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling, wxApp::IsActive
+    @see @ref overview_events, wxApp::IsActive
 */
 class wxActivateEvent : public wxEvent
 {
@@ -2181,7 +2259,7 @@ public:
     @class wxContextMenuEvent
 
     This class is used for context menu events, sent to give
-    the application a chance to show a context (popup) menu.
+    the application a chance to show a context (popup) menu for a wxWindow.
 
     Note that if wxContextMenuEvent::GetPosition returns wxDefaultPosition, this
     means that the event originated from a keyboard context button event, and you
@@ -2202,7 +2280,7 @@ public:
     @library{wxcore}
     @category{events}
 
-    @see wxCommandEvent, @ref overview_eventhandling
+    @see wxCommandEvent, @ref overview_events
 */
 class wxContextMenuEvent : public wxCommandEvent
 {
@@ -2255,13 +2333,13 @@ public:
 
     @beginEventTable{wxEraseEvent}
     @event{EVT_ERASE_BACKGROUND(func)}
-        Process a wxEVT_ERASE_BACKGROUND event.
+        Process a @c wxEVT_ERASE_BACKGROUND event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxEraseEvent : public wxEvent
 {
@@ -2291,15 +2369,15 @@ public:
 
     @beginEventTable{wxFocusEvent}
     @event{EVT_SET_FOCUS(func)}
-        Process a wxEVT_SET_FOCUS event.
+        Process a @c wxEVT_SET_FOCUS event.
     @event{EVT_KILL_FOCUS(func)}
-        Process a wxEVT_KILL_FOCUS event.
+        Process a @c wxEVT_KILL_FOCUS event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxFocusEvent : public wxEvent
 {
@@ -2333,13 +2411,13 @@ public:
 
     @beginEventTable{wxChildFocusEvent}
     @event{EVT_CHILD_FOCUS(func)}
-        Process a wxEVT_CHILD_FOCUS event.
+        Process a @c wxEVT_CHILD_FOCUS event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxChildFocusEvent : public wxCommandEvent
 {
@@ -2380,7 +2458,7 @@ public:
 
     @beginEventTable{wxMouseCaptureLostEvent}
     @event{EVT_MOUSE_CAPTURE_LOST(func)}
-        Process a wxEVT_MOUSE_CAPTURE_LOST event.
+        Process a @c wxEVT_MOUSE_CAPTURE_LOST event.
     @endEventTable
 
     @onlyfor{wxmsw}
@@ -2388,8 +2466,8 @@ public:
     @library{wxcore}
     @category{events}
 
-    @see wxMouseCaptureChangedEvent, @ref overview_eventhandling,
-    wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
+    @see wxMouseCaptureChangedEvent, @ref overview_events,
+         wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
 */
 class wxMouseCaptureLostEvent : public wxEvent
 {
@@ -2450,18 +2528,42 @@ public:
 };
 
 
+/**
+    @class wxThreadEvent
+
+    This class adds some simple functionalities to wxCommandEvent coinceived
+    for inter-threads communications.
 
+    @library{wxcore}
+    @category{events}
 
-enum wxHelpEventOrigin
+    @see @ref overview_thread, wxEventLoopBase::YieldFor
+*/
+class wxThreadEvent : public wxCommandEvent
 {
-    wxHE_ORIGIN_UNKNOWN = -1,
-    wxHE_ORIGIN_KEYBOARD,
+public:
+    /**
+        Constructor.
+    */
+    wxThreadEvent(wxEventType eventType = wxEVT_COMMAND_THREAD, int id = wxID_ANY);
 
-    /** event generated by wxContextHelp or from the [?] button on
-        the title bar (Windows). */
-    wxHE_ORIGIN_HELPBUTTON
+    /**
+        Clones this event making sure that all internal members which use
+        COW (only @c m_commandString for now; see @ref overview_refcount)
+        are unshared (see wxObject::UnShare).
+    */
+    virtual wxEvent *Clone() const;
+
+    /**
+        Returns @c wxEVT_CATEGORY_THREAD.
+
+        This is important to avoid unwanted processing of thread events
+        when calling wxEventLoopBase::YieldFor().
+    */
+    virtual wxEventCategory GetEventCategory() const;
 };
 
+
 /**
     @class wxHelpEvent
 
@@ -2485,15 +2587,15 @@ enum wxHelpEventOrigin
 
     @beginEventTable{wxHelpEvent}
     @event{EVT_HELP(id, func)}
-        Process a wxEVT_HELP event.
+        Process a @c wxEVT_HELP event.
     @event{EVT_HELP_RANGE(id1, id2, func)}
-        Process a wxEVT_HELP event for a range of ids.
+        Process a @c wxEVT_HELP event for a range of ids.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see wxContextHelp, wxDialog, @ref overview_eventhandling
+    @see wxContextHelp, wxDialog, @ref overview_events
 */
 class wxHelpEvent : public wxCommandEvent
 {
@@ -2633,7 +2735,7 @@ public:
     @library{wxcore}
     @category{events}
 
-    @see wxScrollBar, wxSlider, wxSpinButton, wxScrollWinEvent, @ref overview_eventhandling
+    @see wxScrollBar, wxSlider, wxSpinButton, wxScrollWinEvent, @ref overview_events
 */
 class wxScrollEvent : public wxCommandEvent
 {
@@ -2692,13 +2794,13 @@ enum wxIdleMode
 
     @beginEventTable{wxIdleEvent}
     @event{EVT_IDLE(func)}
-        Process a wxEVT_IDLE event.
+        Process a @c wxEVT_IDLE event.
     @endEventTable
 
     @library{wxbase}
     @category{events}
 
-    @see @ref overview_eventhandling, wxUpdateUIEvent, wxWindow::OnInternalIdle
+    @see @ref overview_events, wxUpdateUIEvent, wxWindow::OnInternalIdle
 */
 class wxIdleEvent : public wxEvent
 {
@@ -2778,13 +2880,13 @@ public:
 
     @beginEventTable{wxInitDialogEvent}
     @event{EVT_INIT_DIALOG(func)}
-        Process a wxEVT_INIT_DIALOG event.
+        Process a @c wxEVT_INIT_DIALOG event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling
+    @see @ref overview_events
 */
 class wxInitDialogEvent : public wxEvent
 {
@@ -2821,7 +2923,7 @@ public:
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling, wxWindowCreateEvent
+    @see @ref overview_events, wxWindowCreateEvent
 */
 class wxWindowDestroyEvent : public wxCommandEvent
 {
@@ -2836,18 +2938,6 @@ public:
 };
 
 
-/**
-    The possible flag values for a wxNavigationKeyEvent.
-*/
-enum wxNavigationKeyEventFlags
-{
-    wxNKEF_IS_BACKWARD = 0x0000,
-    wxNKEF_IS_FORWARD = 0x0001,
-    wxNKEF_WINCHANGE = 0x0002,
-    wxNKEF_FROMTAB = 0x0004
-};
-
-
 /**
     @class wxNavigationKeyEvent
 
@@ -2872,6 +2962,17 @@ enum wxNavigationKeyEventFlags
 class wxNavigationKeyEvent : public wxEvent
 {
 public:
+    /**
+        Flags which can be used with wxNavigationKeyEvent.
+    */
+    enum wxNavigationKeyEventFlags
+    {
+        IsBackward = 0x0000,
+        IsForward = 0x0001,
+        WinChange = 0x0002,
+        FromTab = 0x0004
+    };
+
     wxNavigationKeyEvent();
     wxNavigationKeyEvent(const wxNavigationKeyEvent& event);
 
@@ -2931,7 +3032,7 @@ public:
     @class wxMouseCaptureChangedEvent
 
     An mouse capture changed event is sent to a window that loses its
-    mouse capture. This is called even if wxWindow::ReleaseCapture
+    mouse capture. This is called even if wxWindow::ReleaseMouse
     was called by the application code. Handling this event allows
     an application to cater for unexpected capture releases which
     might otherwise confuse mouse handling code.
@@ -2940,14 +3041,14 @@ public:
 
     @beginEventTable{wxMouseCaptureChangedEvent}
     @event{EVT_MOUSE_CAPTURE_CHANGED(func)}
-        Process a wxEVT_MOUSE_CAPTURE_CHANGED event.
+        Process a @c wxEVT_MOUSE_CAPTURE_CHANGED event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see wxMouseCaptureLostEvent, @ref overview_eventhandling,
-    wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
+    @see wxMouseCaptureLostEvent, @ref overview_events,
+         wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
 */
 class wxMouseCaptureChangedEvent : public wxEvent
 {
@@ -3108,7 +3209,7 @@ public:
     @library{wxcore}
     @category{events}
 
-    @see wxCommandEvent, @ref overview_eventhandling
+    @see wxCommandEvent, @ref overview_events
 */
 class wxMenuEvent : public wxEvent
 {
@@ -3151,13 +3252,13 @@ public:
 
     @beginEventTable{wxShowEvent}
     @event{EVT_SHOW(func)}
-        Process a wxEVT_SHOW event.
+        Process a @c wxEVT_SHOW event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling, wxWindow::Show,
+    @see @ref overview_events, wxWindow::Show,
          wxWindow::IsShown
 */
 
@@ -3199,13 +3300,13 @@ public:
 
     @beginEventTable{wxIconizeEvent}
     @event{EVT_ICONIZE(func)}
-        Process a wxEVT_ICONIZE event.
+        Process a @c wxEVT_ICONIZE event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see @ref overview_eventhandling, wxTopLevelWindow::Iconize,
+    @see @ref overview_events, wxTopLevelWindow::Iconize,
          wxTopLevelWindow::IsIconized
 */
 class wxIconizeEvent : public wxEvent
@@ -3233,23 +3334,23 @@ public:
 /**
     @class wxMoveEvent
 
-    A move event holds information about move change events.
+    A move event holds information about wxTopLevelWindow move change events.
 
     @beginEventTable{wxMoveEvent}
     @event{EVT_MOVE(func)}
-        Process a wxEVT_MOVE event, which is generated when a window is moved.
+        Process a @c wxEVT_MOVE event, which is generated when a window is moved.
     @event{EVT_MOVE_START(func)}
-        Process a wxEVT_MOVE_START event, which is generated when the user starts
+        Process a @c wxEVT_MOVE_START event, which is generated when the user starts
         to move or size a window. wxMSW only.
     @event{EVT_MOVE_END(func)}
-        Process a wxEVT_MOVE_END event, which is generated when the user stops
+        Process a @c wxEVT_MOVE_END event, which is generated when the user stops
         moving or sizing a window. wxMSW only.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see wxPoint, @ref overview_eventhandling
+    @see wxPoint, @ref overview_events
 */
 class wxMoveEvent : public wxEvent
 {
@@ -3269,7 +3370,7 @@ public:
 /**
     @class wxSizeEvent
 
-    A size event holds information about size change events.
+    A size event holds information about size change events of wxWindow.
 
     The EVT_SIZE handler function will be called when the window has been resized.
 
@@ -3285,13 +3386,13 @@ public:
 
     @beginEventTable{wxSizeEvent}
     @event{EVT_SIZE(func)}
-        Process a wxEVT_SIZE event.
+        Process a @c wxEVT_SIZE event.
     @endEventTable
 
     @library{wxcore}
     @category{events}
 
-    @see wxSize, @ref overview_eventhandling
+    @see wxSize, @ref overview_events
 */
 class wxSizeEvent : public wxEvent
 {
@@ -3312,8 +3413,8 @@ public:
 /**
     @class wxSetCursorEvent
 
-    A wxSetCursorEvent is generated when the mouse cursor is about to be set as a
-    result of mouse motion.
+    A wxSetCursorEvent is generated from wxWindow when the mouse cursor is about
+    to be set as a result of mouse motion.
 
     This event gives the application the chance to perform specific mouse cursor
     processing based on the current position of the mouse within the window.
@@ -3321,7 +3422,7 @@ public:
 
     @beginEventTable{wxSetCursorEvent}
     @event{EVT_SET_CURSOR(func)}
-        Process a wxEVT_SET_CURSOR event.
+        Process a @c wxEVT_SET_CURSOR event.
     @endEventTable
 
     @library{wxcore}
@@ -3377,29 +3478,143 @@ public:
 //@{
 
 /**
-    A special event type usually used to indicate that some wxEvent has yet
-    no type assigned.
-*/
-wxEventType wxEVT_NULL;
+    A value uniquely identifying the type of the event.
+
+    The values of this type should only be created using wxNewEventType().
 
-/**
-    Each wxEvent-derived class has an @e event-type associated.
     See the macro DEFINE_EVENT_TYPE() for more info.
 
-    @see @ref overview_eventhandling_custom
+    @see @ref overview_events_introduction
 */
 typedef int wxEventType;
 
+/**
+    A special event type usually used to indicate that some wxEvent has yet
+    no type assigned.
+*/
+wxEventType wxEVT_NULL;
+
 /**
     Initializes a new event type using wxNewEventType().
+
+    @deprecated Use wxDEFINE_EVENT() instead
 */
 #define DEFINE_EVENT_TYPE(name)     const wxEventType name = wxNewEventType();
 
 /**
     Generates a new unique event type.
+
+    Usually this function is only used by wxDEFINE_EVENT() and not called
+    directly.
 */
 wxEventType wxNewEventType();
 
+/**
+    Define a new event type associated with the specified event class.
+
+    This macro defines a new unique event type @a name associated with the
+    event class @a cls.
+
+    For example:
+    @code
+    wxDEFINE_EVENT(MY_COMMAND_EVENT, wxCommandEvent);
+
+    class MyCustomEvent : public wxEvent { ... };
+    wxDEFINE_EVENT(MY_CUSTOM_EVENT, MyCustomEvent);
+    @endcode
+
+    @see wxDECLARE_EVENT(), @ref overview_events_custom
+ */
+#define wxDEFINE_EVENT(name, cls) \
+    const wxEventTypeTag< cls > name(wxNewEventType())
+
+/**
+    Declares a custom event type.
+
+    This macro declares a variable called @a name which must be defined
+    elsewhere using wxDEFINE_EVENT().
+
+    The class @a cls must be the wxEvent-derived class associated with the
+    events of this type and its full declaration must be visible from the point
+    of use of this macro.
+ */
+#define wxDECLARE_EVENT(name, cls) \
+        wxDECLARE_EXPORTED_EVENT(wxEMPTY_PARAMETER_VALUE, name, cls)
+
+/**
+    Variant of wxDECLARE_EVENT() used for event types defined inside a shared
+    library.
+
+    This is mostly used by wxWidgets internally, e.g.
+    @code
+    wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEvent)
+    @endcode
+ */
+#define wxDECLARE_EXPORTED_EVENT( expdecl, name, cls ) \
+    extern const expdecl wxEventTypeTag< cls > name;
+
+/**
+    Helper macro for definition of custom event table macros.
+
+    This macro must only be used if wxEVENTS_COMPATIBILITY_2_8 is 1, otherwise
+    it is better and more clear to just use the address of the function
+    directly as this is all this macro does in this case. However it needs to
+    explicitly cast @a func to @a functype, which is the type of wxEvtHandler
+    member function taking the custom event argument when
+    wxEVENTS_COMPATIBILITY_2_8 is 0.
+
+    See wx__DECLARE_EVT0 for an example of use.
+
+    @see @ref overview_events_custom_ownclass
+ */
+#define wxEVENT_HANDLER_CAST(functype, func) (&func)
+
+//@{
+/**
+    These macros are used to define event table macros for handling custom
+    events.
+
+    Example of use:
+    @code
+    class MyEvent : public wxEvent { ... };
+
+    // note that this is not necessary unless using old compilers: for the
+    // reasonably new ones just use &func instead of MyEventHandler(func)
+    typedef void (wxEvtHandler::*MyEventFunction)(MyEvent&);
+    #define MyEventHandler(func) wxEVENT_HANDLER_CAST(MyEventFunction, func)
+
+    wxDEFINE_EVENT(MY_EVENT_TYPE, MyEvent);
+
+    #define EVT_MY(id, func) \
+        wx__DECLARE_EVT1(MY_EVENT_TYPE, id, MyEventHandler(func))
+
+    ...
+
+    BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+        EVT_MY(wxID_ANY, MyFrame::OnMyEvent)
+    END_EVENT_TABLE()
+    @endcode
+
+    @param evt
+        The event type to handle.
+    @param id
+        The identifier of events to handle.
+    @param id1
+        The first identifier of the range.
+    @param id2
+        The second identifier of the range.
+    @param fn
+        The event handler method.
+ */
+#define wx__DECLARE_EVT2(evt, id1, id2, fn) \
+    DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
+#define wx__DECLARE_EVT1(evt, id, fn) \
+    wx__DECLARE_EVT2(evt, id, wxID_ANY, fn)
+#define wx__DECLARE_EVT0(evt, fn) \
+    wx__DECLARE_EVT1(evt, wxID_ANY, fn)
+//@}
+
+
 /**
     Use this macro inside a class declaration to declare a @e static event table
     for that class.
@@ -3408,7 +3623,7 @@ wxEventType wxNewEventType();
     and the END_EVENT_TABLE() macros, plus some additional @c EVT_xxx macro
     to capture events.
 
-    @see @ref overview_eventhandling_eventtables
+    @see @ref overview_events_eventtables
 */
 #define DECLARE_EVENT_TABLE()
 
@@ -3418,7 +3633,7 @@ wxEventType wxNewEventType();
 
     Use END_EVENT_TABLE() to terminate the event-declaration block.
 
-    @see @ref overview_eventhandling_eventtables
+    @see @ref overview_events_eventtables
 */
 #define BEGIN_EVENT_TABLE(theClass, baseClass)
 
@@ -3428,7 +3643,7 @@ wxEventType wxNewEventType();
 
     Use BEGIN_EVENT_TABLE() to start the event-declaration block.
 
-    @see @ref overview_eventhandling_eventtables
+    @see @ref overview_events_eventtables
 */
 #define END_EVENT_TABLE()