[gtk+/cellarea-style-transitions: 4/10] cellrenderer: Add gtk_cell_renderer_apply_style()



commit cc8463c665c1f4394b269c31e70bbb18b9f36720
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed May 11 00:37:39 2011 +0200

    cellrenderer: Add gtk_cell_renderer_apply_style()
    
    Through the vfunc, cell renderer implementations may provide
    the style properties (classes, regions and such) applying to
    a cell renderer.

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtkcellrenderer.c                |   22 ++++++++++++++++++++++
 gtk/gtkcellrenderer.h                |    5 ++++-
 3 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 291b219..c4746f2 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -4566,6 +4566,7 @@ gtk_cell_renderer_set_alignment
 gtk_cell_renderer_get_padding
 gtk_cell_renderer_set_padding
 gtk_cell_renderer_get_state
+gtk_cell_renderer_apply_style
 gtk_cell_renderer_is_activatable
 
 <SUBSECTION Width-for-height>
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 89cae62..7cbecf2 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -1734,3 +1734,25 @@ gtk_cell_renderer_get_state (GtkCellRenderer      *cell,
 
   return state;
 }
+
+/**
+ * gtk_cell_renderer_apply_style:
+ * @cell: a #GtkCellRenderer
+ * @style_context: a #GtkStyleContext
+ *
+ * Applies into @style_context the style properties affecting
+ * @cell. This should be called between a
+ * gtk_style_context_save()/gtk_style_context_restore() pair.
+ *
+ * Since: 3.2
+ **/
+void
+gtk_cell_renderer_apply_style (GtkCellRenderer *cell,
+                               GtkStyleContext *style_context)
+{
+  g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
+  g_return_if_fail (GTK_IS_STYLE_CONTEXT (style_context));
+
+  if (GTK_CELL_RENDERER_GET_CLASS (cell)->apply_style)
+    GTK_CELL_RENDERER_GET_CLASS (cell)->apply_style (cell, style_context);
+}
diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h
index 0c05d2f..df51f59 100644
--- a/gtk/gtkcellrenderer.h
+++ b/gtk/gtkcellrenderer.h
@@ -151,11 +151,12 @@ struct _GtkCellRendererClass
 			     const gchar     *path);
 
   GtkStateFlags (* get_current_state)                    (GtkCellRenderer      *cell);
+  void          (* apply_style)                          (GtkCellRenderer      *cell,
+                                                          GtkStyleContext      *style_context);
 
   /* Padding for future expansion */
   void (*_gtk_reserved1) (void);
   void (*_gtk_reserved2) (void);
-  void (*_gtk_reserved3) (void);
 };
 
 GType              gtk_cell_renderer_get_type       (void) G_GNUC_CONST;
@@ -266,6 +267,8 @@ void            _gtk_cell_renderer_calc_offset    (GtkCellRenderer      *cell,
 GtkStateFlags   gtk_cell_renderer_get_state       (GtkCellRenderer      *cell,
                                                    GtkWidget            *widget,
                                                    GtkCellRendererState  cell_state);
+void            gtk_cell_renderer_apply_style     (GtkCellRenderer      *cell,
+                                                   GtkStyleContext      *style_context);
 
 G_END_DECLS
 



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