]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/app.h
moved some more stuff from .cpp files to here
[wxWidgets.git] / include / wx / app.h
index 1a356a01d8db1599210634a147145b40352b1c2a..c95c47751cea6aba2aebfca8e3e242be4e7e544c 100644 (file)
@@ -75,6 +75,7 @@ private:
 };
 #endif // wxUSE_GUI
 
+
 // ----------------------------------------------------------------------------
 // wxAppConsole: wxApp for non-GUI applications
 // ----------------------------------------------------------------------------
@@ -270,15 +271,18 @@ public:
     static wxAppInitializerFunction GetInitializerFunction()
         { return ms_appInitFn; }
 
+    // accessors for ms_appInstance field (external code might wish to modify
+    // it, this is why we provide a setter here as well, but you should really
+    // know what you're doing if you call it), wxTheApp is usually used instead
+    // of GetInstance()
+    static wxAppConsole *GetInstance() { return ms_appInstance; }
+    static void SetInstance(wxAppConsole *app) { ms_appInstance = app; }
+
 
     // command line arguments (public for backwards compatibility)
     int      argc;
     wxChar **argv;
 
-    // the one and only global application object (must be public for backwards
-    // compatibility as assigning to wxTheApp should work)
-    static wxAppConsole *ms_appInstance;
-
 protected:
     // the function which creates the traits object when GetTraits() needs it
     // for the first time
@@ -288,6 +292,9 @@ protected:
     // function used for dynamic wxApp creation
     static wxAppInitializerFunction ms_appInitFn;
 
+    // the one and only global application object
+    static wxAppConsole *ms_appInstance;
+
 
     // application info (must be set from the user code)
     wxString m_vendorName,      // vendor name (ACME Inc)
@@ -534,7 +541,7 @@ protected:
 //
 // the cast is safe as in GUI build we only use wxApp, not wxAppConsole, and in
 // console mode it does nothing at all
-#define wxTheApp ((wxApp *)wxApp::ms_appInstance)
+#define wxTheApp ((wxApp *)wxApp::GetInstance())
 
 // ----------------------------------------------------------------------------
 // global functions