reopen app apple event

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-01-25 15:17:48 +00:00
parent 1f90939c20
commit 1c32ded32c
2 changed files with 54 additions and 0 deletions

View File

@@ -37,6 +37,7 @@
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/menu.h" #include "wx/menu.h"
#include "wx/docview.h" #include "wx/docview.h"
#include "wx/filename.h"
#include <string.h> #include <string.h>
@@ -123,6 +124,7 @@ pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long re
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ; pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ; pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) ; pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) ) pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
{ {
@@ -144,6 +146,11 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long WX
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ; return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
} }
pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
{
return wxTheApp->MacHandleAERApp( (AppleEvent*) event , reply) ;
}
// AEODoc Calls MacOpenFile on each of the files passed // AEODoc Calls MacOpenFile on each of the files passed
short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
@@ -236,6 +243,15 @@ short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU
return noErr ; return noErr ;
} }
// AEROApp calls MacReopenApp
short wxApp::MacHandleAERApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
{
MacReopenApp() ;
return noErr ;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Support Routines linking the Mac...File Calls to the Document Manager // Support Routines linking the Mac...File Calls to the Document Manager
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -279,6 +295,11 @@ void wxApp::MacNewFile()
{ {
} }
void wxApp::MacReopenApp()
{
// eventually check for open docs, if none, call MacNewFile
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Carbon Event Handler // Carbon Event Handler
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -690,6 +711,9 @@ bool wxApp::OnInitGui()
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
NewAEEventHandlerUPP(AEHandlePDoc) , NewAEEventHandlerUPP(AEHandlePDoc) ,
0 , FALSE ) ; 0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEReopenApplication ,
NewAEEventHandlerUPP(AEHandleRApp) ,
0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
NewAEEventHandlerUPP(AEHandleQuit) , NewAEEventHandlerUPP(AEHandleQuit) ,
0 , FALSE ) ; 0 , FALSE ) ;
@@ -703,6 +727,9 @@ bool wxApp::OnInitGui()
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
NewAEEventHandlerProc(AEHandlePDoc) , NewAEEventHandlerProc(AEHandlePDoc) ,
0 , FALSE ) ; 0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEReopenApplication ,
NewAEEventHandlerProc(AEHandleRApp) ,
0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
NewAEEventHandlerProc(AEHandleQuit) , NewAEEventHandlerProc(AEHandleQuit) ,
0 , FALSE ) ; 0 , FALSE ) ;

View File

@@ -37,6 +37,7 @@
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/menu.h" #include "wx/menu.h"
#include "wx/docview.h" #include "wx/docview.h"
#include "wx/filename.h"
#include <string.h> #include <string.h>
@@ -123,6 +124,7 @@ pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long re
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ; pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ; pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) ; pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) ) pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
{ {
@@ -144,6 +146,11 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long WX
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ; return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
} }
pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
{
return wxTheApp->MacHandleAERApp( (AppleEvent*) event , reply) ;
}
// AEODoc Calls MacOpenFile on each of the files passed // AEODoc Calls MacOpenFile on each of the files passed
short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
@@ -236,6 +243,15 @@ short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU
return noErr ; return noErr ;
} }
// AEROApp calls MacReopenApp
short wxApp::MacHandleAERApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
{
MacReopenApp() ;
return noErr ;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Support Routines linking the Mac...File Calls to the Document Manager // Support Routines linking the Mac...File Calls to the Document Manager
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -279,6 +295,11 @@ void wxApp::MacNewFile()
{ {
} }
void wxApp::MacReopenApp()
{
// eventually check for open docs, if none, call MacNewFile
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Carbon Event Handler // Carbon Event Handler
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -690,6 +711,9 @@ bool wxApp::OnInitGui()
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
NewAEEventHandlerUPP(AEHandlePDoc) , NewAEEventHandlerUPP(AEHandlePDoc) ,
0 , FALSE ) ; 0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEReopenApplication ,
NewAEEventHandlerUPP(AEHandleRApp) ,
0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
NewAEEventHandlerUPP(AEHandleQuit) , NewAEEventHandlerUPP(AEHandleQuit) ,
0 , FALSE ) ; 0 , FALSE ) ;
@@ -703,6 +727,9 @@ bool wxApp::OnInitGui()
AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments ,
NewAEEventHandlerProc(AEHandlePDoc) , NewAEEventHandlerProc(AEHandlePDoc) ,
0 , FALSE ) ; 0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEReopenApplication ,
NewAEEventHandlerProc(AEHandleRApp) ,
0 , FALSE ) ;
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
NewAEEventHandlerProc(AEHandleQuit) , NewAEEventHandlerProc(AEHandleQuit) ,
0 , FALSE ) ; 0 , FALSE ) ;