From 7f42a9465a6d8935250911f113c9d79889c14638 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 11 Dec 2011 06:37:05 +0100 Subject: [PATCH] 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(+) diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c index a4f1792b3b..d24dd435bb 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 730c21adac..1e14ad4060 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,