git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18766
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
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 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 AEHandlePreferences( 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) )
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
}
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
}
+pascal OSErr AEHandlePreferences( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
+{
+ // GD: UNUSED wxApp* app = (wxApp*) refcon ;
+
+ wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
+ wxMenu* menu = NULL ;
+ wxMenuItem* item = NULL ;
+ if ( mbar )
+ {
+ item = mbar->FindItem( wxApp::s_macPreferencesMenuItemId , &menu ) ;
+ }
+ if ( item != NULL && menu != NULL && mbar != NULL )
+ menu->SendEvent( wxApp::s_macPreferencesMenuItemId , -1 ) ;
+ return noErr ;
+}
+
// new virtual public method in wxApp
void wxApp::MacOpenFile(const wxString & fileName )
{
// new virtual public method in wxApp
void wxApp::MacOpenFile(const wxString & fileName )
{
- while (m_keepGoing)
- {
- MacDoOneEvent() ;
- }
+#if TARGET_CARBON
+ if ( UMAGetSystemVersion() >= 0x1000 )
+ {
+ if ( s_macPreferencesMenuItemId )
+ {
+ EnableMenuCommand( NULL , kHICommandPreferences ) ;
+ AEInstallEventHandler( kCoreEventClass , kAEShowPreferences ,
+ NewAEEventHandlerUPP(AEHandlePreferences) ,
+ (long) wxTheApp , FALSE ) ;
+ }
+ }
+#endif
+ while (m_keepGoing)
+ {
+ MacDoOneEvent() ;
+ }
}
// Returns TRUE if more time is needed.
}
// Returns TRUE if more time is needed.
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 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 AEHandlePreferences( 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) )
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
}
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
}
+pascal OSErr AEHandlePreferences( const AppleEvent *event , AppleEvent *reply , long WXUNUSED(refcon) )
+{
+ // GD: UNUSED wxApp* app = (wxApp*) refcon ;
+
+ wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
+ wxMenu* menu = NULL ;
+ wxMenuItem* item = NULL ;
+ if ( mbar )
+ {
+ item = mbar->FindItem( wxApp::s_macPreferencesMenuItemId , &menu ) ;
+ }
+ if ( item != NULL && menu != NULL && mbar != NULL )
+ menu->SendEvent( wxApp::s_macPreferencesMenuItemId , -1 ) ;
+ return noErr ;
+}
+
// new virtual public method in wxApp
void wxApp::MacOpenFile(const wxString & fileName )
{
// new virtual public method in wxApp
void wxApp::MacOpenFile(const wxString & fileName )
{
- while (m_keepGoing)
- {
- MacDoOneEvent() ;
- }
+#if TARGET_CARBON
+ if ( UMAGetSystemVersion() >= 0x1000 )
+ {
+ if ( s_macPreferencesMenuItemId )
+ {
+ EnableMenuCommand( NULL , kHICommandPreferences ) ;
+ AEInstallEventHandler( kCoreEventClass , kAEShowPreferences ,
+ NewAEEventHandlerUPP(AEHandlePreferences) ,
+ (long) wxTheApp , FALSE ) ;
+ }
+ }
+#endif
+ while (m_keepGoing)
+ {
+ MacDoOneEvent() ;
+ }
}
// Returns TRUE if more time is needed.
}
// Returns TRUE if more time is needed.