-extern WXDLLEXPORT wxEventType wxNewEventType();
-
-#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
-
-BEGIN_DECLARE_EVENT_TYPES()
-
-#if WXWIN_COMPATIBILITY_EVENT_TYPES
- wxEVT_NULL = 0,
- wxEVT_FIRST = 10000,
- wxEVT_USER_FIRST = wxEVT_FIRST + 2000,
-#else // !WXWIN_COMPATIBILITY_EVENT_TYPES
- // it is important to still have these as constants to avoid
- // initialization order related problems
- DECLARE_EVENT_TYPE(wxEVT_NULL,0);
- const wxEventType wxEVT_FIRST = 10000;
- const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
-#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
-
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED, 1)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED, 2)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED, 3)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED, 4)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 5)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 6)
- // now they are in wx/textctrl.h
-#if WXWIN_COMPATIBILITY_EVENT_TYPES
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_UPDATED, 7)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_ENTER, 8)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_URL, 13)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN, 14)
-#endif // WXWIN_COMPATIBILITY_EVENT_TYPES
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED, 11)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED, 12)
-
- // wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use
- // wxEVT_SCROLL... events
-
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED, 13)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED, 14)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED, 15)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED, 16)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18)
-
- // Sockets and timers send events, too
- DECLARE_EVENT_TYPE(wxEVT_SOCKET, 50)
- DECLARE_EVENT_TYPE(wxEVT_TIMER , 80)
-
- // Mouse event types
- DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100)
- DECLARE_EVENT_TYPE(wxEVT_LEFT_UP, 101)
- DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DOWN, 102)
- DECLARE_EVENT_TYPE(wxEVT_MIDDLE_UP, 103)
- DECLARE_EVENT_TYPE(wxEVT_RIGHT_DOWN, 104)
- DECLARE_EVENT_TYPE(wxEVT_RIGHT_UP, 105)
- DECLARE_EVENT_TYPE(wxEVT_MOTION, 106)
- DECLARE_EVENT_TYPE(wxEVT_ENTER_WINDOW, 107)
- DECLARE_EVENT_TYPE(wxEVT_LEAVE_WINDOW, 108)
- DECLARE_EVENT_TYPE(wxEVT_LEFT_DCLICK, 109)
- DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK, 110)
- DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111)
- DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112)
- DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113)
- DECLARE_EVENT_TYPE(wxEVT_CHILD_FOCUS, 114)
- DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 115)
-
- // Non-client mouse events
- DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200)
- DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_UP, 201)
- DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN, 202)
- DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP, 203)
- DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN, 204)
- DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_UP, 205)
- DECLARE_EVENT_TYPE(wxEVT_NC_MOTION, 206)
- DECLARE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW, 207)
- DECLARE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW, 208)
- DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK, 209)
- DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK, 210)
- DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK, 211)
-
- // Character input event type
- DECLARE_EVENT_TYPE(wxEVT_CHAR, 212)
- DECLARE_EVENT_TYPE(wxEVT_CHAR_HOOK, 213)
- DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214)
- DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215)
- DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216)
-
- // Set cursor event
- DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230)
-
- // wxScrollBar and wxSlider event identifiers
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN, 303)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP, 304)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307)
- DECLARE_EVENT_TYPE(wxEVT_SCROLL_ENDSCROLL, 308)
-
- // Scroll events from wxWindow
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320)
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM, 321)
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP, 322)
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN, 323)
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP, 324)
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN, 325)
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK, 326)
- DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE, 327)
-
- // System events
- DECLARE_EVENT_TYPE(wxEVT_SIZE, 400)
- DECLARE_EVENT_TYPE(wxEVT_MOVE, 401)
- DECLARE_EVENT_TYPE(wxEVT_CLOSE_WINDOW, 402)
- DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403)
- DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404)
- DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405)
- DECLARE_EVENT_TYPE(wxEVT_POWER, 406)
- DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409)
- DECLARE_EVENT_TYPE(wxEVT_CREATE, 410)
- DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411)
- DECLARE_EVENT_TYPE(wxEVT_SHOW, 412)
- DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413)
- DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414)
- DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415)
- DECLARE_EVENT_TYPE(wxEVT_PAINT, 416)
- DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 417)
- DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 418)
- DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 419)
- DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 420)
- DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 421)
- DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 422)
- // DECLARE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT, 423) -- free slot
- DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424)
- DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425)
- DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426)
- DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427)
- DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428)
- DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429)
- DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430)
- DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431)
- DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432)
- DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433)
- DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434)
- DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435)
- DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436)
- DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437)
- DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438)
- DECLARE_EVENT_TYPE(wxEVT_IDLE, 439)
- DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
-
- // Generic command events
- // Note: a click is a higher-level event than button down/up
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK, 501)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK, 502)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK, 503)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS, 504)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS, 505)
- DECLARE_EVENT_TYPE(wxEVT_COMMAND_ENTER, 506)
-
- // Help events
- DECLARE_EVENT_TYPE(wxEVT_HELP, 1050)
- DECLARE_EVENT_TYPE(wxEVT_DETAILED_HELP, 1051)
-
-END_DECLARE_EVENT_TYPES()
+extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
+
+// macros to create an event type depending on whether type safe events are
+// enabled.
+
+#if wxEVENTS_COMPATIBILITY_2_8
+ #define wxDEFINE_EVENT( name, type ) \
+ const wxEventType name( wxNewEventType() );
+
+ #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
+ extern const expdecl wxEventType name;
+
+ #define wxDEFINE_EVENT_REFERENCE( name, type, value ) \
+ const wxEventType& name = value;
+
+ #define wxDECLARE_EXPORTED_EVENT_REFERENCE( expdecl, name, type ) \
+ extern const expdecl wxEventType& name;
+
+ #define wxDECLARE_LOCAL_EVENT( name, type ) \
+ wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
+
+ #define wxEVENT_HANDLER_CAST( functype, func ) \
+ ( wxObjectEventFunction )( wxEventFunction )wxStaticCastEvent( functype, &func )
+#else
+ #define wxDEFINE_EVENT( name, type ) \
+ const wxTypedEventType< type > name( wxNewEventType() );
+
+ #define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
+ extern const expdecl wxTypedEventType< type > name;
+
+ #define wxDEFINE_EVENT_REFERENCE( name, type, value ) \
+ const wxTypedEventTypeReference< type > name( value );
+
+ #define wxDECLARE_EXPORTED_EVENT_REFERENCE( expdecl, name, type ) \
+ extern const expdecl wxTypedEventTypeReference< type > name;
+
+ #define wxDECLARE_LOCAL_EVENT( name, type ) \
+ wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
+
+ #define wxEVENT_HANDLER_CAST( functype, func ) \
+ ( &func )
+#endif
+
+// template which associates the correct event object with the event type
+
+#if !wxEVENTS_COMPATIBILITY_2_8
+
+template <typename Event>
+class WXDLLIMPEXP_BASE wxTypedEventType
+{
+public:
+ typedef Event CorrespondingEvent;
+
+ wxTypedEventType(wxEventType type) { m_type = type; }
+
+ // used for static event tables
+ operator const wxEventType&() const { return m_type; }
+
+private:
+ wxEventType m_type;
+};
+
+// Due to a bug in older wx versions wxSpinEvents were being sent with type of
+// wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN and wxEVT_SCROLL_THUMBTRACK. But
+// with the type-safe events in place, these event types are associated with
+// wxScrollEvent. To allow handling of spin events, new event types have been
+// defined in spinbutt.h/spinnbuttcmn.cpp. To maintain backward compatibility
+// the spin event types are being initialized with the scroll event types. But
+// this presents as with the same static initialization order problem we also
+// have for the static event tables. So we use the same solution and the
+// template definition below holds a reference to a wxEventType.
+template <typename Event>
+class WXDLLIMPEXP_BASE wxTypedEventTypeReference
+{
+public:
+ typedef Event CorrespondingEvent;
+
+ wxTypedEventTypeReference(const wxEventType& type) : m_type(type) { }
+
+ // used for static event tables
+ operator const wxEventType&() const { return m_type; }
+
+private:
+ const wxEventType &m_type;
+};
+
+#endif // !wxEVENTS_COMPATIBILITY_2_8
+
+// These are needed for the functor definitions
+typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
+
+// We had some trouble (specifically with eVC for ARM WinCE build) with using
+// wxEventFunction in the past so we had introduced wxObjectEventFunction which
+// used to be a typedef for a member of wxObject and not wxEvtHandler to work
+// around this but as eVC is not really supported any longer we now only keep
+// this for backwards compatibility and, despite its name, this is a typedef
+// for wxEvtHandler member now -- but if we have the same problem with another
+// compiler we can restore its old definition for it.
+typedef wxEventFunction wxObjectEventFunction;
+
+
+// the functors which will be stored in the static/dynamic tables
+class WXDLLIMPEXP_BASE wxEventFunctor
+{
+public:
+ virtual ~wxEventFunctor();
+
+ // this operator is used to actually invoke the event handler
+ virtual void operator()(wxEvtHandler *, wxEvent &) = 0;
+
+ // this function tests whether this functor is matched, for the purpose of
+ // finding it in an event table in Disconnect(), by the given func
+ virtual bool Matches(const wxEventFunctor& func) const = 0;
+
+ virtual wxEvtHandler *GetHandler() const { return NULL; }
+
+ virtual wxObjectEventFunction GetMethod() const { return NULL; }
+};
+
+// A plain method functor
+class WXDLLIMPEXP_BASE wxObjectEventFunctor : public wxEventFunctor
+{
+public:
+ wxObjectEventFunctor(wxObjectEventFunction method, wxEvtHandler *handler)
+ {
+ m_handler = handler;
+ m_method = method;
+ }
+
+ virtual void operator()(wxEvtHandler *handler, wxEvent& event)
+ {
+ wxEvtHandler * const realHandler = m_handler ? m_handler : handler;
+
+ (realHandler->*m_method)(event);
+ }
+
+ virtual bool Matches(const wxEventFunctor& other) const
+ {
+ wxEvtHandler * const handler = other.GetHandler();
+
+ return (m_handler == handler || !handler) &&
+ (m_method == other.GetMethod());
+ }
+
+ virtual wxEvtHandler *GetHandler() const { return m_handler; }
+ virtual wxObjectEventFunction GetMethod() const { return m_method; }
+
+private:
+ wxEvtHandler *m_handler;
+ wxObjectEventFunction m_method;
+};
+
+// Create a functor for the legacy events: handler can be NULL and its default
+// value is used by the event table macros
+
+inline wxObjectEventFunctor *
+wxNewEventFunctor(wxEventType WXUNUSED(evtType),
+ wxObjectEventFunction method,
+ wxEvtHandler *handler = NULL)
+{
+ return new wxObjectEventFunctor(method, handler);
+}
+
+inline wxObjectEventFunctor
+wxConstructEventFunctor(wxEventType WXUNUSED(evtType),
+ wxObjectEventFunction method,
+ wxEvtHandler *handler)
+{
+ return wxObjectEventFunctor(method, handler);
+}
+
+#if !wxEVENTS_COMPATIBILITY_2_8
+
+template <typename EventType>
+class WXDLLIMPEXP_BASE wxEventFunctorFunction : public wxEventFunctor
+{
+public:
+ wxEventFunctorFunction(void (*handler)(typename EventType::CorrespondingEvent &))
+ {
+ m_handler = handler;
+ }
+
+ virtual void operator()(wxEvtHandler *WXUNUSED(handler), wxEvent& event)
+ {
+ // Protect against wrong event i.e. wxMouseEvent evt(wxEVT_PAINT):
+ wxASSERT( dynamic_cast< typename EventType::CorrespondingEvent * >( &event ) != NULL );
+
+ // Will throw a std::bad_cast exception in release build:
+ ( *m_handler )( dynamic_cast< typename EventType::CorrespondingEvent & >( event ));
+ }
+
+ virtual bool Matches( const wxEventFunctor &right ) const
+ {
+ wxEventFunctorFunction const &other = dynamic_cast< wxEventFunctorFunction const & >( right );
+
+ return m_handler == other.m_handler || other.m_handler == NULL;
+ }
+
+private:
+ void ( *m_handler )( typename EventType::CorrespondingEvent & );
+};
+
+
+template <typename EventType, typename Class, typename Derived>
+class WXDLLIMPEXP_BASE wxEventFunctorMethod : public wxEventFunctor
+{
+public:
+ wxEventFunctorMethod( void ( Class::*method )( typename EventType::CorrespondingEvent & ),
+ Derived *handler )
+ {
+ m_handler = handler;
+ m_method = method;
+ }
+
+ virtual void operator () ( wxEvtHandler *handler, wxEvent &event )
+ {
+ // Compile-time type check 1: This requires Derived to derive from or
+ // be of the same type as Class
+ Class *realHandler = m_handler;
+
+ if( m_handler == NULL )
+ {
+ // Verify that the handler does indeed derive from the class
+ // containing the handler method
+ wxASSERT( dynamic_cast< Class * >( handler) != NULL );
+
+ realHandler = dynamic_cast< Class * >( handler );
+ }
+
+ // Protect against wrong event i.e. wxMouseEvent evt(wxEVT_PAINT):
+ wxASSERT( dynamic_cast< typename EventType::CorrespondingEvent * >( &event ) != NULL );
+
+ // Will throw a std::bad_cast exception in release build:
+ ( realHandler->*m_method )( dynamic_cast< typename EventType::CorrespondingEvent & >( event ));
+ }
+
+ virtual bool Matches( const wxEventFunctor &right ) const
+ {
+ wxEventFunctorMethod const &other = dynamic_cast< wxEventFunctorMethod const & >( right );
+
+ return (( m_handler == other.m_handler || other.m_handler == NULL ) &&
+ ( m_method == other.m_method || other.m_method == NULL ));
+ }
+
+ virtual wxEvtHandler *GetHandler() const
+ {
+ // This makes sure Derived derives from wxEvtHandler (it is still
+ // possible and even ok if Class does not derive from wxEvtHandler. In
+ // this case Derived would end up using multiple inheritance: class
+ // Derived : public wxEvtHandler, public Class { } where Class contains
+ // the method to call, but wxEvtHandler contains the wxTrackable and
+ // code for weak ref support
+ return m_handler;
+ }
+
+ virtual wxObjectEventFunction GetMethod() const
+ {
+ return reinterpret_cast<wxObjectEventFunction>(m_method);
+ }
+
+private:
+ Derived *m_handler;
+ void (Class::*m_method)(typename EventType::CorrespondingEvent&);
+};
+
+
+template <typename EventType, typename Functor>
+class WXDLLIMPEXP_BASE wxEventFunctorAdapter : public wxEventFunctor
+{
+public:
+ wxEventFunctorAdapter( Functor &functor )
+ {
+ m_functor = functor;
+ }
+
+ virtual void operator () ( wxEvtHandler *WXUNUSED( handler ), wxEvent &event )
+ {
+ // Protect against wrong event i.e. wxMouseEvent evt(wxEVT_PAINT):
+ wxASSERT( dynamic_cast< typename EventType::CorrespondingEvent * >( &event ) != NULL );
+
+ // Will throw a std::bad_cast exception in release build:
+ m_functor( dynamic_cast< typename EventType::CorrespondingEvent & >( event ));
+ }
+
+ virtual bool Matches( const wxEventFunctor &right ) const
+ {
+ wxEventFunctorAdapter const &other = dynamic_cast< wxEventFunctorAdapter const & >( right );
+
+ return m_functor == other.m_functor;
+ }
+
+private:
+ Functor m_functor;
+};
+
+//
+// Create functors for the templatized events (needed in wxEvtHandler::Connect):
+//
+
+// Create a functor for functions:
+
+template <typename EventType>
+inline wxEventFunctorFunction<EventType> *
+wxNewEventFunctor(const EventType &,
+ void (*function)(typename EventType::CorrespondingEvent&))
+{
+ return new wxEventFunctorFunction<EventType>(function);
+}
+
+// Create a functor for methods:
+
+template <typename EventType, typename Class>
+inline wxEventFunctorMethod<EventType, Class, Class> *
+wxNewEventFunctor(const EventType &,
+ void (Class::*method)(typename EventType::CorrespondingEvent&))
+{
+ return new wxEventFunctorMethod<EventType, Class, Class>(method, NULL);
+}
+
+template <typename EventType, typename Class, typename Derived>
+inline wxEventFunctorMethod<EventType, Class, Derived> *
+wxNewEventFunctor(const EventType &,
+ void (Class::*method)(typename EventType::CorrespondingEvent &),
+ Derived *handler )
+{
+ return new wxEventFunctorMethod<EventType, Class, Derived>(method, handler);
+}
+
+// Create a functor for arbitrary functors (like boost::function):
+template <typename EventType, typename Functor>
+inline wxEventFunctorAdapter<EventType, Functor> *
+wxNewEventFunctor(const EventType &,
+ Functor& functor )
+{
+ return new wxEventFunctorAdapter<EventType, Functor>(functor);
+}
+
+//
+// Construct functors for the templatized events (needed in wxEvtHandler::Disconnect):
+//
+
+// Construct a functor for functions:
+
+template <typename EventType>
+inline wxEventFunctorFunction<EventType>
+wxConstructEventFunctor(const EventType &,
+ void (*function)(typename EventType::CorrespondingEvent&))
+{
+ return wxEventFunctorFunction<EventType>(function);
+}
+
+// Construct a functor for methods:
+
+template <typename EventType, typename Class>
+inline wxEventFunctorMethod<EventType, Class, Class>
+wxConstructEventFunctor(const EventType &,
+ void (Class::*method)(typename EventType::CorrespondingEvent&))
+{
+ return wxEventFunctorMethod<EventType, Class, Class>(method, NULL);
+}
+
+template <typename EventType, typename Class, typename Derived>
+inline wxEventFunctorMethod<EventType, Class, Derived>
+wxConstructEventFunctor(const EventType &,
+ void (Class::*method)(typename EventType::CorrespondingEvent&),
+ Derived *handler)
+{
+ return wxEventFunctorMethod<EventType, Class, Derived>(method, handler);
+}
+
+// Construct a functor for arbitrary functors (like boost:function):
+
+template <typename EventType, typename Functor>
+inline wxEventFunctorAdapter<EventType, Functor>
+wxConstructEventFunctor(const EventType &,
+ Functor& functor)
+{
+ return wxEventFunctorAdapter<EventType, Functor>(functor);
+}
+
+#endif // !wxEVENTS_COMPATIBILITY_2_8
+
+// many, but not all, standard event types
+
+ // some generic events
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_NULL;
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_FIRST;
+extern WXDLLIMPEXP_BASE const wxEventType wxEVT_USER_FIRST;
+
+ // Need events declared to do this
+class WXDLLIMPEXP_FWD_CORE wxCommandEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
+class WXDLLIMPEXP_FWD_CORE wxFocusEvent;
+class WXDLLIMPEXP_FWD_CORE wxChildFocusEvent;
+class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
+class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
+class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent;
+class WXDLLIMPEXP_FWD_CORE wxScrollEvent;
+class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent;
+class WXDLLIMPEXP_FWD_CORE wxSizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMoveEvent;
+class WXDLLIMPEXP_FWD_CORE wxCloseEvent;
+class WXDLLIMPEXP_FWD_CORE wxActivateEvent;
+class WXDLLIMPEXP_FWD_CORE wxWindowCreateEvent;
+class WXDLLIMPEXP_FWD_CORE wxWindowDestroyEvent;
+class WXDLLIMPEXP_FWD_CORE wxShowEvent;
+class WXDLLIMPEXP_FWD_CORE wxIconizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMaximizeEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseCaptureChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxMouseCaptureLostEvent;
+class WXDLLIMPEXP_FWD_CORE wxPaintEvent;
+class WXDLLIMPEXP_FWD_CORE wxEraseEvent;
+class WXDLLIMPEXP_FWD_CORE wxNcPaintEvent;
+class WXDLLIMPEXP_FWD_CORE wxMenuEvent;
+class WXDLLIMPEXP_FWD_CORE wxContextMenuEvent;
+class WXDLLIMPEXP_FWD_CORE wxSysColourChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxDisplayChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxQueryNewPaletteEvent;
+class WXDLLIMPEXP_FWD_CORE wxPaletteChangedEvent;
+class WXDLLIMPEXP_FWD_CORE wxJoystickEvent;
+class WXDLLIMPEXP_FWD_CORE wxDropFilesEvent;
+class WXDLLIMPEXP_FWD_CORE wxInitDialogEvent;
+class WXDLLIMPEXP_FWD_CORE wxIdleEvent;
+class WXDLLIMPEXP_FWD_CORE wxUpdateUIEvent;
+class WXDLLIMPEXP_FWD_CORE wxClipboardTextEvent;
+class WXDLLIMPEXP_FWD_CORE wxHelpEvent;
+
+
+ // Command events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEvent)
+
+// wxEVT_COMMAND_SCROLLBAR_UPDATED is deprecated, use wxEVT_SCROLL... events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SCROLLBAR_UPDATED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_VLBOX_SELECTED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_RCLICKED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TOOL_ENTER, wxCommandEvent)
+
+ // Mouse event types
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DOWN, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_UP, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DOWN, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_UP, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DOWN, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_UP, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOTION, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ENTER_WINDOW, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEAVE_WINDOW, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_LEFT_DCLICK, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MIDDLE_DCLICK, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_RIGHT_DCLICK, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_FOCUS, wxFocusEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KILL_FOCUS, wxFocusEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHILD_FOCUS, wxChildFocusEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSEWHEEL, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DOWN, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_UP, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX1_DCLICK, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DOWN, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_UP, wxMouseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_AUX2_DCLICK, wxMouseEvent)
+
+ // Character input event type
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR, wxKeyEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CHAR_HOOK, wxKeyEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NAVIGATION_KEY, wxNavigationKeyEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_DOWN, wxKeyEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_KEY_UP, wxKeyEvent)
+#if wxUSE_HOTKEY
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HOTKEY, wxKeyEvent)
+#endif
+ // Set cursor event
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SET_CURSOR, wxSetCursorEvent)
+
+ // wxScrollBar and wxSlider event identifiers
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_TOP, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_BOTTOM, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEUP, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_LINEDOWN, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEUP, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_PAGEDOWN, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBTRACK, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent)
+
+ // Scroll events from wxWindow
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEUP, wxScrollWinEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEvent)
+
+ // System events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZE, wxSizeEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE, wxMoveEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CLOSE_WINDOW, wxCloseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_END_SESSION, wxCloseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_END_SESSION, wxCloseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE_APP, wxActivateEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ACTIVATE, wxActivateEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CREATE, wxWindowCreateEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DESTROY, wxWindowDestroyEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SHOW, wxShowEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ICONIZE, wxIconizeEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MAXIMIZE, wxMaximizeEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PAINT, wxPaintEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_ERASE_BACKGROUND, wxEraseEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_NC_PAINT, wxNcPaintEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_OPEN, wxMenuEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_CLOSE, wxMenuEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MENU_HIGHLIGHT, wxMenuEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_CONTEXT_MENU, wxContextMenuEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DISPLAY_CHANGED, wxDisplayChangedEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_PALETTE_CHANGED, wxPaletteChangedEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_DOWN, wxJoystickEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_BUTTON_UP, wxJoystickEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_MOVE, wxJoystickEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_JOY_ZMOVE, wxJoystickEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DROP_FILES, wxDropFilesEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_INIT_DIALOG, wxInitDialogEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_BASE, wxEVT_IDLE, wxIdleEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_UPDATE_UI, wxUpdateUIEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SIZING, wxSizeEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVING, wxMoveEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_START, wxMoveEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_MOVE_END, wxMoveEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HIBERNATE, wxActivateEvent)
+
+ // Clipboard events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_COPY, wxClipboardTextEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_CUT, wxClipboardTextEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_TEXT_PASTE, wxClipboardTextEvent)
+
+ // Generic command events
+ // Note: a click is a higher-level event than button down/up
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_CLICK, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_LEFT_DCLICK, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_CLICK, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_RIGHT_DCLICK, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SET_FOCUS, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_KILL_FOCUS, wxCommandEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_ENTER, wxCommandEvent)
+
+ // Help events
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_HELP, wxHelpEvent)
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_DETAILED_HELP, wxHelpEvent)