#define wxDECLARE_EXPORTED_EVENT( expdecl, name, type ) \
extern const expdecl wxEventType name;
- #define wxDEFINE_EVENT_REFERENCE( name, type, value ) \
- const wxEventType& name = value;
+ #define wxDEFINE_EVENT_ALIAS( name, type, value ) \
+ const wxEventType name = value;
- #define wxDECLARE_EXPORTED_EVENT_REFERENCE( expdecl, name, type ) \
- extern const expdecl wxEventType& name;
+ #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
+ extern const expdecl wxEventType name;
#define wxDECLARE_LOCAL_EVENT( name, type ) \
wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
#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 wxDEFINE_EVENT_ALIAS( name, type, value ) \
+ const wxTypedEventType< type > name( value );
- #define wxDECLARE_EXPORTED_EVENT_REFERENCE( expdecl, name, type ) \
- extern const expdecl wxTypedEventTypeReference< type > name;
+ #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
+ extern const expdecl wxTypedEventType< type > name;
#define wxDECLARE_LOCAL_EVENT( name, type ) \
wxDECLARE_EXPORTED_EVENT( wxEMPTY_PARAMETER_VALUE, name, type )
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
// value is used by the event table macros
inline wxObjectEventFunctor *
-wxNewEventFunctor(wxEventType WXUNUSED(evtType),
+wxNewEventFunctor(const wxEventType& WXUNUSED(evtType),
wxObjectEventFunction method,
wxEvtHandler *handler = NULL)
{
}
inline wxObjectEventFunctor
-wxConstructEventFunctor(wxEventType WXUNUSED(evtType),
+wxConstructEventFunctor(const wxEventType& WXUNUSED(evtType),
wxObjectEventFunction method,
wxEvtHandler *handler)
{
class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
class WXDLLIMPEXP_FWD_CORE wxSetCursorEvent;
class WXDLLIMPEXP_FWD_CORE wxScrollEvent;
+class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
class WXDLLIMPEXP_FWD_CORE wxScrollWinEvent;
class WXDLLIMPEXP_FWD_CORE wxSizeEvent;
class WXDLLIMPEXP_FWD_CORE wxMoveEvent;
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_THUMBRELEASE, wxScrollEvent)
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLL_CHANGED, wxScrollEvent)
+// 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.
+
+#if wxUSE_SPINBTN
+
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_UP, wxSpinEvent )
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN_DOWN, wxSpinEvent )
+wxDECLARE_EXPORTED_EVENT_ALIAS( WXDLLIMPEXP_CORE, wxEVT_SPIN, wxSpinEvent )
+
+#endif
+
// Scroll events from wxWindow
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_TOP, wxScrollWinEvent)
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEvent)
wxEvtHandler();
virtual ~wxEvtHandler();
+
+ // Event handler chain
+ // -------------------
+
wxEvtHandler *GetNextHandler() const { return m_nextHandler; }
wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; }
- void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
- void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
+ virtual void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
+ virtual void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; }
bool GetEvtHandlerEnabled() const { return m_enabled; }
+ void Unlink();
+ bool IsUnlinked() const;
+
+
+
+ // Event queuing and processing
+ // ----------------------------
+
+
// Process an event right now: this can only be called from the main
// thread, use QueueEvent() for scheduling the events for
// processing from other threads.
// when called from C code (e.g. in GTK+ callback) when the exception
// wouldn't correctly propagate to wxEventLoop.
bool SafelyProcessEvent(wxEvent& event);
+ // NOTE: uses ProcessEvent()
// Schedule the given event to be processed later. It takes ownership of
// the event pointer, i.e. it will be deleted later. This is safe to call
}
void ProcessPendingEvents();
+ // NOTE: uses ProcessEvent()
#if wxUSE_THREADS
bool ProcessThreadEvent(const wxEvent& event);
+ // NOTE: uses AddPendingEvent()
#endif
+
+ // Connecting and disconnecting
+ // ----------------------------
+
// Dynamic association of a member function handler with the event handler,
// winid and event type
void Connect(int winid,