+const short kMacMinHeap = (29 * 1024) ;
+// platform specific static variables
+
+const short kwxMacMenuBarResource = 1 ;
+const short kwxMacAppleMenuId = 1 ;
+
+WXHRGN wxApp::s_macCursorRgn = NULL;
+wxWindow* wxApp::s_captureWindow = NULL ;
+int wxApp::s_lastMouseDown = 0 ;
+long wxApp::sm_lastMessageTime = 0;
+long wxApp::s_lastModifiers = 0 ;
+
+
+bool wxApp::s_macDefaultEncodingIsPC = true ;
+bool wxApp::s_macSupportPCMenuShortcuts = true ;
+long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
+wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
+
+pascal OSErr AEHandleODoc( 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 AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
+
+
+pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
+{
+ // GD: UNUSED wxApp* app = (wxApp*) refcon ;
+ return wxTheApp->MacHandleAEODoc( (AppleEvent*) event , reply) ;
+}
+
+pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
+{
+ // GD: UNUSED wxApp* app = (wxApp*) refcon ;
+ return wxTheApp->MacHandleAEOApp( (AppleEvent*) event , reply ) ;
+}
+
+pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
+{
+ // GD: UNUSED wxApp* app = (wxApp*) refcon ;
+ return wxTheApp->MacHandleAEPDoc( (AppleEvent*) event , reply ) ;
+}
+
+pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
+{
+ // GD: UNUSED wxApp* app = (wxApp*) refcon ;
+ return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
+}
+
+// new virtual public method in wxApp
+void wxApp::MacOpenFile(const wxString & WXUNUSED(fileName) )
+{
+}
+
+void wxApp::MacPrintFile(const wxString & WXUNUSED(fileName) )
+{
+}
+
+void wxApp::MacNewFile()
+{
+}
+
+// new implementation, which parses the event and calls
+// MacOpenFile on each of the files it's passed
+short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply))
+{
+ AEDescList docList;
+ AEKeyword keywd;
+ DescType returnedType;
+ Size actualSize;
+ long itemsInList;
+ FSSpec theSpec;
+ OSErr err;
+ short i;
+ err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
+ if (err != noErr)
+ return err;
+
+ err = AECountItems(&docList, &itemsInList);
+ if (err != noErr)
+ return err;
+
+ ProcessSerialNumber PSN ;
+ PSN.highLongOfPSN = 0 ;
+ PSN.lowLongOfPSN = kCurrentProcess ;
+ SetFrontProcess( &PSN ) ;
+
+ for (i = 1; i <= itemsInList; i++) {
+ AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
+ (Ptr) & theSpec, sizeof(theSpec), &actualSize);
+ wxString fName = wxMacFSSpec2MacFilename(&theSpec);
+ MacOpenFile(fName);
+ }
+ return noErr;
+}
+
+short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply))
+{
+ AEDescList docList;
+ AEKeyword keywd;
+ DescType returnedType;
+ Size actualSize;
+ long itemsInList;
+ FSSpec theSpec;
+ OSErr err;
+ short i;
+ err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList);
+ if (err != noErr)
+ return err;
+
+ err = AECountItems(&docList, &itemsInList);
+ if (err != noErr)
+ return err;
+
+ ProcessSerialNumber PSN ;
+ PSN.highLongOfPSN = 0 ;
+ PSN.lowLongOfPSN = kCurrentProcess ;
+ SetFrontProcess( &PSN ) ;
+
+ for (i = 1; i <= itemsInList; i++) {
+ AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType,
+ (Ptr) & theSpec, sizeof(theSpec), &actualSize);
+ wxString fName = wxMacFSSpec2MacFilename(&theSpec);
+ MacPrintFile(fName);
+ }
+ return noErr;
+}
+
+short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
+{
+ MacNewFile() ;
+ return noErr ;
+}