]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mgl/app.cpp
Don't needlessly indirect through NSNotificationCenter.
[wxWidgets.git] / src / mgl / app.cpp
index bc64f28457d574e5282038e7dcedd9dc81839280..c0338c7834953a78b9fff7b64fb4d0dc8280ba0b 100644 (file)
     #include "wx/dialog.h"
     #include "wx/log.h"
     #include "wx/intl.h"
     #include "wx/dialog.h"
     #include "wx/log.h"
     #include "wx/intl.h"
+    #include "wx/module.h"
 #endif
 
 #include "wx/evtloop.h"
 #endif
 
 #include "wx/evtloop.h"
-#include "wx/module.h"
 #include "wx/fontutil.h"
 #include "wx/univ/theme.h"
 #include "wx/univ/renderer.h"
 #include "wx/univ/colschem.h"
 #include "wx/sysopt.h"
 #include "wx/mgl/private.h"
 #include "wx/fontutil.h"
 #include "wx/univ/theme.h"
 #include "wx/univ/renderer.h"
 #include "wx/univ/colschem.h"
 #include "wx/sysopt.h"
 #include "wx/mgl/private.h"
+#include "wx/private/fontmgr.h"
 
 //-----------------------------------------------------------------------------
 // wxApp::Exit()
 
 //-----------------------------------------------------------------------------
 // wxApp::Exit()
@@ -73,10 +74,11 @@ bool wxApp::Yield(bool onlyIfNeeded)
 
     wxLog::Suspend();
 
 
     wxLog::Suspend();
 
-    if ( wxEventLoop::GetActive() )
+    wxEventLoopBase * const eventLoop = wxEventLoop::GetActive();
+    if ( eventLoop )
     {
     {
-        while (wxEventLoop::GetActive()->Pending())
-            wxEventLoop::GetActive()->Dispatch();
+        while (eventLoop->Pending())
+            eventLoop->Dispatch();
     }
 
     /* it's necessary to call ProcessIdle() to update the frames sizes which
     }
 
     /* it's necessary to call ProcessIdle() to update the frames sizes which
@@ -124,7 +126,7 @@ class wxRootWindow : public wxWindow
             SetMGLwindow_t(MGL_wmGetRootWindow(g_winMng));
             SetBackgroundColour(wxTHEME_COLOUR(DESKTOP));
         }
             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;
         {
             // we don't want to delete MGL_WM's rootWnd
             m_wnd = NULL;
@@ -199,11 +201,6 @@ static void wxDestroyMGL_WM()
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
 
 
 IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
 
-BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
-    EVT_IDLE(wxAppBase::OnIdle)
-END_EVENT_TABLE()
-
-
 wxApp::wxApp()
 {
 }
 wxApp::wxApp()
 {
 }
@@ -283,14 +280,8 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
         return false;
     }
 
         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) )
     {
     if ( !wxAppBase::Initialize(argc, argv) )
     {
-        delete wxTheFontsManager;
-        wxTheFontsManager = NULL;
         MGL_exit();
         return false;
     }
         MGL_exit();
         return false;
     }
@@ -313,8 +304,7 @@ struct wxMGLFinalCleanup: public wxModule
 
     void OnExit()
     {
 
     void OnExit()
     {
-        delete wxTheFontsManager;
-        wxTheFontsManager = (wxFontsManager*) NULL;
+        wxFontsManager::CleanUp();
 
         wxDestroyMGL_WM();
         MGL_exit();
 
         wxDestroyMGL_WM();
         MGL_exit();