Add wxEventFilter and related functionality.

Allow defining event filters to globally pre-process all application events
without having to override wxApp::FilterEvent().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69794 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-11-22 13:18:50 +00:00
parent feb32e3165
commit 58cc15871d
18 changed files with 350 additions and 24 deletions

View File

@@ -39,6 +39,7 @@
class WXDLLIMPEXP_FWD_BASE wxList;
class WXDLLIMPEXP_FWD_BASE wxEvent;
class WXDLLIMPEXP_FWD_BASE wxEventFilter;
#if wxUSE_GUI
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxMenu;
@@ -3013,6 +3014,19 @@ public:
bool IsUnlinked() const;
// Global event filters
// --------------------
// Add an event filter whose FilterEvent() method will be called for each
// and every event processed by wxWidgets. The filters are called in LIFO
// order and wxApp is registered as an event filter by default. The pointer
// must remain valid until it's removed with RemoveFilter() and is not
// deleted by wxEvtHandler.
static void AddFilter(wxEventFilter* filter);
// Remove a filter previously installed with AddFilter().
static void RemoveFilter(wxEventFilter* filter);
// Event queuing and processing
// ----------------------------
@@ -3360,6 +3374,9 @@ private:
// try to process events in all handlers chained to this one
bool DoTryChain(wxEvent& event);
// Head of the event filter linked list.
static wxEventFilter* ms_filterList;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler)
};