]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkwin32theme.c
filechooserbutton: When the combo box changes, set the *file*, not the current folder
[~andy/gtk] / gtk / gtkwin32theme.c
index a9e0193d1afd2d564b095441ffb4861f52650775..9b20a76f453e74b82f4f0a7881ec092637bb6368 100644 (file)
 
 static HINSTANCE uxtheme_dll = NULL;
 static gboolean use_xp_theme = FALSE;
+static OSVERSIONINFO os_version;
 static HTHEME needs_alpha_fixup1 = NULL;
 static HTHEME needs_alpha_fixup2 = NULL;
 static HTHEME needs_alpha_fixup3 = NULL;
 static HTHEME needs_alpha_fixup4 = NULL;
 static HTHEME needs_alpha_fixup5 = NULL;
 static HTHEME needs_alpha_fixup6 = NULL;
+static HTHEME needs_alpha_fixup7 = NULL;
 
 typedef HRESULT (FAR PASCAL *GetThemeSysFontFunc)           (HTHEME hTheme, int iFontID, OUT LOGFONTW *plf);
 typedef int (FAR PASCAL *GetThemeSysSizeFunc)               (HTHEME hTheme, int iSizeId);
@@ -83,7 +85,6 @@ static GHashTable *hthemes_by_class = NULL;
 static void
 _gtk_win32_theme_init (void)
 {
-  OSVERSIONINFO version;
   char *buf;
   char dummy;
   int n, k;
@@ -140,9 +141,10 @@ _gtk_win32_theme_init (void)
 
   hthemes_by_class = g_hash_table_new (g_str_hash, g_str_equal);
 
-  memset (&version, 0, sizeof (version));
-  version.dwOSVersionInfoSize = sizeof (version);
-  if (GetVersionEx (&version) && version.dwMajorVersion == 5)
+  memset (&os_version, 0, sizeof (os_version));
+  os_version.dwOSVersionInfoSize = sizeof (os_version);
+  GetVersionEx (&os_version);
+  if (os_version.dwMajorVersion == 5)
     {
       needs_alpha_fixup1 = _gtk_win32_lookup_htheme_by_classname ("scrollbar");
       needs_alpha_fixup2 = _gtk_win32_lookup_htheme_by_classname ("toolbar");
@@ -150,6 +152,7 @@ _gtk_win32_theme_init (void)
       needs_alpha_fixup4 = _gtk_win32_lookup_htheme_by_classname ("header");
       needs_alpha_fixup5 = _gtk_win32_lookup_htheme_by_classname ("trackbar");
       needs_alpha_fixup6 = _gtk_win32_lookup_htheme_by_classname ("status");
+      needs_alpha_fixup7 = _gtk_win32_lookup_htheme_by_classname ("rebar");
     }
 }
 
@@ -265,15 +268,17 @@ _gtk_win32_theme_part_create_surface (HTHEME theme,
        (theme == needs_alpha_fixup3 && xp_part == 4) ||
        theme == needs_alpha_fixup4 ||
        theme == needs_alpha_fixup5 ||
-       theme == needs_alpha_fixup6))
+       theme == needs_alpha_fixup6 ||
+       theme == needs_alpha_fixup7))
     {
       cairo_surface_t *img = cairo_win32_surface_get_image (surface);
       guint32 *data = (guint32 *)cairo_image_surface_get_data (img);
+      int i, j;
       GdiFlush ();
 
-      for (int i = 0; i < width; i++)
+      for (i = 0; i < width; i++)
        {
-         for (int j = 0; j < height; j++)
+         for (j = 0; j < height; j++)
            {
              if (data[i+j*width] != 0)
                data[i+j*width] |= 0xff000000;
@@ -308,7 +313,6 @@ _gtk_win32_theme_part_create_surface (HTHEME theme,
 
 int
 _gtk_win32_theme_int_parse (GtkCssParser      *parser,
-                           GFile             *base,
                            int               *value)
 {
   char *class;
@@ -377,41 +381,6 @@ _gtk_win32_theme_int_parse (GtkCssParser      *parser,
   return -1;
 }
 
-GtkSymbolicColor *
-_gtk_win32_theme_color_parse (GtkCssParser *parser)
-{
-  GtkSymbolicColor *color;
-  char *class;
-  int id;
-
-  class = _gtk_css_parser_try_name (parser, TRUE);
-  if (class == NULL)
-    {
-      _gtk_css_parser_error (parser,
-                            "Expected name as first argument to  '-gtk-win32-color'");
-      return NULL;
-    }
-
-  if (! _gtk_css_parser_try (parser, ",", TRUE))
-    {
-      g_free (class);
-      _gtk_css_parser_error (parser,
-                            "Expected ','");
-      return NULL;
-    }
-
-  if (!_gtk_css_parser_try_int (parser, &id))
-    {
-      g_free (class);
-      _gtk_css_parser_error (parser, "Expected a valid integer value");
-      return NULL;
-    }
-
-  color = gtk_symbolic_color_new_win32 (class, id);
-  g_free (class);
-  return color;
-}
-
 gboolean
 _gtk_win32_theme_color_resolve (const char *theme_class,
                                gint id,
@@ -440,3 +409,16 @@ _gtk_win32_theme_color_resolve (const char *theme_class,
 #endif
   return TRUE;
 }
+
+const char *
+_gtk_win32_theme_get_default (void)
+{
+#ifdef G_OS_WIN32
+  _gtk_win32_theme_init ();
+  
+  if (use_xp_theme)
+    return (os_version.dwMajorVersion >= 6) ? "gtk-win32" : "gtk-win32-xp";
+#endif
+  return "gtk-win32-classic";
+}
+