backport, add our own Apple Event handler for the quit app event, see #16200

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2014-04-25 13:02:48 +00:00
parent 97c3a5b698
commit a246e4c911

View File

@@ -61,6 +61,9 @@ void wxBell()
[appleEventManager setEventHandler:self andSelector:@selector(handleOpenAppEvent:withReplyEvent:)
forEventClass:kCoreEventClass andEventID:kAEOpenApplication];
[appleEventManager setEventHandler:self andSelector:@selector(handleQuitAppEvent:withReplyEvent:)
forEventClass:kCoreEventClass andEventID:kAEQuitApplication];
wxTheApp->OSXOnWillFinishLaunching();
}
@@ -134,6 +137,16 @@ void wxBell()
wxTheApp->OSXStoreOpenURL(cf.AsString());
}
- (void)handleQuitAppEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
if ( wxTheApp->OSXOnShouldTerminate() )
{
wxTheApp->OSXOnWillTerminate();
wxTheApp->ExitMainLoop();
}
}
- (void)handleOpenAppEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{