]> git.saurik.com Git - wxWidgets.git/commitdiff
moved WX_USE_THEME macros inside IMPLEMENT_APP
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Jul 2001 15:14:57 +0000 (15:14 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Jul 2001 15:14:57 +0000 (15:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/app.h
samples/menu/menu.cpp
samples/widgets/widgets.cpp

index cdd0e46cf58d3207b4dd74d437ab27efdf205ee5..4756689918863af2b739316d12952fbd6fe12afa 100644 (file)
@@ -438,13 +438,15 @@ public:
     #define IMPLEMENT_WXWIN_MAIN
 #endif
 
-// Use this macro exactly once, the argument is the name of the wxApp-derived
-// class which is the class of your application.
-#define IMPLEMENT_APP(appname)                           \
-    wxApp *wxCreateApp() { return new appname; }         \
-    wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
-    appname& wxGetApp() { return *(appname *)wxTheApp; } \
-    IMPLEMENT_WXWIN_MAIN
+#ifdef __WXUNIVERSAL__
+    #include "wx/univ/theme.h"
+
+    #define IMPLEMENT_WX_THEME_SUPPORT \
+        WX_USE_THEME(win32); \
+        WX_USE_THEME(gtk);
+#else
+    #define IMPLEMENT_WX_THEME_SUPPORT
+#endif
 
 // Use this macro if you want to define your own main() or WinMain() function
 // and call wxEntry() from there.
@@ -453,6 +455,20 @@ public:
     wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
     appname& wxGetApp() { return *(appname *)wxTheApp; }
 
+// Same as IMPLEMENT_APP() normally but doesn't include themes support in
+// wxUniversal builds
+#define IMPLEMENT_APP_NO_THEMES(appname)    \
+    IMPLEMENT_APP_NO_MAIN(appname)          \
+    IMPLEMENT_WXWIN_MAIN
+
+// Use this macro exactly once, the argument is the name of the wxApp-derived
+// class which is the class of your application.
+#define IMPLEMENT_APP(appname)              \
+    IMPLEMENT_APP_NO_THEMES(appname)        \
+    IMPLEMENT_WX_THEME_SUPPORT
+
+// this macro can be used multiple times and just allows you to use wxGetApp()
+// function
 #define DECLARE_APP(appname) extern appname& wxGetApp();
 
 #endif
index 91bb10d30f2a440a9e4733a72d698eaf637886e7..0751bad75db37bedae39e525f0d1e3a7d42096c5 100644 (file)
 
 #include "copy.xpm"
 
-#ifdef __WXUNIVERSAL__
-    #include "wx/univ/theme.h"
-
-    WX_USE_THEME(win32);
-    WX_USE_THEME(gtk);
-#endif // __WXUNIVERSAL__
-
 // ----------------------------------------------------------------------------
 // classes
 // ----------------------------------------------------------------------------
index ff4cee53d802327af2f6a71bae26a1a0a5c99bc7..d8994358665d9e3d3fb8e43e0ecaa85f639fc414 100644 (file)
@@ -173,13 +173,6 @@ WX_DEFINE_ARRAY(WidgetsPage *, ArrayWidgetsPage);
 
 IMPLEMENT_APP(WidgetsApp)
 
-#ifdef __WXUNIVERSAL__
-    #include "wx/univ/theme.h"
-
-    WX_USE_THEME(win32);
-    WX_USE_THEME(gtk);
-#endif // __WXUNIVERSAL__
-
 // ----------------------------------------------------------------------------
 // event tables
 // ----------------------------------------------------------------------------
@@ -201,17 +194,18 @@ bool WidgetsApp::OnInit()
 {
     // the reason for having these ifdef's is that I often run two copies of
     // this sample side by side and it is useful to see which one is which
-    wxString title =
+    wxString title;
 #if defined(__WXUNIVERSAL__)
-    _T("wxUniv")
-#elif defined(__WXMSW__)
-    _T("wxMSW")
+    title = _T("wxUniv/")
+#endif
+
+#if defined(__WXMSW__)
+    title += _T("wxMSW");
 #elif defined(__WXGTK__)
-    _T("wxGTK")
+    title += _T("wxGTK");
 #else
-    _T("wxWindows")
+    title += _T("wxWindows");
 #endif
-    ;
 
     wxFrame *frame = new WidgetsFrame(title + _T(" widgets demo"));
     frame->Show();