X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b8d5d8b8321fa5211c2d3b316ebd476280ae5ed6..c77a67962c2f50a872491869fcf1a6c082fdc6c6:/src/univ/theme.cpp diff --git a/src/univ/theme.cpp b/src/univ/theme.cpp index d110c5bf0b..ec64045d05 100644 --- a/src/univ/theme.cpp +++ b/src/univ/theme.cpp @@ -6,7 +6,7 @@ // Created: 06.08.00 // RCS-ID: $Id$ // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // =========================================================================== @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "theme.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -33,6 +29,8 @@ #include "wx/log.h" #endif // WX_PRECOMP +#include "wx/artprov.h" + #include "wx/univ/renderer.h" #include "wx/univ/inphand.h" #include "wx/univ/theme.h" @@ -84,7 +82,7 @@ wxThemeInfo::wxThemeInfo(Constructor c, if ( ms_theme ) { // we already have a theme - return TRUE; + return true; } wxString nameDefTheme; @@ -106,29 +104,42 @@ wxThemeInfo::wxThemeInfo(Constructor c, #endif } - ms_theme = Create(nameDefTheme); + wxTheme *theme = Create(nameDefTheme); // fallback to the first one in the list - if ( !ms_theme && ms_allThemes ) + if ( !theme && ms_allThemes ) { - ms_theme = ms_allThemes->ctor(); + theme = ms_allThemes->ctor(); } // abort if still nothing - if ( !ms_theme ) + if ( !theme ) { wxLogError(_("Failed to initialize GUI: no built-in themes found.")); - return FALSE; + return false; } - return TRUE; + // Set the theme as current. + wxTheme::Set(theme); + + return true; } /* static */ wxTheme *wxTheme::Set(wxTheme *theme) { wxTheme *themeOld = ms_theme; ms_theme = theme; + + if ( ms_theme ) + { + // automatically start using the art provider of the new theme if it + // has one + wxArtProvider *art = ms_theme->GetArtProvider(); + if ( art ) + wxArtProvider::PushProvider(art); + } + return themeOld; }