+bool wxEvtHandler::ProcessEventLocally(wxEvent& event)
+{
+ // First try the hooks which should be called before our own handlers
+ if ( TryBefore(event) )
+ return true;
+
+ // Then try this handler itself, notice that we should not call
+ // ProcessEvent() on this one as we're already called from it, which
+ // explains why we do it here and not in DoTryChain()
+ if ( TryHere(event) )
+ return true;
+
+ // Finally try the event handlers chained to this one,
+ if ( DoTryChain(event) )
+ return true;
+
+ // And return false to indicate that we didn't find any handler at this
+ // level.
+ return false;
+}
+
+bool wxEvtHandler::DoTryChain(wxEvent& event)
+{
+ for ( wxEvtHandler *h = GetNextHandler(); h; h = h->GetNextHandler() )
+ {
+ // We need to process this event at the level of this handler only
+ // right now, the pre-/post-processing was either already done by
+ // ProcessEvent() from which we were called or will be done by it when
+ // we return.
+ //
+ // However we must call ProcessEvent() and not TryHere() because the
+ // existing code (including some in wxWidgets itself) expects the
+ // overridden ProcessEvent() in its custom event handlers pushed on a
+ // window to be called.
+ //
+ // So we must call ProcessEvent() but it must not do what it usually
+ // does. To resolve this paradox we pass a special "process here only"
+ // flag to ProcessEvent() via the event object itself. This ensures
+ // that if our own, base class, version is called, it will just call
+ // TryHere() and won't do anything else, just as we want it to.
+ wxEventProcessHereOnly processHereOnly(event);
+ if ( h->ProcessEvent(event) )
+ return true;
+ }
+
+ return false;
+}
+
+bool wxEvtHandler::TryHere(wxEvent& event)