return false;
}
-bool wxEvtHandler::TryParent(wxEvent& event)
+bool wxEvtHandler::DoTryApp(wxEvent& event)
{
- if ( GetNextHandler() )
- {
- // the next handler will pass it to wxTheApp if it doesn't process it,
- // so return from here to avoid doing it again
- return GetNextHandler()->TryParent(event);
- }
-
if ( wxTheApp && (this != wxTheApp) )
{
// Special case: don't pass wxEVT_IDLE to wxApp, since it'll always
return false;
}
+bool wxEvtHandler::TryBefore(wxEvent& event)
+{
+#ifdef WXWIN_COMPATIBILITY_2_8
+ // call the old virtual function to keep the code overriding it working
+ return TryValidator(event);
+#else
+ wxUnusedVar(event);
+ return false;
+#endif
+}
+
+bool wxEvtHandler::TryAfter(wxEvent& event)
+{
+#ifdef WXWIN_COMPATIBILITY_2_8
+ // as above, call the old virtual function for compatibility
+ return TryParent(event);
+#else
+ return DoTryApp(event);
+#endif
+}
+
bool wxEvtHandler::ProcessEvent(wxEvent& event)
{
// allow the application to hook into event processing
return true;
// pass the event to the next handler, notice that we shouldn't call
- // TryParent() even if it doesn't handle the event as the last handler in
+ // TryAfter() even if it doesn't handle the event as the last handler in
// the chain will do it
if ( GetNextHandler() )
return GetNextHandler()->ProcessEvent(event);
// propagate the event upwards the window chain and/or to the application
// object if it wasn't processed at this level
- return TryParent(event);
+ return TryAfter(event);
}
bool wxEvtHandler::ProcessEventHere(wxEvent& event)
if ( !GetEvtHandlerEnabled() )
return false;
- // If we have a validator, it has higher priority than our own event
- // handlers
- if ( TryValidator(event) )
+ // Try the hooks which should be called before our own handlers
+ if ( TryBefore(event) )
return true;
// Handle per-instance dynamic event tables first