]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/event.h
fixed wxXmlResource::Load's detection of filenames to be done as early as possible
[wxWidgets.git] / interface / wx / event.h
index 6cc36544063037bcb982718ff62a6f8b0aa9f333..021e0da3427394501869158dadd6e5c8b61fafad 100644 (file)
@@ -23,7 +23,7 @@ enum wxEventPropagation
 /**
     The different categories for a wxEvent; see wxEvent::GetEventCategory.
 
-    @note They are used as OR-combinable flags by wxApp::Yield.
+    @note They are used as OR-combinable flags by wxEventLoopBase::YieldFor.
 */
 enum wxEventCategory
 {
@@ -54,12 +54,13 @@ enum wxEventCategory
         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).
+        See e.g. wxThreadEvent.
     */
     wxEVT_CATEGORY_THREAD = 16,
 
     /**
-        This mask is used in wxApp::Yield to specify that all event categories should
-        be processed.
+        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| \
@@ -147,8 +148,9 @@ public:
 
     /**
         Returns a generic category for this event.
+        wxEvent implementation returns @c wxEVT_CATEGORY_UI by default.
 
-        This function is used to selectively process events in wxApp::Yield.
+        This function is used to selectively process events in wxEventLoopBase::YieldFor.
     */
     virtual wxEventCategory GetEventCategory() const;
 
@@ -378,7 +380,7 @@ public:
         fields of this object are used by it, notably any wxString members of
         the event object must not be shallow copies of another wxString object
         as this would result in them still using the same string buffer behind
-        the scenes. For example
+        the scenes. For example:
         @code
             void FunctionInAWorkerThread(const wxString& str)
             {
@@ -391,6 +393,20 @@ public:
             }
         @endcode
 
+        Note that you can use wxThreadEvent instead of wxCommandEvent
+        to avoid this problem:
+        @code
+            void FunctionInAWorkerThread(const wxString& str)
+            {
+                wxThreadEvent evt;
+                evt->SetString(str);
+
+                // wxThreadEvent::Clone() makes sure that the internal wxString
+                // member is not shared by other wxString instances:
+                wxTheApp->QueueEvent( evt.Clone() );
+            }
+        @endcode
+
         Finally notice that this method automatically wakes up the event loop
         if it is currently idle by calling ::wxWakeUpIdle() so there is no need
         to do it manually when using it.
@@ -455,7 +471,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
@@ -869,11 +885,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
@@ -956,15 +972,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
 
@@ -1066,10 +1082,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)}
@@ -1140,7 +1156,7 @@ 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}
@@ -1170,7 +1186,7 @@ public:
 
     @beginEventTable{wxWindowCreateEvent}
     @event{EVT_WINDOW_CREATE(func)}
-        Process a wxEVT_CREATE event.
+        Process a @c wxEVT_CREATE event.
     @endEventTable
 
     @library{wxcore}
@@ -1254,7 +1270,7 @@ public:
 
     @beginEventTable{wxPaintEvent}
     @event{EVT_PAINT(func)}
-        Process a wxEVT_PAINT event.
+        Process a @c wxEVT_PAINT event.
     @endEventTable
 
     @library{wxcore}
@@ -1282,7 +1298,7 @@ public:
 
     @beginEventTable{wxMaximizeEvent}
     @event{EVT_MAXIMIZE(func)}
-        Process a wxEVT_MAXIMIZE event.
+        Process a @c wxEVT_MAXIMIZE event.
     @endEventTable
 
     @library{wxcore}
@@ -1361,9 +1377,9 @@ 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}
@@ -1610,45 +1626,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
@@ -1986,7 +2002,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}
@@ -2030,6 +2046,11 @@ public:
     This event class contains information about command events, which originate
     from a variety of simple controls.
 
+    Note that wxCommandEvents and wxCommandEvent-derived event classes by default
+    and unlike other wxEvent-derived classes propagate upward from the source
+    window (the window which emits the event) up to the first parent which processes
+    the event. Be sure to read @ref overview_events_propagation.
+
     More complex controls, such as wxTreeCtrl, have separate command event classes.
 
     @beginEventTable{wxCommandEvent}
@@ -2221,9 +2242,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.
@@ -2232,7 +2254,6 @@ public:
         a wxEVT_ACTIVATE or wxEVT_ACTIVATE_APP event.
     @endEventTable
 
-
     @library{wxcore}
     @category{events}
 
