git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64094
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
{
short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
{
- wxWindow* win = GetTopWindow() ;
- if ( win )
+ wxCloseEvent event;
+ wxTheApp->OnQueryEndSession(event);
+ if ( !event.GetVeto() )
- wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId);
- if (!win->GetEventHandler()->ProcessEvent(exitEvent))
- win->Close(true) ;
+ wxCloseEvent event;
+ wxTheApp->OnEndSession(event);
- else
- {
- ExitMainLoop() ;
- }
-
// user can veto the close, and therefore the end session.
void wxApp::OnQueryEndSession(wxCloseEvent& event)
{
// user can veto the close, and therefore the end session.
void wxApp::OnQueryEndSession(wxCloseEvent& event)
{
+ if ( !wxDialog::OSXHasModalDialogsOpen() )
+ {
+ if (GetTopWindow())
+ {
+ if (!GetTopWindow()->Close(!event.CanVeto()))
+ event.Veto(true);
+ }
+ }
+ else
- if (!GetTopWindow()->Close(!event.CanVeto()))
- event.Veto(true);