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