]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/app.cpp
Made ico files binary
[wxWidgets.git] / src / mac / carbon / app.cpp
index fe737ce9e6710580dab8b918393b6f35b210c773..356c2b2ecc511dc36119169c7734aecb9964fb36 100644 (file)
@@ -696,6 +696,12 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
     return true;
 }
 
     return true;
 }
 
+AEEventHandlerUPP sODocHandler = NULL ;
+AEEventHandlerUPP sOAppHandler = NULL ;
+AEEventHandlerUPP sPDocHandler = NULL ;
+AEEventHandlerUPP sRAppHandler = NULL ;
+AEEventHandlerUPP sQuitHandler = NULL ;
+
 bool wxApp::OnInitGui()
 {
     if( !wxAppBase::OnInitGui() )
 bool wxApp::OnInitGui()
 {
     if( !wxAppBase::OnInitGui() )
@@ -712,21 +718,22 @@ bool wxApp::OnInitGui()
 
     if (!sm_isEmbedded)
     {
 
     if (!sm_isEmbedded)
     {
+        sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ;
+        sOAppHandler = NewAEEventHandlerUPP(AEHandleOApp) ;
+        sPDocHandler = NewAEEventHandlerUPP(AEHandlePDoc) ;
+        sRAppHandler = NewAEEventHandlerUPP(AEHandleRApp) ;
+        sQuitHandler = NewAEEventHandlerUPP(AEHandleQuit) ;
+
         AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
         AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
-                               NewAEEventHandlerUPP(AEHandleODoc) ,
-                               0 , FALSE ) ;
+                               sODocHandler , 0 , FALSE ) ;
         AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
         AEInstallEventHandler( kCoreEventClass , kAEOpenApplication ,
-                               NewAEEventHandlerUPP(AEHandleOApp) ,
-                               0 , FALSE ) ;
+                               sOAppHandler , 0 , FALSE ) ;
         AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
         AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
-                               NewAEEventHandlerUPP(AEHandlePDoc) ,
-                               0 , FALSE ) ;
+                               sPDocHandler , 0 , FALSE ) ;
         AEInstallEventHandler( kCoreEventClass , kAEReopenApplication ,
         AEInstallEventHandler( kCoreEventClass , kAEReopenApplication ,
-                               NewAEEventHandlerUPP(AEHandleRApp) ,
-                               0 , FALSE ) ;
+                               sRAppHandler , 0 , FALSE ) ;
         AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
         AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
-                               NewAEEventHandlerUPP(AEHandleQuit) ,
-                               0 , FALSE ) ;
+                               sQuitHandler , 0 , FALSE ) ;
     }
 
     return TRUE ;
     }
 
     return TRUE ;
@@ -763,9 +770,30 @@ void wxApp::CleanUp()
         ::DisposeRgn((RgnHandle)s_macCursorRgn);
     }
 
         ::DisposeRgn((RgnHandle)s_macCursorRgn);
     }
 
-    #if 0
-        TerminateAE() ;
-    #endif
+    if (!sm_isEmbedded)
+    {
+        RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
+    }
+       
+    if (!sm_isEmbedded)
+    {
+        AERemoveEventHandler( kCoreEventClass , kAEOpenDocuments ,
+                               sODocHandler , FALSE ) ;
+        AERemoveEventHandler( kCoreEventClass , kAEOpenApplication ,
+                               sOAppHandler , FALSE ) ;
+        AERemoveEventHandler( kCoreEventClass , kAEPrintDocuments ,
+                               sPDocHandler , FALSE ) ;
+        AERemoveEventHandler( kCoreEventClass , kAEReopenApplication ,
+                               sRAppHandler , FALSE ) ;
+        AERemoveEventHandler( kCoreEventClass , kAEQuitApplication ,
+                               sQuitHandler , FALSE ) ;
+                               
+        DisposeAEEventHandlerUPP( sODocHandler ) ;
+        DisposeAEEventHandlerUPP( sOAppHandler ) ;
+        DisposeAEEventHandlerUPP( sPDocHandler ) ;
+        DisposeAEEventHandlerUPP( sRAppHandler ) ;
+        DisposeAEEventHandlerUPP( sQuitHandler ) ;
+    }
 
     wxAppBase::CleanUp();
 }
 
     wxAppBase::CleanUp();
 }