diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-11-12 16:16:48 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-11-12 21:46:06 +0000 |
commit | 0d7fcdda28c0a5ea57d18353f314e22c92a71c0c (patch) | |
tree | 7d6afb80b1349182d14cc3f024ae8ce723061b54 /gtk/gtktreeexpander.c | |
parent | 75f9b83b1efd645b79a4a6d1dbeca6876310e50b (diff) | |
download | gtk+-0d7fcdda28c0a5ea57d18353f314e22c92a71c0c.tar.gz |
a11y: Add more accessible data to GtkTreeExpander
Document the role of the GtkTreeExpander, and the behaviour of the
expander button.
Additionally, improve the label of the expander button, by adding a
fixed "Expand" label, and setting the "labelled-by" relation to the
child of the GtkTreeExpander.
Diffstat (limited to 'gtk/gtktreeexpander.c')
-rw-r--r-- | gtk/gtktreeexpander.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gtk/gtktreeexpander.c b/gtk/gtktreeexpander.c index 2a68df898d..9b50e02039 100644 --- a/gtk/gtktreeexpander.c +++ b/gtk/gtktreeexpander.c @@ -25,6 +25,7 @@ #include "gtkboxlayout.h" #include "gtkbuiltiniconprivate.h" #include "gtkdropcontrollermotion.h" +#include "gtkenums.h" #include "gtkgestureclick.h" #include "gtkintl.h" #include "gtktreelistmodel.h" @@ -66,6 +67,12 @@ * If the node is not expandable, an "indent" node will be displayed instead. * * For every level of depth, another "indent" node is prepended. + * + * # Accessibility + * + * GtkTreeExpander uses the %GTK_ACCESSIBLE_ROLE_GROUP role. The expander icon + * is represented as a %GTK_ACCESSIBLE_ROLE_BUTTON, labelled by the expander's + * child, and toggling it will change the %GTK_ACCESSIBLE_STATE_EXPANDED state. */ struct _GtkTreeExpander @@ -182,6 +189,13 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self) gtk_widget_insert_before (self->expander, GTK_WIDGET (self), self->child); + + gtk_accessible_update_property (GTK_ACCESSIBLE (self->expander), + GTK_ACCESSIBLE_PROPERTY_LABEL, _("Expand"), + -1); + gtk_accessible_update_relation (GTK_ACCESSIBLE (self->expander), + GTK_ACCESSIBLE_RELATION_LABELLED_BY, self->child, NULL, + -1); } if (gtk_tree_list_row_get_expanded (self->list_row)) @@ -600,6 +614,7 @@ gtk_tree_expander_class_init (GtkTreeExpanderClass *klass) gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT); gtk_widget_class_set_css_name (widget_class, I_("treeexpander")); + gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP); } static gboolean |