]> git.saurik.com Git - wxWidgets.git/commitdiff
further routing into wxApp
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 22 Jul 2013 18:33:01 +0000 (18:33 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 22 Jul 2013 18:33:01 +0000 (18:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/app.h
src/osx/carbon/app.cpp
src/osx/cocoa/utils.mm

index 0efd8c05a73d0f0f3d5cc6ca9ecc2e1ff4f8d9ad..c940c0bb18a24e0bd474d854f4a39165a191cde0 100644 (file)
@@ -146,7 +146,11 @@ public:
     virtual void         OSXOnWillFinishLaunching();
     // immediately when the native event loop starts, no events have been served yet
     virtual void         OSXOnDidFinishLaunching();
     virtual void         OSXOnWillFinishLaunching();
     // immediately when the native event loop starts, no events have been served yet
     virtual void         OSXOnDidFinishLaunching();
-
+    // OS asks to terminate app, return no to stay running
+    virtual bool         OSXOnShouldTerminate();
+    // before application terminates
+    virtual void         OSXOnWillTerminate();
+    
     // Hide the application windows the same as the system hide command would do it.
     void MacHideApp();
 
     // Hide the application windows the same as the system hide command would do it.
     void MacHideApp();
 
index f24210f1ca93bbf80a63373b58fd4c23ca85318d..aee21c66f6a1b7893b85bd16e0fcf7e279b47cce 100644 (file)
@@ -407,6 +407,21 @@ void wxApp::OSXOnWillFinishLaunching()
 
 void wxApp::OSXOnDidFinishLaunching()
 {
 
 void wxApp::OSXOnDidFinishLaunching()
 {
+    
+}
+
+void wxApp::OSXOnWillTerminate()
+{
+    wxCloseEvent event;
+    event.SetCanVeto(false);
+    wxTheApp->OnEndSession(event);
+}
+
+bool wxApp::OSXOnShouldTerminate()
+{
+    wxCloseEvent event;
+    wxTheApp->OnQueryEndSession(event);
+    return !event.GetVeto();
 }
 
 //----------------------------------------------------------------------
 }
 
 //----------------------------------------------------------------------
index 94716dd31e65003a3028d5a8262f81b9e4e863f0..77289eb9137deb81210858ff8f56d9a43e10bdf4 100644 (file)
@@ -126,9 +126,7 @@ void wxBell()
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
 {
     wxUnusedVar(sender);
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
 {
     wxUnusedVar(sender);
-    wxCloseEvent event;
-    wxTheApp->OnQueryEndSession(event);
-    if ( event.GetVeto() )
+    if ( !wxTheApp->OSXOnShouldTerminate() )
         return NSTerminateCancel;
     
     return NSTerminateNow;
         return NSTerminateCancel;
     
     return NSTerminateNow;
@@ -136,9 +134,7 @@ void wxBell()
 
 - (void)applicationWillTerminate:(NSNotification *)application {
     wxUnusedVar(application);
 
 - (void)applicationWillTerminate:(NSNotification *)application {
     wxUnusedVar(application);
-    wxCloseEvent event;
-    event.SetCanVeto(false);
-    wxTheApp->OnEndSession(event);
+    wxTheApp->OSXOnWillTerminate();
 }
 
 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
 }
 
 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender