[gtk+] Set "cell" class and state before rendering a cellrenderer.



commit 3d57787d6e1ac9f8d9bbb98e61868355ec9f09a5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jan 23 14:31:19 2011 +0100

    Set "cell" class and state before rendering a cellrenderer.

 gtk/gtkcellrenderer.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 1f50a59..75270b9 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -683,6 +683,8 @@ gtk_cell_renderer_render (GtkCellRenderer      *cell,
 {
   gboolean selected = FALSE;
   GtkCellRendererPrivate *priv = cell->priv;
+  GtkStyleContext *context;
+  GtkStateFlags state;
 
   g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
   g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
@@ -702,13 +704,21 @@ gtk_cell_renderer_render (GtkCellRenderer      *cell,
   gdk_cairo_rectangle (cr, background_area);
   cairo_clip (cr);
 
+  context = gtk_widget_get_style_context (widget);
+
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_CELL);
+
+  state = gtk_cell_renderer_get_state (cell, widget, flags);
+  gtk_style_context_set_state (context, state);
+
   GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell,
                                               cr,
 					      widget,
 					      background_area,
 					      cell_area,
 					      flags);
-
+  gtk_style_context_restore (context);
   cairo_restore (cr);
 }
 



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