@@ -2259,7 +2280,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
@@ -2333,7 +2354,7 @@ public:
 
     @beginEventTable{wxEraseEvent}
     @event{EVT_ERASE_BACKGROUND(func)}
-        Process a wxEVT_ERASE_BACKGROUND event.
+        Process a @c wxEVT_ERASE_BACKGROUND event.
     @endEventTable
 
     @library{wxcore}
@@ -2369,9 +2390,9 @@ 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}
@@ -2411,7 +2432,7 @@ public:
 
     @beginEventTable{wxChildFocusEvent}
     @event{EVT_CHILD_FOCUS(func)}
-        Process a wxEVT_CHILD_FOCUS event.
+        Process a @c wxEVT_CHILD_FOCUS event.
     @endEventTable
 
     @library{wxcore}
@@ -2458,7 +2479,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}
@@ -2467,7 +2488,7 @@ public:
     @category{events}
 
     @see wxMouseCaptureChangedEvent, @ref overview_events,
-    wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
+         wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
 */
 class wxMouseCaptureLostEvent : public wxEvent
 {
@@ -2534,10 +2555,16 @@ public:
     This class adds some simple functionalities to wxCommandEvent coinceived
     for inter-threads communications.
 
+    This event is not natively emitted by any control/class: this is just
+    an helper class for the user.
+    Its most important feature is the GetEventCategory() implementation which
+    allows thread events to @b NOT be processed by wxEventLoopBase::YieldFor calls
+    (unless the @c wxEVT_CATEGORY_THREAD is specified - which is never in wx code).
+
     @library{wxcore}
-    @category{events}
+    @category{events,threading}
 
-    @see @ref overview_thread, wxApp::YieldFor
+    @see @ref overview_thread, wxEventLoopBase::YieldFor
 */
 class wxThreadEvent : public wxCommandEvent
 {
@@ -2558,7 +2585,7 @@ public:
         Returns @c wxEVT_CATEGORY_THREAD.
 
         This is important to avoid unwanted processing of thread events
-        when calling wxApp::YieldFor().
+        when calling wxEventLoopBase::YieldFor().
     */
     virtual wxEventCategory GetEventCategory() const;
 };
@@ -2587,9 +2614,9 @@ public:
 
     @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}
@@ -2794,7 +2821,7 @@ enum wxIdleMode
 
     @beginEventTable{wxIdleEvent}
     @event{EVT_IDLE(func)}
-        Process a wxEVT_IDLE event.
+        Process a @c wxEVT_IDLE event.
     @endEventTable
 
     @library{wxbase}
@@ -2880,7 +2907,7 @@ public:
 
     @beginEventTable{wxInitDialogEvent}
     @event{EVT_INIT_DIALOG(func)}
-        Process a wxEVT_INIT_DIALOG event.
+        Process a @c wxEVT_INIT_DIALOG event.
     @endEventTable
 
     @library{wxcore}
@@ -2938,18 +2965,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
 
@@ -2974,6 +2989,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);
 
@@ -3033,7 +3059,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.
@@ -3042,14 +3068,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_events,
-    wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
+         wxWindow::CaptureMouse, wxWindow::ReleaseMouse, wxWindow::GetCapture
 */
 class wxMouseCaptureChangedEvent : public wxEvent
 {
@@ -3253,7 +3279,7 @@ public:
 
     @beginEventTable{wxShowEvent}
     @event{EVT_SHOW(func)}
-        Process a wxEVT_SHOW event.
+        Process a @c wxEVT_SHOW event.
     @endEventTable
 
     @library{wxcore}
@@ -3301,7 +3327,7 @@ public:
 
     @beginEventTable{wxIconizeEvent}
     @event{EVT_ICONIZE(func)}
-        Process a wxEVT_ICONIZE event.
+        Process a @c wxEVT_ICONIZE event.
     @endEventTable
 
     @library{wxcore}
@@ -3335,16 +3361,16 @@ 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
 
@@ -3371,7 +3397,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.
 
@@ -3387,7 +3413,7 @@ public:
 
     @beginEventTable{wxSizeEvent}
     @event{EVT_SIZE(func)}
-        Process a wxEVT_SIZE event.
+        Process a @c wxEVT_SIZE event.
     @endEventTable
 
     @library{wxcore}
@@ -3414,8 +3440,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.
@@ -3423,7 +3449,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}
@@ -3497,14 +3523,125 @@ 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.