-bool wxApp::Initialized()
-{
- if (GetTopWindow())
- return TRUE;
- else
- return FALSE;
-}
-
-int wxApp::MainLoop()
-{
- [m_cocoaApp run];
- return 0;
-}
-
-// Returns TRUE if more time is needed.
-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject(this);
- ProcessEvent(event);
-
- wxUpdateUIEvent::ResetUpdateTime();
-
- return event.MoreRequested();
-}
-
-void wxApp::ExitMainLoop()
-{
- wxLogDebug("wxApp::ExitMailLoop m_isIdle=%d, isRunning=%d",(int)m_isIdle,(int)[m_cocoaApp isRunning]);
-// CocoaInstallRequestedIdleHandler();
-// if(m_isIdle)
-// [[ NSRunLoop currentRunLoop ] performSelector:@selector(doIdle:) target:m_cocoaApp argument:NULL order:0 modes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, /* NSConnectionReplyRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode,*/ nil] ];
-// actually.. we WANT the idle event
-// or not
-#if 0
- if(!m_isIdle)
- [[ NSRunLoop currentRunLoop ] cancelPerformSelector:@selector(doIdle:) target:m_cocoaApp argument:NULL];
-#endif
- [m_cocoaApp terminate: m_cocoaApp];
-}
-
-// Is a message/event pending?
-bool wxApp::Pending()
-{
- return 0;
-}
-
-// Dispatch a message.
-void wxApp::Dispatch()
-{
-}
-
-void wxApp::OnIdle(wxIdleEvent& event)
-{
- wxLogDebug("wxApp::OnIdle");
- static bool s_inOnIdle = FALSE;
-
- // Avoid recursion (via ProcessEvent default case)
- if ( s_inOnIdle )
- return;
- s_inOnIdle = TRUE;
-
-
- DeletePendingObjects();
-
- // flush the logged messages if any
- wxLog *pLog = wxLog::GetActiveTarget();
- if ( pLog != NULL && pLog->HasPendingMessages() )
- pLog->Flush();
-
- // Send OnIdle events to all windows
- bool needMore = SendIdleEvents();
-
- if (needMore)
- event.RequestMore(TRUE);
-
- s_inOnIdle = FALSE;
-}
-
-// Send idle event to all top-level windows
-bool wxApp::SendIdleEvents()
-{
- bool needMore = FALSE;
- wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
- while (node)
- {
- wxWindow* win = node->GetData();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->GetNext();
- }
- return needMore;
-}
-
-// Send idle event to window and all subwindows
-bool wxApp::SendIdleEvents(wxWindow* win)