]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/init.cpp
Partial fix for big_endian image conversion probs.
[wxWidgets.git] / src / common / init.cpp
index 1af0b671f5f1e07fa48752a1363f4c184c88733e..8925cb193f5e7adf6c6e25aa51d2037b89cd72fe 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
-    #pragma implementation "appbase.h"
+#include "wx/wxprec.h"
+
+#ifdef    __BORLANDC__
+  #pragma hdrstop
+#endif  //__BORLANDC__
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/debug.h"
 #endif
 
-#include "wx/app.h"
-#include "wx/debug.h"
+#include "wx/module.h"
+
 
 // ----------------------------------------------------------------------------
 // global vars
@@ -40,7 +47,7 @@ wxAppInitializerFunction
 class /* no WXDLLEXPORT */ wxConsoleApp : public wxApp
 {
 public:
-    virtual int OnRun() { wxFAIL_MSG(T("unreachable")); return 0; }
+    virtual int OnRun() { wxFAIL_MSG(wxT("unreachable")); return 0; }
 };
 
 // ----------------------------------------------------------------------------
@@ -55,24 +62,43 @@ static size_t gs_nInitCount = 0;
 
 bool WXDLLEXPORT wxInitialize()
 {
-    if ( gs_nInitCount++ )
+    if ( gs_nInitCount )
     {
         // already initialized
         return TRUE;
     }
 
     wxASSERT_MSG( !wxTheApp,
-                  T("either call wxInitialize or create app, not both!") );
+                  wxT("either call wxInitialize or create app, not both!") );
+
+    wxClassInfo::InitializeClasses();
+
+    wxModule::RegisterModules();
+    if ( !wxModule::InitializeModules() )
+    {
+        return FALSE;
+    }
 
     wxTheApp = new wxConsoleApp;
 
-    return wxTheApp != NULL;
+    if ( !wxTheApp )
+    {
+        return FALSE;
+    }
+
+    gs_nInitCount++;
+
+    return TRUE;
 }
 
 void WXDLLEXPORT wxUninitialize()
 {
     if ( !--gs_nInitCount )
     {
+        wxModule::CleanUpModules();
+
+        wxClassInfo::CleanUpClasses();
+
         // delete the application object
         delete wxTheApp;
         wxTheApp = (wxApp *)NULL;