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) ;
{
error = kMacSTROldSystem ;
}
- else if ( theSystem < 0x0750 )
+ else if ( theSystem < 0x0860 )
{
error = kMacSTROldSystem ;
}
#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__
wxDebugContext::SetCheckpoint();
#endif
#endif
- if (!wxApp::Initialize()) {
+ if (!wxEntryStart(argc, argv)) {
return 0;
}
// create the application object or ensure that one already exists
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
wxTheApp->OnExit();
- wxApp::CleanUp();
+ wxEntryCleanup();
return retValue;
}
MacConvertPrivateToPublicScrap() ;
}
- UMAHideFloatingWindows() ;
+ ::HideFloatingWindows() ;
}
void wxApp::MacResume( bool convertClipboard )
MacConvertPublicToPrivateScrap() ;
}
- UMAShowFloatingWindows() ;
+ ::ShowFloatingWindows() ;
}
void wxApp::MacConvertPrivateToPublicScrap()
{
EventRecord event ;
- long sleepTime = 1 ; // GetCaretTime() / 4 ;
+ long sleepTime = 1; // GetCaretTime() / 4 ;
- if (WaitNextEvent(everyEvent, &event,sleepTime, s_macCursorRgn))
+ if (WaitNextEvent(everyEvent, &event, sleepTime, s_macCursorRgn))
{
- MacHandleOneEvent( &event );
+ MacHandleOneEvent( &event );
}
else
{
// idlers
- WindowPtr window = UMAFrontWindow() ;
+ WindowPtr window = ::FrontWindow() ;
if ( window )
- UMAIdleControls( window ) ;
+ ::IdleControls( window ) ;
wxTheApp->ProcessIdle() ;
}
// repeaters
- DeletePendingObjects() ;
+ DeletePendingObjects() ;
wxMacProcessNotifierAndPendingEvents() ;
}
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 ) ;
{
if ( win )
win->MacMouseDown( ev , windowPart ) ;
- UMASelectWindow( window ) ;
+ ::SelectWindow( window ) ;
}
}
else
}
}
+long wxMacTranslateKey(unsigned char key, unsigned char code) ;
long wxMacTranslateKey(unsigned char key, unsigned char code)
{
long retval = key ;
{
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 )
// 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 )
{
// 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 ;
break ;
default:
{
- if ( s_lastMouseDown == 0 )
- ev->modifiers |= btnState ;
-
+ // if ( s_lastMouseDown == 0 )
+ // ev->modifiers |= btnState ;
+
+ // Calling GetNextEvent with a zero event mask will always
+ // pass back a null event. However, it fills the EventRecord
+ // with the state of the modifier keys. This is needed since
+ // the modifier state returned by WaitForNextEvent often is
+ // wrong mouse move events. The attempt above to correct this
+ // didn't always work (under OS X at least).
+
+ EventRecord tmp;
+ ::GetNextEvent(0, &tmp);
+ ev->modifiers = tmp.modifiers;
+
wxWindow* win = wxFindWinFromMacWindow( window ) ;
if ( win )
win->MacMouseMoved( ev , windowPart ) ;