fixed IMPLEMENT_APP to work even if compiled with --with-themes and win32 or gtk themes are not compiled in

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2006-09-29 12:43:59 +00:00
parent 74be7431f3
commit ee92941afc
2 changed files with 47 additions and 4 deletions

View File

@@ -641,9 +641,12 @@ public:
#ifdef __WXUNIVERSAL__
#include "wx/univ/theme.h"
#define IMPLEMENT_WX_THEME_SUPPORT \
WX_USE_THEME(win32); \
WX_USE_THEME(gtk);
#ifdef wxUNIV_DEFAULT_THEME
#define IMPLEMENT_WX_THEME_SUPPORT \
WX_USE_THEME(wxUNIV_DEFAULT_THEME);
#else
#define IMPLEMENT_WX_THEME_SUPPORT
#endif
#else
#define IMPLEMENT_WX_THEME_SUPPORT
#endif

View File

@@ -103,6 +103,10 @@ struct WXDLLEXPORT wxThemeInfo
// without it, an over optimizing linker may discard the object module
// containing the theme implementation entirely
#define WX_USE_THEME(themename) \
/* this indirection makes it possible to pass macro as the argument */ \
WX_USE_THEME_IMPL(themename)
#define WX_USE_THEME_IMPL(themename) \
extern WXDLLEXPORT_DATA(bool) wxThemeUse##themename; \
static struct wxThemeUserFor##themename \
{ \
@@ -124,5 +128,41 @@ struct WXDLLEXPORT wxThemeInfo
wxThemeInfo classname::ms_info##themename(wxCtorFor##themename, \
wxT( #themename ), themedesc)
#endif // _WX_UNIV_THEME_H_
// ----------------------------------------------------------------------------
// determine default theme
// ----------------------------------------------------------------------------
#if wxUSE_ALL_THEMES
#define wxUSE_THEME_WIN32 1
#define wxUSE_THEME_GTK 1
#define wxUSE_THEME_MONO 1
#define wxUSE_THEME_METAL 1
#endif // wxUSE_ALL_THEMES
// determine the default theme to use:
#if defined(__WXGTK__) && wxUSE_THEME_GTK
#define wxUNIV_DEFAULT_THEME gtk
#elif defined(__WXDFB__) && wxUSE_THEME_MONO
// use mono theme for DirectFB port because it cannot correctly
// render neither win32 nor gtk themes yet:
#define wxUNIV_DEFAULT_THEME mono
#endif
// if no theme was picked, get any theme compiled in (sorted by
// quality/completeness of the theme):
#ifndef wxUNIV_DEFAULT_THEME
#if wxUSE_THEME_WIN32
#define wxUNIV_DEFAULT_THEME win32
#elif wxUSE_THEME_GTK
#define wxUNIV_DEFAULT_THEME gtk
#elif wxUSE_THEME_MONO
#define wxUNIV_DEFAULT_THEME mono
#endif
// If nothing matches, no themes are compiled and the app must provide
// some theme itself
// (note that wxUSE_THEME_METAL depends on win32 theme, so we don't have to
// try it)
//
#endif // !wxUNIV_DEFAULT_THEME
#endif // _WX_UNIV_THEME_H_