forked from AuroraMiddleware/gtk
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:
parent
2bd69cbf8c
commit
02fd1e5a62
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user