extracted the part of ProcessEvent() which is repeated multiple times during the handling of a single event in the new ProcessEventHere() method; this ensures that wxApp::FilterEvent() is not called multiple times for the same event unnecessarily
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2343,6 +2343,10 @@ public:
|
|||||||
void SetClientData( void *data ) { DoSetClientData(data); }
|
void SetClientData( void *data ) { DoSetClientData(data); }
|
||||||
void *GetClientData() const { return DoGetClientData(); }
|
void *GetClientData() const { return DoGetClientData(); }
|
||||||
|
|
||||||
|
|
||||||
|
// implementation from now on
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
// check if the given event table entry matches this event and call the
|
// check if the given event table entry matches this event and call the
|
||||||
// handler if it does
|
// handler if it does
|
||||||
//
|
//
|
||||||
@@ -2352,7 +2356,6 @@ public:
|
|||||||
wxEvtHandler *handler,
|
wxEvtHandler *handler,
|
||||||
wxEvent& event);
|
wxEvent& event);
|
||||||
|
|
||||||
// implementation from now on
|
|
||||||
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
|
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
|
||||||
bool SearchDynamicEventTable( wxEvent& event );
|
bool SearchDynamicEventTable( wxEvent& event );
|
||||||
|
|
||||||
@@ -2360,6 +2363,20 @@ public:
|
|||||||
void ClearEventHashTable() { GetEventHashTable().Clear(); }
|
void ClearEventHashTable() { GetEventHashTable().Clear(); }
|
||||||
void OnSinkDestroyed( wxEvtHandler *sink );
|
void OnSinkDestroyed( wxEvtHandler *sink );
|
||||||
|
|
||||||
|
|
||||||
|
// The method processing the event in this event handler (or rather in this
|
||||||
|
// event handler chain as it also tries the next handler and so on), i.e.
|
||||||
|
// it returns true if we processed this event or false if we didn't but
|
||||||
|
// does not call TryParent() in the latter case. It also doesn't call
|
||||||
|
// wxApp::FilterEvent() before processing it, this is supposed to be done
|
||||||
|
// by the public ProcessEvent() only once for every event we handle.
|
||||||
|
//
|
||||||
|
// It is meant to be called from ProcessEvent() only and is not virtual,
|
||||||
|
// additional event handlers can be hooked into the normal event processing
|
||||||
|
// logic using TryValidator() hook.
|
||||||
|
bool ProcessEventHere(wxEvent& event);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const wxEventTableEntry sm_eventTableEntries[];
|
static const wxEventTableEntry sm_eventTableEntries[];
|
||||||
|
|
||||||
|
@@ -1304,6 +1304,16 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
|
|||||||
//else: proceed normally
|
//else: proceed normally
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ProcessEventHere(event) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// propagate the event upwards the window chain and/or to the application
|
||||||
|
// object if it wasn't processed at this level
|
||||||
|
return TryParent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxEvtHandler::ProcessEventHere(wxEvent& event)
|
||||||
|
{
|
||||||
// An event handler can be enabled or disabled
|
// An event handler can be enabled or disabled
|
||||||
if ( GetEvtHandlerEnabled() )
|
if ( GetEvtHandlerEnabled() )
|
||||||
{
|
{
|
||||||
@@ -1322,17 +1332,11 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try going down the event handler chain
|
// Try going down the event handler chain
|
||||||
if ( GetNextHandler() )
|
if ( GetNextHandler() && GetNextHandler()->ProcessEventHere(event) )
|
||||||
{
|
return true;
|
||||||
// notice that we shouldn't let the parent have the event even if the
|
|
||||||
// next handler does not process it because it will have already passed
|
|
||||||
// it to the parent in this case
|
|
||||||
return GetNextHandler()->ProcessEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finally propagate the event upwards the window chain and/or to the
|
// We don't have a handler for this event.
|
||||||
// application object as necessary
|
return false;
|
||||||
return TryParent(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxEvtHandler::SafelyProcessEvent(wxEvent& event)
|
bool wxEvtHandler::SafelyProcessEvent(wxEvent& event)
|
||||||
|
Reference in New Issue
Block a user