mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
a11y: Implement role and state change in GtkSwitch
Set the "switch" role, and update the "checked" state when the :active property is toggled.
This commit is contained in:
parent
732578eb53
commit
52c1fb8dfe
@ -606,6 +606,8 @@ gtk_switch_class_init (GtkSwitchClass *klass)
|
||||
g_object_class_override_property (gobject_class, PROP_ACTION_TARGET, "action-target");
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("switch"));
|
||||
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_SWITCH);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -700,6 +702,10 @@ gtk_switch_set_active (GtkSwitch *self,
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), switch_props[PROP_ACTIVE]);
|
||||
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_STATE_CHECKED, is_active,
|
||||
-1);
|
||||
|
||||
gtk_widget_queue_allocate (GTK_WIDGET (self));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user