1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/eventfilter.h
3 // Purpose: wxEventFilter class declaration.
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_EVENTFILTER_H_
12 #define _WX_EVENTFILTER_H_
16 class WXDLLIMPEXP_FWD_BASE wxEvent
;
17 class WXDLLIMPEXP_FWD_BASE wxEvtHandler
;
19 // ----------------------------------------------------------------------------
20 // wxEventFilter is used with wxEvtHandler::AddFilter() and ProcessEvent().
21 // ----------------------------------------------------------------------------
26 // Possible return values for FilterEvent().
28 // Notice that the values of these enum elements are fixed due to backwards
29 // compatibility constraints.
32 // Process event as usual.
35 // Don't process the event normally at all.
38 // Event was already handled, don't process it normally.
47 virtual ~wxEventFilter()
49 wxASSERT_MSG( !m_next
, "Forgot to call wxEvtHandler::RemoveFilter()?" );
52 // This method allows to filter all the events processed by the program, so
53 // you should try to return quickly from it to avoid slowing down the
54 // program to a crawl.
56 // Return value should be -1 to continue with the normal event processing,
57 // or true or false to stop further processing and pretend that the event
58 // had been already processed or won't be processed at all, respectively.
59 virtual int FilterEvent(wxEvent
& event
) = 0;
62 // Objects of this class are made to be stored in a linked list in
63 // wxEvtHandler so put the next node ponter directly in the class itself.
64 wxEventFilter
* m_next
;
66 // And provide access to it for wxEvtHandler [only].
67 friend class wxEvtHandler
;
69 wxDECLARE_NO_COPY_CLASS(wxEventFilter
);
72 #endif // _WX_EVENTFILTER_H_