Use OnEndSession/OnQueryEndSession events instead of calling the functions directly.

This commit is contained in:
JulianSmart 2015-05-26 12:16:23 +01:00
parent 4c772b4221
commit cbb9c722cb

View File

@ -259,12 +259,16 @@ short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU
short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
{
wxCloseEvent event;
wxTheApp->OnQueryEndSession(event);
wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY);
event.SetEventObject(this);
event.SetCanVeto(true);
ProcessEvent(event);
if ( !event.GetVeto() )
{
wxCloseEvent event;
wxTheApp->OnEndSession(event);
wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY);
event.SetEventObject(this);
event.SetCanVeto(false);
ProcessEvent(event);
}
return noErr ;
}
@ -425,15 +429,18 @@ void wxApp::OSXOnDidFinishLaunching()
void wxApp::OSXOnWillTerminate()
{
wxCloseEvent event;
wxCloseEvent event(wxEVT_END_SESSION, wxID_ANY);
event.SetEventObject(this);
event.SetCanVeto(false);
wxTheApp->OnEndSession(event);
ProcessEvent(event);
}
bool wxApp::OSXOnShouldTerminate()
{
wxCloseEvent event;
wxTheApp->OnQueryEndSession(event);
wxCloseEvent event(wxEVT_QUERY_END_SESSION, wxID_ANY);
event.SetEventObject(this);
event.SetCanVeto(true);
ProcessEvent(event);
return !event.GetVeto();
}
#endif