-bool wxApp::ProcessIdle()
-{
- wxIdleEvent event;
- event.SetEventObject( this );
- ProcessEvent( event );
-
- return event.MoreRequested();
-}
-
-void wxApp::OnIdle( wxIdleEvent &event )
-{
- static bool s_inOnIdle = FALSE;
-
- // Avoid recursion (via ProcessEvent default case)
- if (s_inOnIdle)
- return;
-
- s_inOnIdle = TRUE;
-
- // Resend in the main thread events which have been prepared in other
- // threads
- ProcessPendingEvents();
-
- // 'Garbage' collection of windows deleted with Close()
- DeletePendingObjects();
-
- // Send OnIdle events to all windows
- bool needMore = SendIdleEvents();
-
- if (needMore)
- event.RequestMore(TRUE);
-
- s_inOnIdle = FALSE;
-}
-
-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();
- }
-
- node = wxTopLevelWindows.GetFirst();
- while (node)
- {
- wxWindow* win = node->GetData();
- CallInternalIdle( win );
-
- node = node->GetNext();
- }
- return needMore;
-}
-
-bool wxApp::CallInternalIdle( wxWindow* win )
-{
- win->OnInternalIdle();
-
- wxNode* node = win->GetChildren().First();
- while (node)
- {
- wxWindow* win = (wxWindow*) node->Data();
- CallInternalIdle( win );
-
- node = node->Next();
- }
-
- return TRUE;
-}
-
-bool wxApp::SendIdleEvents( wxWindow* win )
-{
- bool needMore = FALSE;
-
- wxIdleEvent event;
- event.SetEventObject(win);
-
- win->GetEventHandler()->ProcessEvent(event);
-
- if (event.MoreRequested())
- needMore = TRUE;
-
- wxNode* node = win->GetChildren().First();
- while (node)
- {
- wxWindow* win = (wxWindow*) node->Data();
- if (SendIdleEvents(win))
- needMore = TRUE;
-
- node = node->Next();
- }
-
- return needMore;
-}
-
-int wxApp::MainLoop()
-{
- gtk_main();
- return 0;
-}
-
-void wxApp::ExitMainLoop()
-{
- if (gtk_main_level() > 0)
- gtk_main_quit();
-}
-
-bool wxApp::Initialized()
-{
- return m_initialized;
-}
-
-bool wxApp::Pending()
-{
- return (gtk_events_pending() > 0);
-}
-
-void wxApp::Dispatch()
-{
- gtk_main_iteration();
-}
-
-void wxApp::DeletePendingObjects()
-{
- wxNode *node = wxPendingDelete.First();
- while (node)
- {
- wxObject *obj = (wxObject *)node->Data();
-
- delete obj;
-
- if (wxPendingDelete.Find(obj))
- delete node;
-
- node = wxPendingDelete.First();
- }
-}
-
-bool wxApp::Initialize()
-{
- wxClassInfo::InitializeClasses();
-
-#if wxUSE_INTL
- wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
-#endif
-
- // GL: I'm annoyed ... I don't know where to put this and I don't want to
- // create a module for that as it's part of the core.
-#if wxUSE_THREADS
- wxPendingEvents = new wxList();
- wxPendingEventsLocker = new wxCriticalSection();
-#endif
-
- wxTheColourDatabase = new wxColourDatabase( wxKEY_STRING );
- wxTheColourDatabase->Initialize();
-
- wxInitializeStockLists();
- wxInitializeStockObjects();
-
-#if wxUSE_WX_RESOURCES
- wxInitializeResourceSystem();
-#endif
-
- wxModule::RegisterModules();
- if (!wxModule::InitializeModules()) return FALSE;
-
- return TRUE;
-}
-
-void wxApp::CleanUp()