a11y: Add _gtk_cell_accessible_parent_get_child_index()

This will soon replace the shenanigans we do to keep the index of cells
current.
This commit is contained in:
Benjamin Otte 2011-11-10 22:07:19 +01:00
parent 2bd69cbf8c
commit 02fd1e5a62
3 changed files with 30 additions and 0 deletions

View File

@ -91,8 +91,18 @@ static gint
gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
{
GtkCellAccessible *cell;
AtkObject *parent;
int index;
cell = GTK_CELL_ACCESSIBLE (obj);
parent = gtk_widget_get_accessible (cell->widget);
if (parent == NULL)
return -1;
index = _gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
if (index >= 0)
return index;
if (atk_state_set_contains_state (cell->state_set, ATK_STATE_STALE) &&
cell->refresh_index != NULL)
{

View File

@ -95,3 +95,19 @@ _gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
else
return FALSE;
}
int
_gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell)
{
GtkCellAccessibleParentIface *iface;
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (iface->get_child_index)
return (iface->get_child_index) (parent, cell);
else
return -1;
}

View File

@ -58,6 +58,8 @@ struct _GtkCellAccessibleParentIface
GdkRectangle *cell_rect);
gboolean ( *grab_focus) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
int ( *get_child_index) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
};
GType _gtk_cell_accessible_parent_get_type (void);
@ -74,6 +76,8 @@ void _gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *
GdkRectangle *cell_rect);
gboolean _gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
int _gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
G_END_DECLS