bool m_wasProcessed;
// this flag is used by ProcessEventLocally() to prevent ProcessEvent()
- // from doing its usual stuff and force it to just call ProcessEventHere()
- // instead, see the comment there explaining why is this needed
+ // from doing its usual stuff and force it to just call TryHere() instead,
+ // see the comment there explaining why is this needed
bool m_processHereOnly;
protected:
void OnSinkDestroyed( wxEvtHandler *sink );
- // The method tries to process the event in this event handler.
- //
- // It is called from ProcessEventLocally() and normally shouldn't be called
- // directly as doing it would ignore any chained event handlers.
- bool ProcessEventHere(wxEvent& event);
-
-
private:
void DoBind(int winid,
int lastId,
// validators.
virtual bool TryBefore(wxEvent& event);
+ // this one is not a hook but just a helper which looks up the handler in
+ // this object itself called from ProcessEventLocally() and normally
+ // shouldn't be called directly as doing it would ignore any chained event
+ // handlers
+ bool TryHere(wxEvent& event);
+
// this one is called after failing to find the event handle in our own
// table to give a chance to the other windows to process it
//
the chain until the event is processed or the chain is exhausted.
This function is called from ProcessEvent() and, in turn, calls
- ProcessEventHere() for each handler in turn. It is not virtual and so
- cannot be overridden but can, and should, be called to forward an event
- to another handler instead of ProcessEvent() which would result in a
+ TryThis() for each handler in turn. It is not virtual and so cannot be
+ overridden but can, and should, be called to forward an event to
+ another handler instead of ProcessEvent() which would result in a
duplicate call to TryAfter(), e.g. resulting in all unprocessed events
being sent to the application object multiple times.
*/
bool ProcessEventLocally(wxEvent& event);
- /**
- Try to process the event in this event handler.
-
- This method is called from ProcessEventLocally() and thus,
- indirectly, from ProcessEvent(), please see the detailed description of
- the event processing logic there.
-
- It is @em not virtual and so may not be overridden.
-
- @since 2.9.1
-
- @param event
- Event to process.
- @return
- @true if this object itself defines a handler for this event and
- the handler didn't skip the event.
- */
- bool ProcessEventHere(wxEvent& event);
-
/**
Processes an event by calling ProcessEvent() and handles any exceptions
that occur in the process.
};
@endcode
- @see ProcessEvent(), ProcessEventHere()
+ @see ProcessEvent()
*/
virtual bool TryBefore(wxEvent& event);
+ /**
+ Try to process the event in this event handler.
+
+ This method is called from ProcessEventLocally() and thus, indirectly,
+ from ProcessEvent(), please see the detailed description of the event
+ processing logic there.
+
+ It is currently @em not virtual and so may not be overridden.
+
+ @since 2.9.1
+
+ @param event
+ Event to process.
+ @return
+ @true if this object itself defines a handler for this event and
+ the handler didn't skip the event.
+ */
+ bool TryThis(wxEvent& event);
+
/**
Method called by ProcessEvent() as last resort.
};
@endcode
- @see ProcessEvent(), ProcessEventHere()
+ @see ProcessEvent()
*/
virtual bool TryAfter(wxEvent& event);
};
This method is similar to ProcessWindowEvent() but can be used to
search for the event handler only in this window and any event handlers
pushed on top of it. Unlike ProcessWindowEvent() it won't propagate the
- event upwards. But unlike wxEvtHandler::ProcessEventHere() it will use
- the event handlers associated with this window.
+ event upwards. But it will use the validator and event handlers
+ associated with this window, if any.
@since 2.9.1
*/
// Short circuit the event processing logic if we're requested to process
// this event in this handler only, see DoTryChain() for more details.
if ( event.ShouldProcessHereOnly() )
- return ProcessEventHere(event);
+ return TryHere(event);
// Try to process the event in this handler itself.
// 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 ( ProcessEventHere(event) )
+ if ( TryHere(event) )
return true;
// Finally try the event handlers chained to this one,
// ProcessEvent() from which we were called or will be done by it when
// we return.
//
- // However we must call ProcessEvent() and not ProcessEventHere()
- // 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.
+ // 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
- // ProcessEventHere() and won't do anything else, just as we want it to.
+ // 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::ProcessEventHere(wxEvent& event)
+bool wxEvtHandler::TryHere(wxEvent& event)
{
// If the event handler is disabled it doesn't process any events
if ( !GetEvtHandlerEnabled() )
if ( event.GetEventObject() == this )
{
wxValidator * const validator = GetValidator();
- if ( validator && validator->ProcessEventHere(event) )
+ if ( validator && validator->ProcessEventLocally(event) )
{
return true;
}