diff options
author | Lukáš Tyrychtr <lukastyrychtr@gmail.com> | 2022-09-09 11:10:25 +0200 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2023-02-03 11:49:17 +0100 |
commit | be3611382671283544a5b38b57a28f438e6ceb72 (patch) | |
tree | 534d98f8cf78d156b13280174a3efefc790761ad /gtk/gtkaccessible.c | |
parent | 5dfbaa53fcc03a57837c49b78848dd082890680e (diff) | |
download | gtk+-be3611382671283544a5b38b57a28f438e6ceb72.tar.gz |
a11y: Implement the new GtkAccessible vfuncs
Implement the gtk_accessible functions and begin removing the old widget
based tree calls.
Diffstat (limited to 'gtk/gtkaccessible.c')
-rw-r--r-- | gtk/gtkaccessible.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index 05f804e25d..20ee867242 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -90,6 +90,41 @@ gtk_accessible_get_at_context (GtkAccessible *self) return GTK_ACCESSIBLE_GET_IFACE (self)->get_at_context (self); } + +/* + * gtk_accessible_get_parent: + * @self: a `GtkAccessible` + * + * Retrieves the parent `GtkAccessible` for the given `GtkAccessible`. + * + * Returns: (transfer none): the parent `GtkAccessible` or NULL, if we this is the root + */ +GtkAccessible * +gtk_accessible_get_parent (GtkAccessible *self) +{ + g_return_val_if_fail (GTK_IS_ACCESSIBLE (self), NULL); + + return GTK_ACCESSIBLE_GET_IFACE (self)->get_parent (self); +} + + +/* + * gtk_accessible_get_child_at_index: + * @self: a `GtkAccessible` + * @index: the index of the child to get + * + * Retrieves the child `GtkAccessible` for this `GtkAccessible` with the given @index. + * + * Returns: (transfer none): the child `GtkAccessible` with the given @index or NULL if the index is outside range + */ +GtkAccessible * +gtk_accessible_get_child_at_index (GtkAccessible *self, guint index) +{ + g_return_val_if_fail (GTK_IS_ACCESSIBLE (self), NULL); + + return GTK_ACCESSIBLE_GET_IFACE (self)->get_child_at_index (self, index); +} + /** * gtk_accessible_get_accessible_role: (attributes org.gtk.Method.get_property=accessible-role) * @self: a `GtkAccessible` @@ -712,7 +747,7 @@ gtk_accessible_platform_changed (GtkAccessible *self, /* propagate changes up from ignored widgets */ if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE) - context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self)))); + context = gtk_accessible_get_at_context (gtk_accessible_get_parent (self)); if (context == NULL) return; @@ -829,7 +864,7 @@ gtk_accessible_update_children (GtkAccessible *self, /* propagate changes up from ignored widgets */ if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE) - context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (gtk_widget_get_parent (GTK_WIDGET (self)))); + context = gtk_accessible_get_at_context (gtk_accessible_get_parent (self)); if (context == NULL) return; |