]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/theme.cpp
fixed loading of GNOME2 mime icons (still not working as desired)
[wxWidgets.git] / src / univ / theme.cpp
index f9e384c6831f4a6c83fd434bb1c2cd58a7195986..35c540df58ebb89aa4f21db455bec19ef86aff6a 100644 (file)
@@ -33,6 +33,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"
@@ -64,7 +66,7 @@ wxThemeInfo::wxThemeInfo(Constructor c,
     wxThemeInfo *info = ms_allThemes;
     while ( info )
     {
-        if ( name == info->name )
+        if ( name.CmpNoCase(info->name) == 0 )
         {
             return info->ctor();
         }
@@ -97,31 +99,34 @@ wxThemeInfo::wxThemeInfo(Constructor c,
     }
     else // use native theme by default
     {
-        #if defined(__WXMSW__)
-            nameDefTheme = _T("win32");
-        #elif defined(__WXGTK__)
+        #if defined(__WXGTK__)
             nameDefTheme = _T("gtk");
-        #elif defined(__WXMGL__)
+        #elif defined(__WXX11__)
+            nameDefTheme = _T("win32");
+        #else
             nameDefTheme = _T("win32");
         #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;
     }
 
+    // Set the theme as current.
+    wxTheme::Set(theme);
+
     return TRUE;
 }
 
@@ -129,6 +134,16 @@ wxThemeInfo::wxThemeInfo(Constructor c,
 {
     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;
 }