a11y: Add _gtk_cell_accessible_state_changed()

It's supposed to replace the old state_set calls.
This commit is contained in:
Benjamin Otte 2011-12-11 06:37:05 +01:00
parent 90f04b56a7
commit 7f42a9465a
2 changed files with 39 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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,