[gtk+/gtk-style-context] GtkStyle: set style context state before calling gtk_render_icon_pixbuf()



commit 325ad6b65eaa36a3ad0396c0599b11d4a1fb9efe
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Dec 3 20:31:13 2010 +0100

    GtkStyle: set style context state before calling gtk_render_icon_pixbuf()

 gtk/gtkstyle.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 8364556..ff7686a 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -1693,6 +1693,7 @@ gtk_default_render_icon (GtkStyle            *style,
 {
   GtkStyleContext *context;
   GtkStylePrivate *priv;
+  GtkStateFlags flags = 0;
   GdkPixbuf *pixbuf;
 
   if (widget)
@@ -1711,6 +1712,20 @@ gtk_default_render_icon (GtkStyle            *style,
   if (detail)
     transform_detail_string (detail, context);
 
+  switch (state)
+    {
+    case GTK_STATE_PRELIGHT:
+      flags |= GTK_STATE_FLAG_PRELIGHT;
+      break;
+    case GTK_STATE_INSENSITIVE:
+      flags |= GTK_STATE_FLAG_INSENSITIVE;
+      break;
+    default:
+      break;
+    }
+
+  gtk_style_context_set_state (context, flags);
+
   pixbuf = gtk_render_icon_pixbuf (context, source, size);
 
   gtk_style_context_restore (context);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]