X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f2097b6efc095788df406a2db7b0b3cf0ed75ad..5b05d3ee52cb31caa856c9982eaeb2fcf5b5f78e:/src/univ/theme.cpp diff --git a/src/univ/theme.cpp b/src/univ/theme.cpp index aa8be8e2d9..8997f255a8 100644 --- a/src/univ/theme.cpp +++ b/src/univ/theme.cpp @@ -47,8 +47,8 @@ wxTheme *wxTheme::ms_theme = (wxTheme *)NULL; // ---------------------------------------------------------------------------- wxThemeInfo::wxThemeInfo(Constructor c, - const wxChar *n, - const wxChar *d) + const wxString& n, + const wxString& d) : name(n), desc(d), ctor(c) { // insert us (in the head of) the linked list @@ -93,12 +93,12 @@ wxThemeInfo::wxThemeInfo(Constructor c, { nameDefTheme = p; } +#ifdef wxUNIV_DEFAULT_THEME else // use native theme by default { -#ifdef wxUNIV_DEFAULT_THEME - nameDefTheme = _T(wxSTRINGIZE(wxUNIV_DEFAULT_THEME)); -#endif + nameDefTheme = wxSTRINGIZE_T(wxUNIV_DEFAULT_THEME); } +#endif // wxUNIV_DEFAULT_THEME wxTheme *theme = Create(nameDefTheme); @@ -147,3 +147,58 @@ wxTheme::~wxTheme() { } + +// ---------------------------------------------------------------------------- +// wxDelegateTheme +// ---------------------------------------------------------------------------- + +wxDelegateTheme::wxDelegateTheme(const wxString& theme) +{ + m_themeName = theme; + m_theme = NULL; +} + +wxDelegateTheme::~wxDelegateTheme() +{ + delete m_theme; +} + +bool wxDelegateTheme::GetOrCreateTheme() +{ + if ( !m_theme ) + m_theme = wxTheme::Create(m_themeName); + return m_theme != NULL; +} + +wxRenderer *wxDelegateTheme::GetRenderer() +{ + if ( !GetOrCreateTheme() ) + return NULL; + + return m_theme->GetRenderer(); +} + +wxArtProvider *wxDelegateTheme::GetArtProvider() +{ + if ( !GetOrCreateTheme() ) + return NULL; + + return m_theme->GetArtProvider(); +} + +wxInputHandler *wxDelegateTheme::GetInputHandler(const wxString& control, + wxInputConsumer *consumer) +{ + if ( !GetOrCreateTheme() ) + return NULL; + + return m_theme->GetInputHandler(control, consumer); +} + +wxColourScheme *wxDelegateTheme::GetColourScheme() +{ + if ( !GetOrCreateTheme() ) + return NULL; + + return m_theme->GetColourScheme(); +}