[gtk/matthiasc/for-master] popovermenubar: Initial accessibility setup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] popovermenubar: Initial accessibility setup
- Date: Wed, 21 Oct 2020 20:36:40 +0000 (UTC)
commit 228e450e57ad2be81f2b0f098833a73157e289a0
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 21 16:34:16 2020 -0400
popovermenubar: Initial accessibility setup
Set roles, properties and relations according to the
ARIA authoring practices document. This is not quite
complete.
gtk/gtkpopovermenubar.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
---
diff --git a/gtk/gtkpopovermenubar.c b/gtk/gtkpopovermenubar.c
index 1f172e3088..92a6c4ca91 100644
--- a/gtk/gtkpopovermenubar.c
+++ b/gtk/gtkpopovermenubar.c
@@ -316,6 +316,22 @@ gtk_popover_menu_bar_item_activate (GtkPopoverMenuBarItem *item)
set_active_item (bar, item, TRUE);
}
+static void
+gtk_popover_menu_bar_item_root (GtkWidget *widget)
+{
+ GtkPopoverMenuBarItem *item = GTK_POPOVER_MENU_BAR_ITEM (widget);
+
+ GTK_WIDGET_CLASS (gtk_popover_menu_bar_item_parent_class)->root (widget);
+
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (widget),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, g_list_append (NULL, item->label),
+ GTK_ACCESSIBLE_RELATION_CONTROLS, g_list_append (NULL, item->popover),
+ -1);
+ gtk_accessible_update_property (GTK_ACCESSIBLE (widget),
+ GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
+ -1);
+}
+
static void
gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
{
@@ -325,6 +341,7 @@ gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
object_class->dispose = gtk_popover_menu_bar_item_dispose;
object_class->finalize = gtk_popover_menu_bar_item_finalize;
+ widget_class->root = gtk_popover_menu_bar_item_root;
widget_class->measure = gtk_popover_menu_bar_item_measure;
widget_class->size_allocate = gtk_popover_menu_bar_item_size_allocate;
@@ -340,6 +357,7 @@ gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
G_TYPE_NONE, 0);
gtk_widget_class_set_css_name (widget_class, I_("item"));
+ gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_ITEM);
}
enum
{
@@ -552,6 +570,10 @@ gtk_popover_menu_bar_root (GtkWidget *widget)
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
add_to_window (GTK_WINDOW (toplevel), bar);
+
+ gtk_accessible_update_property (GTK_ACCESSIBLE (bar),
+ GTK_ACCESSIBLE_PROPERTY_ORIENTATION, GTK_ORIENTATION_HORIZONTAL,
+ -1);
}
static void
@@ -598,6 +620,7 @@ gtk_popover_menu_bar_class_init (GtkPopoverMenuBarClass *klass)
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
gtk_widget_class_set_css_name (widget_class, I_("menubar"));
+ gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_BAR);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]