]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mgl/app.cpp
Don't use result for both NS and wx button ID values.
[wxWidgets.git] / src / mgl / app.cpp
index 247d9558de569f09061bb0c55588ac2d04d1522f..eaa8a042564a6610911a152dfafb7453ca3e8309 100644 (file)
@@ -32,6 +32,7 @@
 #include "wx/univ/colschem.h"
 #include "wx/sysopt.h"
 #include "wx/mgl/private.h"
+#include "wx/private/fontmgr.h"
 
 //-----------------------------------------------------------------------------
 // wxApp::Exit()
@@ -43,54 +44,6 @@ void wxApp::Exit()
     exit(0);
 }
 
-//-----------------------------------------------------------------------------
-// wxYield
-//-----------------------------------------------------------------------------
-
-static bool gs_inYield = false;
-
-bool wxApp::Yield(bool onlyIfNeeded)
-{
-    if ( gs_inYield )
-    {
-        if ( !onlyIfNeeded )
-        {
-            wxFAIL_MSG( wxT("wxYield called recursively" ) );
-        }
-
-        return false;
-    }
-
-#if wxUSE_THREADS
-    if ( !wxThread::IsMain() )
-    {
-        // can't process events from other threads, MGL is thread-unsafe
-        return true;
-    }
-#endif // wxUSE_THREADS
-
-    gs_inYield = true;
-
-    wxLog::Suspend();
-
-    if ( wxEventLoop::GetActive() )
-    {
-        while (wxEventLoop::GetActive()->Pending())
-            wxEventLoop::GetActive()->Dispatch();
-    }
-
-    /* it's necessary to call ProcessIdle() to update the frames sizes which
-       might have been changed (it also will update other things set from
-       OnUpdateUI() which is a nice (and desired) side effect) */
-    while (wxTheApp->ProcessIdle()) { }
-
-    wxLog::Resume();
-
-    gs_inYield = false;
-
-    return true;
-}
-
 
 //-----------------------------------------------------------------------------
 // wxWakeUpIdle
@@ -124,7 +77,7 @@ class wxRootWindow : public wxWindow
             SetMGLwindow_t(MGL_wmGetRootWindow(g_winMng));
             SetBackgroundColour(wxTHEME_COLOUR(DESKTOP));
         }
-        ~wxRootWindow()
+        virtual ~wxRootWindow()
         {
             // we don't want to delete MGL_WM's rootWnd
             m_wnd = NULL;
@@ -199,11 +152,6 @@ static void wxDestroyMGL_WM()
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
 
-BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxAppBase::OnIdle)
-END_EVENT_TABLE()
-
-
 wxApp::wxApp()
 {
 }
@@ -283,14 +231,8 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
         return false;
     }
 
-    // must do it before calling wxAppBase::Initialize(), because fonts are
-    // needed by stock lists which are created there
-    wxTheFontsManager = new wxFontsManager;
-
     if ( !wxAppBase::Initialize(argc, argv) )
     {
-        delete wxTheFontsManager;
-        wxTheFontsManager = NULL;
         MGL_exit();
         return false;
     }
@@ -313,8 +255,7 @@ struct wxMGLFinalCleanup: public wxModule
 
     void OnExit()
     {
-        delete wxTheFontsManager;
-        wxTheFontsManager = (wxFontsManager*) NULL;
+        wxFontsManager::CleanUp();
 
         wxDestroyMGL_WM();
         MGL_exit();