return noErr ;
}
-// AEQuit attempts to quite the application
+// AEQuit attempts to quit the application
short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply))
{
static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
- OSStatus result = eventNotHandledErr ;
- UInt32 kind = GetEventKind( event ) ;
-
- return result ;
+ return eventNotHandledErr ;
}
// due to the rather low-level event API of wxWindows, we cannot use RunApplicationEventLoop
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize();
-#ifdef __WXDEBUG__
-#if wxUSE_LOG
- // flush the logged messages if any and install a 'safer' log target: the
- // default one (wxLogGui) can't be used after the resources are freed just
- // below and the user suppliedo ne might be even more unsafe (using any
- // wxWindows GUI function is unsafe starting from now)
- wxLog::DontCreateOnDemand();
+ wxWinMacWindowList = new wxList(wxKEY_INTEGER);
+ wxWinMacControlList = new wxList(wxKEY_INTEGER);
- // this will flush the old messages if any
- delete wxLog::SetActiveTarget(new wxLogStderr);
-#endif // wxUSE_LOG
-#endif
-
- wxWinMacWindowList = new wxList(wxKEY_INTEGER);
- wxWinMacControlList = new wxList(wxKEY_INTEGER);
+ wxInitializeStockLists();
+ wxInitializeStockObjects();
- wxInitializeStockLists();
- wxInitializeStockObjects();
+ wxBitmap::InitStandardHandlers();
- wxBitmap::InitStandardHandlers();
-
- wxModule::RegisterModules();
- if (!wxModule::InitializeModules()) {
- return FALSE;
- }
+ wxModule::RegisterModules();
+ if (!wxModule::InitializeModules()) {
+ return FALSE;
+ }
- wxMacCreateNotifierTable() ;
+ wxMacCreateNotifierTable() ;
- UMAShowArrowCursor() ;
+ UMAShowArrowCursor() ;
- return TRUE;
+ return TRUE;
}
bool wxApp::OnInitGui()
delete wxWinMacControlList ;
}
delete wxPendingEvents;
+ wxPendingEvents = NULL;
#if wxUSE_THREADS
delete wxPendingEventsLocker;
+ // There is still more cleanup code that will try to use this if not NULL.
+ wxPendingEventsLocker = NULL;
// If we don't do the following, we get an apparent memory leak.
((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
#endif
theModule = NSModuleForSymbol(theSymbol);
theLibPath = NSLibraryNameForModule(theModule);
+ // if we call wxLogDebug from here then, as wxTheApp hasn't been
+ // created yet when we're called from wxApp::Initialize(), wxLog
+ // is going to create a default stderr-based log target instead of
+ // the expected normal GUI one -- don't do it, if we really want
+ // to see this message just use fprintf() here
+#if 0
wxLogDebug( wxT("wxMac library installation name is '%s'"),
theLibPath );
+#endif
// allocate copy to replace .dylib.* extension with .rsrc
theResPath = strdup(theLibPath);
// overwrite extension with ".rsrc"
strcpy(theExt, ".rsrc");
+#if 0
wxLogDebug( wxT("wxMac resources file name is '%s'"),
theResPath );
+#endif
theErr = FSPathMakeRef((UInt8 *) theResPath, &theResRef, false);
if (theErr != noErr) {
&gSharedLibraryResource);
}
if (theErr != noErr) {
- wxLogDebug( wxT("unable to open wxMac resource file '%s'"),
- theResPath );
+#ifdef __WXDEBUG__
+ fprintf(stderr,
+ wxT("unable to open wxMac resource file '%s'\n"),
+ theResPath );
+#endif // __WXDEBUG__
}
// free duplicated resource file path
while (node)
{
wxTopLevelWindow* win = (wxTopLevelWindow*) node->Data();
- win->MacActivate( ((EventRecord*) MacGetCurrentEvent())->when , false ) ;
+#if TARGET_CARBON
+#if 0 // having problems right now with that
+ if (!win->HasFlag(wxSTAY_ON_TOP))
+#endif
+#endif
+ win->MacActivate( ((EventRecord*) MacGetCurrentEvent())->when , false ) ;
node = node->GetNext();
}
void wxApp::MacHandleMenuCommand( wxUint32 id )
{
- wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
- wxMenu* menu = NULL ;
- wxMenuItem* item = NULL ;
- if ( mbar )
- {
- item = mbar->FindItem( id , &menu ) ;
- }
- wxCHECK_RET( item != NULL && menu != NULL && mbar != NULL, wxT("error in menu item callback") );
-
- if (item->IsCheckable())
- {
- item->Check( !item->IsChecked() ) ;
- }
-
- menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
+ wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
+ wxFrame* frame = mbar->GetFrame();
+ wxCHECK_RET( mbar != NULL && frame != NULL, wxT("error in menu item callback") );
+ if ( frame )
+ {
+ frame->ProcessCommand(id);
+ }
}
#if !TARGET_CARBON