X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8461e4c253d4cec65e8f0320246a56d22555eb5e..fa1c12bdd76acc21ddb45b90bb53b2f58aed946d:/src/mac/carbon/app.cpp?ds=sidebyside diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index ade0e6938e..eafd5536c6 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -94,41 +94,31 @@ bool wxApp::s_macSupportPCMenuShortcuts = true ; long wxApp::s_macAboutMenuItemId = wxID_ABOUT ; wxString wxApp::s_macHelpMenuTitleName = "&Help" ; -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) +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 refcon ) -#else -pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) -#endif { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEODoc( (AppleEvent*) event , reply) ; } -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon ) -#else -pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) -#endif { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEOApp( (AppleEvent*) event , reply ) ; } -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon ) -#else -pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) -#endif { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEPDoc( (AppleEvent*) event , reply ) ; } -#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) -#else -pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigned long refcon ) -#endif { wxApp* app = (wxApp*) refcon ; return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ; @@ -430,7 +420,7 @@ bool wxApp::Initialize() { error = kMacSTROldSystem ; } - else if ( theSystem < 0x0750 ) + else if ( theSystem < 0x0860 ) { error = kMacSTROldSystem ; } @@ -619,6 +609,28 @@ void wxApp::CleanUp() #endif } +//---------------------------------------------------------------------- +// wxEntry +//---------------------------------------------------------------------- + +int wxEntryStart( int argc, char *argv[] ) +{ + return wxApp::Initialize(); +} + + +int wxEntryInitGui() +{ + return wxTheApp->OnInitGui(); +} + + +void wxEntryCleanup() +{ + wxApp::CleanUp(); +} + + int wxEntry( int argc, char *argv[] , bool enterLoop ) { #ifdef __MWERKS__ @@ -632,7 +644,7 @@ int wxEntry( int argc, char *argv[] , bool enterLoop ) wxDebugContext::SetCheckpoint(); #endif #endif - if (!wxApp::Initialize()) { + if (!wxEntryStart(argc, argv)) { return 0; } // create the application object or ensure that one already exists @@ -657,7 +669,7 @@ int wxEntry( int argc, char *argv[] , bool enterLoop ) wxTheApp->argv = argv; // GUI-specific initialization, such as creating an app context. - wxTheApp->OnInitGui(); + wxEntryInitGui(); // we could try to get the open apple events here to adjust argc and argv better @@ -699,7 +711,7 @@ int wxEntry( int argc, char *argv[] , bool enterLoop ) wxTheApp->OnExit(); - wxApp::CleanUp(); + wxEntryCleanup(); return retValue; } @@ -976,7 +988,7 @@ void wxApp::MacSuspend( bool convertClipboard ) MacConvertPrivateToPublicScrap() ; } - UMAHideFloatingWindows() ; + ::HideFloatingWindows() ; } void wxApp::MacResume( bool convertClipboard ) @@ -987,7 +999,7 @@ void wxApp::MacResume( bool convertClipboard ) MacConvertPublicToPrivateScrap() ; } - UMAShowFloatingWindows() ; + ::ShowFloatingWindows() ; } void wxApp::MacConvertPrivateToPublicScrap() @@ -1011,9 +1023,9 @@ void wxApp::MacDoOneEvent() else { // idlers - WindowPtr window = UMAFrontWindow() ; + WindowPtr window = ::FrontWindow() ; if ( window ) - UMAIdleControls( window ) ; + ::IdleControls( window ) ; wxTheApp->ProcessIdle() ; } @@ -1093,10 +1105,10 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev ) wxToolTip::RemoveToolTips() ; WindowRef window; - WindowRef frontWindow = UMAFrontNonFloatingWindow() ; + WindowRef frontWindow = ::FrontNonFloatingWindow() ; WindowAttributes frontWindowAttributes = NULL ; if ( frontWindow ) - UMAGetWindowAttributes( frontWindow , &frontWindowAttributes ) ; + ::GetWindowAttributes( frontWindow , &frontWindowAttributes ) ; short windowPart = ::FindWindow(ev->where, &window); wxWindow* win = wxFindWinFromMacWindow( window ) ; @@ -1233,7 +1245,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev ) { if ( win ) win->MacMouseDown( ev , windowPart ) ; - UMASelectWindow( window ) ; + ::SelectWindow( window ) ; } } else @@ -1270,6 +1282,7 @@ void wxApp::MacHandleMouseUpEvent( EventRecord *ev ) } } +long wxMacTranslateKey(unsigned char key, unsigned char code) ; long wxMacTranslateKey(unsigned char key, unsigned char code) { long retval = key ; @@ -1517,11 +1530,11 @@ void wxApp::MacHandleActivateEvent( EventRecord *ev ) { bool activate = (ev->modifiers & activeFlag ) ; WindowClass wclass ; - UMAGetWindowClass ( window , &wclass ) ; + ::GetWindowClass ( window , &wclass ) ; if ( wclass == kFloatingWindowClass ) { // if it is a floater we activate/deactivate the front non-floating window instead - window = UMAFrontNonFloatingWindow() ; + window = ::FrontNonFloatingWindow() ; } wxWindow* win = wxFindWinFromMacWindow( window ) ; if ( win ) @@ -1585,11 +1598,11 @@ void wxApp::MacHandleOSEvent( EventRecord *ev ) // our idea of the active window with the process manager's - which it already activated if ( !doesActivate ) - oldFrontWindow = UMAFrontNonFloatingWindow() ; + oldFrontWindow = ::FrontNonFloatingWindow() ; MacResume( convertClipboard ) ; - newFrontWindow = UMAFrontNonFloatingWindow() ; + newFrontWindow = ::FrontNonFloatingWindow() ; if ( oldFrontWindow ) { @@ -1611,13 +1624,15 @@ void wxApp::MacHandleOSEvent( EventRecord *ev ) // in case this suspending did close an active window, another one might // have surfaced -> lets deactivate that one - WindowRef newActiveWindow = UMAGetActiveNonFloatingWindow() ; +/* TODO : find out what to do on systems < 10 , perhaps FrontNonFloatingWindow + WindowRef newActiveWindow = ::ActiveNonFloatingWindow() ; if ( newActiveWindow ) { wxWindow* win = wxFindWinFromMacWindow( newActiveWindow ) ; if ( win ) win->MacActivate( ev , false ) ; } +*/ } } break ;