+wxEventFilter* wxEvtHandler::ms_filterList = NULL;
+
+/* static */ void wxEvtHandler::AddFilter(wxEventFilter* filter)
+{
+ wxCHECK_RET( filter, "NULL filter" );
+
+ filter->m_next = ms_filterList;
+ ms_filterList = filter;
+}
+
+/* static */ void wxEvtHandler::RemoveFilter(wxEventFilter* filter)
+{
+ wxEventFilter* prev = NULL;
+ for ( wxEventFilter* f = ms_filterList; f; f = f->m_next )
+ {
+ if ( f == filter )
+ {
+ // Set the previous list element or the list head to the next
+ // element.
+ if ( prev )
+ prev->m_next = f->m_next;
+ else
+ ms_filterList = f->m_next;
+
+ // Also reset the next pointer in the filter itself just to avoid
+ // having possibly dangling pointers, even though it's not strictly
+ // necessary.
+ f->m_next = NULL;
+
+ // Skip the assert below.
+ return;
+ }
+ }
+
+ wxFAIL_MSG( "Filter not found" );
+}
+