X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe4e9e6c14f3df8be4191804258c7795bd829a10..9018abe3ef28d237b0421c8d96987907adbe5532:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index 009336ade7..c74f328aae 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -283,6 +283,10 @@ public: void Skip(bool skip = TRUE) { m_skipped = skip; } bool GetSkipped() const { return m_skipped; }; + // implementation only: this test is explicitlty anti OO and this functions + // exists only for optimization purposes + bool IsCommandEvent() const { return m_isCommandEvent; } + public: bool m_skipped; wxObject* m_eventObject; @@ -291,6 +295,10 @@ public: long m_timeStamp; int m_id; wxObject* m_callbackUserData; + + // optimization: instead of using costly IsKindOf() we keep a flag telling + // whether we're a command event (by far the most common case) + bool m_isCommandEvent; }; // Item or menu event class @@ -771,6 +779,7 @@ public: m_veto = veto; } void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } + // No more asserts here please, the one you put here was wrong. bool CanVeto() const { return m_canVeto; } bool GetVeto() const { return m_canVeto && m_veto; } @@ -1156,7 +1165,9 @@ public: virtual long Default() { return GetNextHandler() ? GetNextHandler()->Default() : 0; }; +#if WXWIN_COMPATIBILITY virtual bool OnClose(); +#endif virtual bool ProcessEvent(wxEvent& event); virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); @@ -1179,13 +1190,19 @@ private: static const wxEventTableEntry sm_eventTableEntries[]; protected: - static const wxEventTable sm_eventTable; - virtual const wxEventTable* GetEventTable() const; + static const wxEventTable sm_eventTable; + + virtual const wxEventTable *GetEventTable() const; + protected: wxEvtHandler* m_nextHandler; wxEvtHandler* m_previousHandler; - bool m_enabled; // Is event handler enabled? + bool m_enabled; // Is event handler enabled? wxList* m_dynamicEvents; + + // optimization: instead of using costly IsKindOf() to decide whether we're + // a window (which is true in 99% of cases), use this flag + bool m_isWindow; }; typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); @@ -1302,7 +1319,7 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ // EVT_COMMAND #define EVT_COMMAND(id, event, fn) { event, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, -#define EVT_COMMAND_RANGE(id1, id2, event, fn) { eventId, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, +#define EVT_COMMAND_RANGE(id1, id2, event, fn) { event, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, // Scrolling #define EVT_SCROLL(func) \