shutdown sequence routing to EndSession calls

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2010-04-22 06:18:15 +00:00
parent 7934e44732
commit 2680ddc678

View File

@@ -249,18 +249,13 @@ 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))
{ {
wxWindow* win = GetTopWindow() ; wxCloseEvent event;
if ( win ) wxTheApp->OnQueryEndSession(event);
if ( !event.GetVeto() )
{ {
wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId); wxCloseEvent event;
if (!win->GetEventHandler()->ProcessEvent(exitEvent)) wxTheApp->OnEndSession(event);
win->Close(true) ;
} }
else
{
ExitMainLoop() ;
}
return noErr ; return noErr ;
} }
@@ -1127,10 +1122,17 @@ void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
// user can veto the close, and therefore the end session. // user can veto the close, and therefore the end session.
void wxApp::OnQueryEndSession(wxCloseEvent& event) void wxApp::OnQueryEndSession(wxCloseEvent& event)
{ {
if (GetTopWindow()) if ( !wxDialog::OSXHasModalDialogsOpen() )
{ {
if (!GetTopWindow()->Close(!event.CanVeto())) if (GetTopWindow())
event.Veto(true); {
if (!GetTopWindow()->Close(!event.CanVeto()))
event.Veto(true);
}
}
else
{
event.Veto(true);
} }
} }