[gtk+] a11y: Add _gtk_cell_accessible_state_changed()



commit 7f42a9465a6d8935250911f113c9d79889c14638
Author: Benjamin Otte <otte redhat com>
Date:   Sun Dec 11 06:37:05 2011 +0100

    a11y: Add _gtk_cell_accessible_state_changed()
    
    It's supposed to replace the old state_set calls.

 gtk/a11y/gtkcellaccessible.c |   36 ++++++++++++++++++++++++++++++++++++
 gtk/a11y/gtkcellaccessible.h |    3 +++
 2 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c
index a4f1792..d24dd43 100644
--- a/gtk/a11y/gtkcellaccessible.c
+++ b/gtk/a11y/gtkcellaccessible.c
@@ -495,3 +495,39 @@ _gtk_cell_accessible_get_state (GtkCellAccessible *cell)
 
   return _gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
 }
+
+/**
+ * _gtk_cell_accessible_state_changed:
+ * @cell: a #GtkCellAccessible
+ * @added: the flags that were added from @cell
+ * @removed: the flags that were removed from @cell
+ *
+ * Notifies @cell of state changes. Multiple states may be added
+ * or removed at the same time. A state that is @added may not be
+ * @removed at the same time.
+ **/
+void
+_gtk_cell_accessible_state_changed (GtkCellAccessible    *cell,
+                                    GtkCellRendererState  added,
+                                    GtkCellRendererState  removed)
+{
+  AtkObject *object;
+  guint i;
+
+  g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
+  g_return_if_fail ((added & removed) == 0);
+
+  object = ATK_OBJECT (cell);
+
+  for (i = 0; i < G_N_ELEMENTS (state_map); i++)
+    {
+      if (added & state_map[i].renderer_state)
+        atk_object_notify_state_change (object, 
+                                        state_map[i].atk_state,
+                                        !state_map[i].invert);
+      if (added & state_map[i].renderer_state)
+        atk_object_notify_state_change (object, 
+                                        state_map[i].atk_state,
+                                        state_map[i].invert);
+    }
+}
diff --git a/gtk/a11y/gtkcellaccessible.h b/gtk/a11y/gtkcellaccessible.h
index 730c21a..1e14ad4 100644
--- a/gtk/a11y/gtkcellaccessible.h
+++ b/gtk/a11y/gtkcellaccessible.h
@@ -51,6 +51,9 @@ GType    _gtk_cell_accessible_get_type      (void);
 
 GtkCellRendererState
          _gtk_cell_accessible_get_state     (GtkCellAccessible *cell);
+void     _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
+                                             GtkCellRendererState added,
+                                             GtkCellRendererState removed);
 void     _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell);
 
 void     _gtk_cell_accessible_initialise    (GtkCellAccessible *cell,



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