From 1c32ded32c384aaf63b3ada820ea65298e0fdf05 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 25 Jan 2004 15:17:48 +0000 Subject: [PATCH] reopen app apple event git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/app.cpp | 27 +++++++++++++++++++++++++++ src/mac/carbon/app.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/src/mac/app.cpp b/src/mac/app.cpp index a5f703819b..42e2c0aba8 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -37,6 +37,7 @@ #include "wx/textctrl.h" #include "wx/menu.h" #include "wx/docview.h" +#include "wx/filename.h" #include @@ -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 AEHandlePDoc( 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) ) { @@ -144,6 +146,11 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long WX 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 short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) @@ -236,6 +243,15 @@ short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU 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 //---------------------------------------------------------------------- @@ -279,6 +295,11 @@ void wxApp::MacNewFile() { } +void wxApp::MacReopenApp() +{ + // eventually check for open docs, if none, call MacNewFile +} + //---------------------------------------------------------------------- // Carbon Event Handler //---------------------------------------------------------------------- @@ -690,6 +711,9 @@ bool wxApp::OnInitGui() AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerUPP(AEHandlePDoc) , 0 , FALSE ) ; + AEInstallEventHandler( kCoreEventClass , kAEReopenApplication , + NewAEEventHandlerUPP(AEHandleRApp) , + 0 , FALSE ) ; AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerUPP(AEHandleQuit) , 0 , FALSE ) ; @@ -703,6 +727,9 @@ bool wxApp::OnInitGui() AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , 0 , FALSE ) ; + AEInstallEventHandler( kCoreEventClass , kAEReopenApplication , + NewAEEventHandlerProc(AEHandleRApp) , + 0 , FALSE ) ; AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , 0 , FALSE ) ; diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index a5f703819b..42e2c0aba8 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -37,6 +37,7 @@ #include "wx/textctrl.h" #include "wx/menu.h" #include "wx/docview.h" +#include "wx/filename.h" #include @@ -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 AEHandlePDoc( 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) ) { @@ -144,6 +146,11 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long WX 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 short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) @@ -236,6 +243,15 @@ short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU 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 //---------------------------------------------------------------------- @@ -279,6 +295,11 @@ void wxApp::MacNewFile() { } +void wxApp::MacReopenApp() +{ + // eventually check for open docs, if none, call MacNewFile +} + //---------------------------------------------------------------------- // Carbon Event Handler //---------------------------------------------------------------------- @@ -690,6 +711,9 @@ bool wxApp::OnInitGui() AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerUPP(AEHandlePDoc) , 0 , FALSE ) ; + AEInstallEventHandler( kCoreEventClass , kAEReopenApplication , + NewAEEventHandlerUPP(AEHandleRApp) , + 0 , FALSE ) ; AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerUPP(AEHandleQuit) , 0 , FALSE ) ; @@ -703,6 +727,9 @@ bool wxApp::OnInitGui() AEInstallEventHandler( kCoreEventClass , kAEPrintDocuments , NewAEEventHandlerProc(AEHandlePDoc) , 0 , FALSE ) ; + AEInstallEventHandler( kCoreEventClass , kAEReopenApplication , + NewAEEventHandlerProc(AEHandleRApp) , + 0 , FALSE ) ; AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , NewAEEventHandlerProc(AEHandleQuit) , 0 , FALSE ) ; -- 2.45.2