Add wxEvtHandler::CallAfter() for asynchronous method calls.
Add wxAsyncMethodCallEvent that is handled simply by calling the method this event was created for and add default handler for this event to wxEvtHandler. Implement CallAfter() overloads for up to 2 parameters only for now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -156,8 +156,9 @@ const wxEventType wxEVT_NULL = wxNewEventType();
|
||||
|
||||
wxDEFINE_EVENT( wxEVT_IDLE, wxIdleEvent );
|
||||
|
||||
// Thread event
|
||||
// Thread and asynchronous call events
|
||||
wxDEFINE_EVENT( wxEVT_THREAD, wxThreadEvent );
|
||||
wxDEFINE_EVENT( wxEVT_ASYNC_METHOD_CALL, wxAsyncMethodCallEvent );
|
||||
|
||||
#endif // wxUSE_BASE
|
||||
|
||||
@@ -1564,6 +1565,15 @@ bool wxEvtHandler::TryHereOnly(wxEvent& event)
|
||||
if ( GetEventHashTable().HandleEvent(event, this) )
|
||||
return true;
|
||||
|
||||
// There is an implicit entry for async method calls procession in every
|
||||
// event handler:
|
||||
if ( event.GetEventType() == wxEVT_ASYNC_METHOD_CALL &&
|
||||
event.GetEventObject() == this )
|
||||
{
|
||||
static_cast<wxAsyncMethodCallEvent&>(event).Execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
// We don't have a handler for this event.
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user