X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03ae811e42ea30bd7d627ed3368a4165c3d8d35c..c099b53353ec8c689681a1bc8f5117a584e4098d:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index ab5ee9ced1..cc363146e4 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -381,7 +381,7 @@ struct HandlerImpl // allowed to handle different events in the same handler taking wxEvent&, for // example template - + class wxEventFunctorMethod : public wxEventFunctor, private wxPrivate::HandlerImpl @@ -399,7 +399,7 @@ public: typedef typename wxPrivate::EventClassOf::type EventClass; - wxEventFunctorMethod(void (Class::*method)(EventArg&), ObjClass *handler) + wxEventFunctorMethod(void (Class::*method)(EventArg&), EventHandler *handler) { wxASSERT_MSG( handler || this->IsEvtHandler(), "handlers defined in non-wxEvtHandler-derived classes " @@ -457,7 +457,7 @@ public: } private: - ObjClass *m_handler; + EventHandler *m_handler; void (Class::*m_method)(EventArg&); }; @@ -486,29 +486,29 @@ wxMakeEventFunctor(const EventTag&, Functor func) // Create functors for methods: template - -inline wxEventFunctorMethod * + +inline wxEventFunctorMethod * wxNewEventFunctor(const EventTag&, void (Class::*method)(EventArg&), - ObjClass *handler) + EventHandler *handler) { - return new wxEventFunctorMethod( + return new wxEventFunctorMethod( method, handler); } template - -inline wxEventFunctorMethod + +inline wxEventFunctorMethod wxMakeEventFunctor(const EventTag&, void (Class::*method)(EventArg&), - ObjClass *handler) + EventHandler *handler) { - return wxEventFunctorMethod( + return wxEventFunctorMethod( method, handler); } // Special case for the wxNewEventFunctor() calls used inside the event table -// macros: they don't specify the handler so ObjClass can't be deduced +// macros: they don't specify the handler so EventHandler can't be deduced template inline wxEventFunctorMethod * wxNewEventFunctor(const EventTag&, void (Class::*method)(EventArg&)) @@ -518,7 +518,7 @@ wxNewEventFunctor(const EventTag&, void (Class::*method)(EventArg&)) } template - + inline wxEventFunctorMethod wxMakeEventFunctor(const EventTag&, void (Class::*method)(EventArg&)) { @@ -596,6 +596,8 @@ wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCo 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); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_DROPDOWN, wxCommandEvent); +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COMBOBOX_CLOSEUP, wxCommandEvent); // Thread events wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_THREAD, wxThreadEvent); @@ -1634,7 +1636,9 @@ private: wxEVT_PAINT_ICON */ -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) +#if wxDEBUG_LEVEL && (defined(__WXMSW__) || defined(__WXPM__)) + #define wxHAS_PAINT_DEBUG + // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined extern WXDLLIMPEXP_CORE int g_isPainting; #endif // debug @@ -1645,15 +1649,15 @@ public: wxPaintEvent(int Id = 0) : wxEvent(Id, wxEVT_PAINT) { -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) - // set the internal flag for the duration of processing of WM_PAINT +#ifdef wxHAS_PAINT_DEBUG + // set the internal flag for the duration of redrawing g_isPainting++; #endif // debug } // default copy ctor and dtor are normally fine, we only need them to keep // g_isPainting updated in debug build -#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__)) +#ifdef wxHAS_PAINT_DEBUG wxPaintEvent(const wxPaintEvent& event) : wxEvent(event) { @@ -2802,10 +2806,11 @@ public: // Clear table void Clear(); -#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING - // Clear all tables +#if wxUSE_MEMORY_TRACING + // Clear all tables: only used to work around problems in memory tracing + // code static void ClearAll(); -#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING +#endif // wxUSE_MEMORY_TRACING protected: // Init the hash table with the entries of the static event table. @@ -3000,32 +3005,32 @@ public: } - // Bind a method of a class (called on the specified eventSink which must + // Bind a method of a class (called on the specified handler which must // be convertible to this class) object to an event: - template + template void Bind(const EventTag &eventType, void (Class::*method)(EventArg &), - ObjClass *eventSink, + EventHandler *handler, int winid = wxID_ANY, int lastId = wxID_ANY, wxObject *userData = NULL) { DoConnect(winid, lastId, eventType, - wxNewEventFunctor(eventType, method, eventSink), + wxNewEventFunctor(eventType, method, handler), userData); } - template + template bool Unbind(const EventTag &eventType, void (Class::*method)(EventArg&), - ObjClass *eventSink, + EventHandler *handler, int winid = wxID_ANY, int lastId = wxID_ANY, wxObject *userData = NULL ) { return DoDisconnect(winid, lastId, eventType, - wxMakeEventFunctor(eventType, method, eventSink), + wxMakeEventFunctor(eventType, method, handler), userData); } #endif // !wxEVENTS_COMPATIBILITY_2_8 @@ -3151,7 +3156,7 @@ protected: virtual void *DoGetClientData() const; // Search tracker objects for event connection with this sink - wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *eventSink); + wxEventConnectionRef *FindRefInTrackerList(wxEvtHandler *handler); private: // pass the event to wxTheApp instance, called from TryAfter() @@ -3749,6 +3754,8 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func)) #define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func)) #define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func)) +#define EVT_COMBOBOX_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_DROPDOWN, winid, wxCommandEventHandler(func)) +#define EVT_COMBOBOX_CLOSEUP(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_CLOSEUP, winid, wxCommandEventHandler(func)) // Generic command events #define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func))