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