]> Pileus Git - ~andy/gtk/blobdiff - modules/engines/pixbuf/pixbuf-draw.c
style: Convert draw_option vfunc to Cairo version
[~andy/gtk] / modules / engines / pixbuf / pixbuf-draw.c
index f3eb17d35cd2300cab881919375737c59ce3b290..8e6bc84b68383bef16c0eb51830538d79c2a27b1 100644 (file)
@@ -74,6 +74,14 @@ match_theme_image (GtkStyle       *style,
          match_data->gap_side != image->match_data.gap_side)
        continue;
 
+      if ((flags & THEME_MATCH_EXPANDER_STYLE) &&
+         match_data->expander_style != image->match_data.expander_style)
+       continue;
+
+      if ((flags & THEME_MATCH_WINDOW_EDGE) &&
+         match_data->window_edge != image->match_data.window_edge)
+       continue;
+
       if (image->match_data.detail &&
          (!match_data->detail ||
           strcmp (match_data->detail, image->match_data.detail) != 0))
@@ -87,8 +95,7 @@ match_theme_image (GtkStyle       *style,
 
 static gboolean
 draw_simple_image(GtkStyle       *style,
-                 GdkWindow      *window,
-                 GdkRectangle   *area,
+                 cairo_t        *cr,
                  GtkWidget      *widget,
                  ThemeMatchData *match_data,
                  gboolean        draw_center,
@@ -98,20 +105,9 @@ draw_simple_image(GtkStyle       *style,
                  gint            width,
                  gint            height)
 {
+
   ThemeImage *image;
-  gboolean setbg = FALSE;
   
-  if ((width == -1) && (height == -1))
-    {
-      gdk_window_get_size(window, &width, &height);
-      if (allow_setbg)
-       setbg = TRUE;
-    }
-  else if (width == -1)
-    gdk_window_get_size(window, &width, NULL);
-  else if (height == -1)
-    gdk_window_get_size(window, NULL, &height);
-
   if (!(match_data->flags & THEME_MATCH_ORIENTATION))
     {
       match_data->flags |= THEME_MATCH_ORIENTATION;
@@ -127,16 +123,14 @@ draw_simple_image(GtkStyle       *style,
     {
       if (image->background)
        {
-         theme_pixbuf_render (image->background,
-                              window, NULL, area,
+         theme_pixbuf_render (image->background, cr,
                               draw_center ? COMPONENT_ALL : COMPONENT_ALL | COMPONENT_CENTER,
                               FALSE,
                               x, y, width, height);
        }
       
       if (image->overlay && draw_center)
-       theme_pixbuf_render (image->overlay,
-                            window, NULL, area, COMPONENT_ALL,
+       theme_pixbuf_render (image->overlay, cr, COMPONENT_ALL,
                             TRUE, 
                             x, y, width, height);
 
@@ -146,10 +140,48 @@ draw_simple_image(GtkStyle       *style,
     return FALSE;
 }
 
+static gboolean
+draw_simple_image_no_cairo(GtkStyle       *style,
+                 GdkWindow      *window,
+                 GdkRectangle   *area,
+                 GtkWidget      *widget,
+                 ThemeMatchData *match_data,
+                 gboolean        draw_center,
+                 gboolean        allow_setbg,
+                 gint            x,
+                 gint            y,
+                 gint            width,
+                 gint            height)
+{
+  gboolean result;
+  cairo_t *cr;
+
+  if ((width == -1) && (height == -1))
+    gdk_drawable_get_size(window, &width, &height);
+  else if (width == -1)
+    gdk_drawable_get_size(window, &width, NULL);
+  else if (height == -1)
+    gdk_drawable_get_size(window, NULL, &height);
+
+  cr = gdk_cairo_create (window);
+  if (area)
+    {
+      gdk_cairo_rectangle (cr, area);
+      cairo_clip (cr);
+    }
+
+  result = draw_simple_image (style, cr, widget, match_data,
+                              draw_center, allow_setbg,
+                              x, y, width, height);
+
+  cairo_destroy (cr);
+
+  return result;
+}
+
 static gboolean
 draw_gap_image(GtkStyle       *style,
-              GdkWindow      *window,
-              GdkRectangle   *area,
+               cairo_t        *cr,
               GtkWidget      *widget,
               ThemeMatchData *match_data,
               gboolean        draw_center,
@@ -162,18 +194,7 @@ draw_gap_image(GtkStyle       *style,
               gint            gap_width)
 {
   ThemeImage *image;
-  gboolean setbg = FALSE;
   
-  if ((width == -1) && (height == -1))
-    {
-      gdk_window_get_size(window, &width, &height);
-      setbg = TRUE;
-    }
-  else if (width == -1)
-    gdk_window_get_size(window, &width, NULL);
-  else if (height == -1)
-    gdk_window_get_size(window, NULL, &height);
-
   if (!(match_data->flags & THEME_MATCH_ORIENTATION))
     {
       match_data->flags |= THEME_MATCH_ORIENTATION;
@@ -294,23 +315,26 @@ draw_gap_image(GtkStyle       *style,
          r3.width  = thickness;
          r3.height = height - (gap_x + gap_width);
          break;
+
+       default:
+         g_assert_not_reached ();
        }
 
       if (image->background)
        theme_pixbuf_render (image->background,
-                            window, NULL, area, components, FALSE,
+                            cr, components, FALSE,
                             x, y, width, height);
       if (image->gap_start)
        theme_pixbuf_render (image->gap_start,
-                            window, NULL, area, COMPONENT_ALL, FALSE,
+                            cr, COMPONENT_ALL, FALSE,
                             r1.x, r1.y, r1.width, r1.height);
       if (image->gap)
        theme_pixbuf_render (image->gap,
-                            window, NULL, area, COMPONENT_ALL, FALSE,
+                            cr, COMPONENT_ALL, FALSE,
                             r2.x, r2.y, r2.width, r2.height);
       if (image->gap_end)
        theme_pixbuf_render (image->gap_end,
-                            window, NULL, area, COMPONENT_ALL, FALSE,
+                            cr, COMPONENT_ALL, FALSE,
                             r3.x, r3.y, r3.width, r3.height);
 
       return TRUE;
@@ -319,11 +343,51 @@ draw_gap_image(GtkStyle       *style,
     return FALSE;
 }
 
+static gboolean
+draw_gap_image_no_cairo(GtkStyle       *style,
+               GdkWindow      *window,
+               GdkRectangle   *area,
+              GtkWidget      *widget,
+              ThemeMatchData *match_data,
+              gboolean        draw_center,
+              gint            x,
+              gint            y,
+              gint            width,
+              gint            height,
+              GtkPositionType gap_side,
+              gint            gap_x,
+              gint            gap_width)
+{
+  gboolean result;
+  cairo_t *cr;
+
+  if ((width == -1) && (height == -1))
+    gdk_drawable_get_size(window, &width, &height);
+  else if (width == -1)
+    gdk_drawable_get_size(window, &width, NULL);
+  else if (height == -1)
+    gdk_drawable_get_size(window, NULL, &height);
+
+  cr = gdk_cairo_create (window);
+  if (area)
+    {
+      gdk_cairo_rectangle (cr, area);
+      cairo_clip (cr);
+    }
+
+  result = draw_gap_image (style, cr, widget, match_data,
+                           draw_center, x, y, width, height,
+                           gap_side, gap_x, gap_width);
+
+  cairo_destroy (cr);
+
+  return result;
+}
+
 static void
 draw_hline (GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            gint          x1,
@@ -333,9 +397,6 @@ draw_hline (GtkStyle     *style,
   ThemeImage *image;
   ThemeMatchData   match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_HLINE;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
@@ -347,19 +408,18 @@ draw_hline (GtkStyle     *style,
     {
       if (image->background)
        theme_pixbuf_render (image->background,
-                            window, NULL, area, COMPONENT_ALL, FALSE,
+                            cr, COMPONENT_ALL, FALSE,
                             x1, y, (x2 - x1) + 1, 2);
     }
   else
-    parent_class->draw_hline (style, window, state, area, widget, detail,
+    parent_class->draw_hline (style, cr, state, widget, detail,
                              x1, x2, y);
 }
 
 static void
 draw_vline (GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            gint          y1,
@@ -369,9 +429,6 @@ draw_vline (GtkStyle     *style,
   ThemeImage    *image;
   ThemeMatchData match_data;
   
-  g_return_if_fail (style != NULL);
-  g_return_if_fail (window != NULL);
-
   match_data.function = TOKEN_D_VLINE;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_ORIENTATION | THEME_MATCH_STATE;
@@ -383,20 +440,19 @@ draw_vline (GtkStyle     *style,
     {
       if (image->background)
        theme_pixbuf_render (image->background,
-                            window, NULL, area, COMPONENT_ALL, FALSE,
+                            cr, COMPONENT_ALL, FALSE,
                             x, y1, 2, (y2 - y1) + 1);
     }
   else
-    parent_class->draw_vline (style, window, state, area, widget, detail,
+    parent_class->draw_vline (style, cr, state, widget, detail,
                              y1, y2, x);
 }
 
 static void
 draw_shadow(GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
            GtkShadowType shadow,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            gint          x,
@@ -406,18 +462,15 @@ draw_shadow(GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_SHADOW;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
 
-  if (!draw_simple_image (style, window, area, widget, &match_data, FALSE, FALSE,
+  if (!draw_simple_image (style, cr, widget, &match_data, FALSE, FALSE,
                          x, y, width, height))
-    parent_class->draw_shadow (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_shadow (style, cr, state, shadow, widget, detail,
                               x, y, width, height);
 }
 
@@ -440,7 +493,7 @@ reverse_engineer_stepper_box (GtkWidget    *range,
   gint box_width;
   gint box_height;
   
-  if (range)
+  if (range && GTK_IS_RANGE (range))
     {
       gtk_widget_style_get (range,
                            "slider_width", &slider_width,
@@ -467,10 +520,9 @@ reverse_engineer_stepper_box (GtkWidget    *range,
 
 static void
 draw_arrow (GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
            GtkShadowType shadow,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            GtkArrowType  arrow_direction,
@@ -482,9 +534,6 @@ draw_arrow (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   if (detail &&
       (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
     {
@@ -515,7 +564,7 @@ draw_arrow (GtkStyle     *style,
       match_data.state = state;
       match_data.arrow_direction = arrow_direction;
       
-      if (draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+      if (draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                             box_x, box_y, box_width, box_height))
        {
          /* The theme included stepper images, we're done */
@@ -530,9 +579,9 @@ draw_arrow (GtkStyle     *style,
       match_data.shadow = shadow;
       match_data.state = state;
       
-      if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+      if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                              box_x, box_y, box_width, box_height))
-       parent_class->draw_box (style, window, state, shadow, area, widget, detail,
+       parent_class->draw_box (style, cr, state, shadow, widget, detail,
                                box_x, box_y, box_width, box_height);
     }
 
@@ -546,18 +595,17 @@ draw_arrow (GtkStyle     *style,
   match_data.state = state;
   match_data.arrow_direction = arrow_direction;
   
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_arrow (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_arrow (style, cr, state, shadow, widget, detail,
                              arrow_direction, fill, x, y, width, height);
 }
 
 static void
 draw_diamond (GtkStyle     *style,
-             GdkWindow    *window,
+             cairo_t      *cr,
              GtkStateType  state,
              GtkShadowType shadow,
-             GdkRectangle *area,
              GtkWidget    *widget,
              const gchar  *detail,
              gint          x,
@@ -567,65 +615,23 @@ draw_diamond (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_DIAMOND;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_diamond (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_diamond (style, cr, state, shadow, widget, detail,
                                x, y, width, height);
 }
 
-static void
-draw_string (GtkStyle * style,
-            GdkWindow * window,
-            GtkStateType state,
-            GdkRectangle * area,
-            GtkWidget * widget,
-            const gchar *detail,
-            gint x,
-            gint y,
-            const gchar * string)
-{
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
-  if (state == GTK_STATE_INSENSITIVE)
-    {
-      if (area)
-       {
-         gdk_gc_set_clip_rectangle(style->white_gc, area);
-         gdk_gc_set_clip_rectangle(style->fg_gc[state], area);
-       }
-
-      gdk_draw_string(window, gtk_style_get_font (style), style->fg_gc[state], x, y, string);
-      
-      if (area)
-       {
-         gdk_gc_set_clip_rectangle(style->white_gc, NULL);
-         gdk_gc_set_clip_rectangle(style->fg_gc[state], NULL);
-       }
-    }
-  else
-    {
-      gdk_gc_set_clip_rectangle(style->fg_gc[state], area);
-      gdk_draw_string(window, gtk_style_get_font (style), style->fg_gc[state], x, y, string);
-      gdk_gc_set_clip_rectangle(style->fg_gc[state], NULL);
-    }
-}
-
 static void
 draw_box (GtkStyle     *style,
-         GdkWindow    *window,
+         cairo_t      *cr,
          GtkStateType  state,
          GtkShadowType shadow,
-         GdkRectangle *area,
          GtkWidget    *widget,
          const gchar  *detail,
          gint          x,
@@ -635,9 +641,6 @@ draw_box (GtkStyle     *style,
 {
   ThemeMatchData match_data;
 
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   if (detail &&
       (strcmp (detail, "hscrollbar") == 0 || strcmp (detail, "vscrollbar") == 0))
     {
@@ -651,19 +654,18 @@ draw_box (GtkStyle     *style,
   match_data.shadow = shadow;
   match_data.state = state;
 
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height)) {
-    parent_class->draw_box (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_box (style, cr, state, shadow, widget, detail,
                            x, y, width, height);
   }
 }
 
 static void
 draw_flat_box (GtkStyle     *style,
-              GdkWindow    *window,
+              cairo_t      *cr,
               GtkStateType  state,
               GtkShadowType shadow,
-              GdkRectangle *area,
               GtkWidget    *widget,
               const gchar  *detail,
               gint          x,
@@ -673,27 +675,23 @@ draw_flat_box (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_FLAT_BOX;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
 
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_flat_box (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_flat_box (style, cr, state, shadow, widget, detail,
                                 x, y, width, height);
 }
 
 static void
 draw_check (GtkStyle     *style,
-           GdkWindow    *window,
+           cairo_t      *cr,
            GtkStateType  state,
            GtkShadowType shadow,
-           GdkRectangle *area,
            GtkWidget    *widget,
            const gchar  *detail,
            gint          x,
@@ -703,27 +701,23 @@ draw_check (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_CHECK;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_check (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_check (style, cr, state, shadow, widget, detail,
                              x, y, width, height);
 }
 
 static void
-draw_option (GtkStyle      *style,
-            GdkWindow     *window,
+draw_option (GtkStyle     *style,
+            cairo_t      *cr,
             GtkStateType  state,
             GtkShadowType shadow,
-            GdkRectangle *area,
             GtkWidget    *widget,
             const gchar  *detail,
             gint          x,
@@ -733,18 +727,15 @@ draw_option (GtkStyle      *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
-
   match_data.function = TOKEN_D_OPTION;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE;
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image (style, cr, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
-    parent_class->draw_option (style, window, state, shadow, area, widget, detail,
+    parent_class->draw_option (style, cr, state, shadow, widget, detail,
                               x, y, width, height);
 }
 
@@ -772,7 +763,7 @@ draw_tab (GtkStyle     *style,
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
     parent_class->draw_tab (style, window, state, shadow, area, widget, detail,
                            x, y, width, height);
@@ -805,7 +796,7 @@ draw_shadow_gap (GtkStyle       *style,
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_gap_image (style, window, area, widget, &match_data, FALSE,
+  if (!draw_gap_image_no_cairo (style, window, area, widget, &match_data, FALSE,
                       x, y, width, height, gap_side, gap_x, gap_width))
     parent_class->draw_shadow_gap (style, window, state, shadow, area, widget, detail,
                                   x, y, width, height, gap_side, gap_x, gap_width);
@@ -838,7 +829,7 @@ draw_box_gap (GtkStyle       *style,
   match_data.shadow = shadow;
   match_data.state = state;
   
-  if (!draw_gap_image (style, window, area, widget, &match_data, TRUE,
+  if (!draw_gap_image_no_cairo (style, window, area, widget, &match_data, TRUE,
                       x, y, width, height, gap_side, gap_x, gap_width))
     parent_class->draw_box_gap (style, window, state, shadow, area, widget, detail,
                                x, y, width, height, gap_side, gap_x, gap_width);
@@ -860,15 +851,9 @@ draw_extension (GtkStyle       *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
+  g_return_if_fail (style != NULL);
+  g_return_if_fail (window != NULL);
 
-  /* Why? */
-  if (width >=0)
-    width++;
-  if (height >=0)
-    height++;
-  
   match_data.function = TOKEN_D_EXTENSION;
   match_data.detail = (gchar *)detail;
   match_data.flags = THEME_MATCH_SHADOW | THEME_MATCH_STATE | THEME_MATCH_GAP_SIDE;
@@ -876,7 +861,7 @@ draw_extension (GtkStyle       *style,
   match_data.state = state;
   match_data.gap_side = gap_side;
 
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
     parent_class->draw_extension (style, window, state, shadow, area, widget, detail,
                                  x, y, width, height, gap_side);
@@ -896,14 +881,14 @@ draw_focus (GtkStyle     *style,
 {
   ThemeMatchData match_data;
   
-  g_return_if_fail(style != NULL);
-  g_return_if_fail(window != NULL);
+  g_return_if_fail (style != NULL);
+  g_return_if_fail (window != NULL);
 
   match_data.function = TOKEN_D_FOCUS;
   match_data.detail = (gchar *)detail;
   match_data.flags = 0;
   
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, FALSE,
+  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, FALSE,
                          x, y, width, height))
     parent_class->draw_focus (style, window, state_type, area, widget, detail,
                              x, y, width, height);
@@ -937,7 +922,7 @@ draw_slider (GtkStyle      *style,
   match_data.state = state;
   match_data.orientation = orientation;
 
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
     parent_class->draw_slider (style, window, state, shadow, area, widget, detail,
                               x, y, width, height, orientation);
@@ -972,19 +957,96 @@ draw_handle (GtkStyle      *style,
   match_data.state = state;
   match_data.orientation = orientation;
 
-  if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
+  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
                          x, y, width, height))
     parent_class->draw_handle (style, window, state, shadow, area, widget, detail,
                               x, y, width, height, orientation);
 }
 
+static void
+draw_expander (GtkStyle      *style,
+              GdkWindow     *window,
+              GtkStateType   state,
+              GdkRectangle  *area,
+              GtkWidget     *widget,
+              const gchar   *detail,
+              gint           x,
+              gint           y,
+              GtkExpanderStyle expander_style)
+{
+#define DEFAULT_EXPANDER_SIZE 12
+
+  ThemeMatchData match_data;
+  gint expander_size;
+  gint radius;
+  
+  g_return_if_fail (style != NULL);
+  g_return_if_fail (window != NULL);
+
+  if (widget &&
+      gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget),
+                                            "expander-size"))
+    {
+      gtk_widget_style_get (widget,
+                           "expander-size", &expander_size,
+                           NULL);
+    }
+  else
+    expander_size = DEFAULT_EXPANDER_SIZE;
+
+  radius = expander_size/2;
+
+  match_data.function = TOKEN_D_EXPANDER;
+  match_data.detail = (gchar *)detail;
+  match_data.flags = (THEME_MATCH_STATE | 
+                     THEME_MATCH_EXPANDER_STYLE);
+  match_data.state = state;
+  match_data.expander_style = expander_style;
+
+  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x - radius, y - radius, expander_size, expander_size))
+    parent_class->draw_expander (style, window, state, area, widget, detail,
+                                x, y, expander_style);
+}
+
+static void
+draw_resize_grip (GtkStyle      *style,
+                    GdkWindow     *window,
+                    GtkStateType   state,
+                    GdkRectangle  *area,
+                    GtkWidget     *widget,
+                    const gchar   *detail,
+                    GdkWindowEdge  edge,
+                    gint           x,
+                    gint           y,
+                    gint           width,
+                    gint           height)
+{
+  ThemeMatchData match_data;
+  
+  g_return_if_fail (style != NULL);
+  g_return_if_fail (window != NULL);
+
+  match_data.function = TOKEN_D_RESIZE_GRIP;
+  match_data.detail = (gchar *)detail;
+  match_data.flags = (THEME_MATCH_STATE | 
+                     THEME_MATCH_WINDOW_EDGE);
+  match_data.state = state;
+  match_data.window_edge = edge;
+
+  if (!draw_simple_image_no_cairo (style, window, area, widget, &match_data, TRUE, TRUE,
+                         x, y, width, height))
+    parent_class->draw_resize_grip (style, window, state, area, widget, detail,
+                                   edge, x, y, width, height);
+}
+
 GType pixbuf_type_style = 0;
 
-void
-pixbuf_style_register_type (GTypeModule *module)
+void 
+pixbuf_style_register_type (GTypeModule *module) 
 {
-  static const GTypeInfo object_info =
-  {
+  const GTypeInfo object_info =
+    {
     sizeof (PixbufStyleClass),
     (GBaseInitFunc) NULL,
     (GBaseFinalizeFunc) NULL,
@@ -1019,7 +1081,6 @@ pixbuf_style_class_init (PixbufStyleClass *klass)
   style_class->draw_shadow = draw_shadow;
   style_class->draw_arrow = draw_arrow;
   style_class->draw_diamond = draw_diamond;
-  style_class->draw_string = draw_string;
   style_class->draw_box = draw_box;
   style_class->draw_flat_box = draw_flat_box;
   style_class->draw_check = draw_check;
@@ -1031,4 +1092,6 @@ pixbuf_style_class_init (PixbufStyleClass *klass)
   style_class->draw_focus = draw_focus;
   style_class->draw_slider = draw_slider;
   style_class->draw_handle = draw_handle;
+  style_class->draw_expander = draw_expander;
+  style_class->draw_resize_grip = draw_resize_grip;
 }