[gtk+] cellrenderer: Add API to keep the accessible type



commit 0470b91add2fc3fc38b77886a39e2d9ffe18b603
Author: Benjamin Otte <otte redhat com>
Date:   Thu Dec 15 18:17:06 2011 +0100

    cellrenderer: Add API to keep the accessible type
    
    It's private for now, because we require a GType that isn't exported in
    the API yet.

 gtk/gtkcellrenderer.c |   40 ++++++++++++++++++++++++++++++++++++++++
 gtk/gtkcellrenderer.h |    6 ++++++
 2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 9fa3d88..609c4a2 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -24,6 +24,7 @@
 #include "gtktypebuiltins.h"
 #include "gtkprivate.h"
 #include "gtktreeprivate.h"
+#include "a11y/gtkrenderercellaccessible.h"
 
 
 /**
@@ -130,6 +131,7 @@ struct _GtkCellRendererPrivate
 
 struct _GtkCellRendererClassPrivate
 {
+  GType accessible_type;
 };
 
 enum {
@@ -416,6 +418,8 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
                 P_("Whether this tag affects the cell background color"));
 
   g_type_class_add_private (class, sizeof (GtkCellRendererPrivate));
+
+  _gtk_cell_renderer_class_set_accessible_type (class, GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
 }
 
 static void
@@ -1759,3 +1763,39 @@ gtk_cell_renderer_get_state (GtkCellRenderer      *cell,
 
   return state;
 }
+
+/*
+ * _gtk_cell_renderer_class_set_accessible_type:
+ * @renderer_class: class to set the accessible type for
+ * @type: The object type that implements the accessible for @widget_class.
+ *     The type must be a subtype of #GtkRendererCellAccessible
+ *
+ * Sets the type to be used for creating accessibles for cells rendered by
+ * cell renderers of @renderer_class. Note that multiple accessibles will
+ * be created.
+ *
+ * This function should only be called from class init functions of cell
+ * renderers.
+ **/
+void
+_gtk_cell_renderer_class_set_accessible_type (GtkCellRendererClass *renderer_class,
+                                              GType                 type)
+{
+  GtkCellRendererClassPrivate *priv;
+
+  g_return_if_fail (GTK_IS_CELL_RENDERER_CLASS (renderer_class));
+  g_return_if_fail (g_type_is_a (type, GTK_TYPE_RENDERER_CELL_ACCESSIBLE));
+
+  priv = renderer_class->priv;
+
+  priv->accessible_type = type;
+}
+
+GType
+_gtk_cell_renderer_get_accessible_type (GtkCellRenderer *renderer)
+{
+  g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
+
+  return GTK_CELL_RENDERER_GET_CLASS (renderer)->priv->accessible_type;
+}
+
diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h
index 44aa12c..f27eb87 100644
--- a/gtk/gtkcellrenderer.h
+++ b/gtk/gtkcellrenderer.h
@@ -271,6 +271,12 @@ GtkStateFlags   gtk_cell_renderer_get_state       (GtkCellRenderer      *cell,
                                                    GtkWidget            *widget,
                                                    GtkCellRendererState  cell_state);
 
+void            _gtk_cell_renderer_class_set_accessible_type 
+                                                  (GtkCellRendererClass *renderer_class,
+                                                   GType                 type);
+GType           _gtk_cell_renderer_get_accessible_type
+                                                  (GtkCellRenderer *     renderer);
+
 G_END_DECLS
 
 #endif /* __GTK_CELL_RENDERER_H__ */



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