-
-/* accessibility: object */
-
-static AtkObjectClass *a11y_parent_class = NULL;
-
-static AtkStateSet *
-gtk_switch_accessible_ref_state_set (AtkObject *accessible)
-{
- AtkStateSet *state_set;
- GtkWidget *widget;
-
- state_set = a11y_parent_class->ref_state_set (accessible);
-
- widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
- if (widget == NULL)
- return state_set;
-
- if (gtk_switch_get_active (GTK_SWITCH (widget)))
- atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
-
- return state_set;
-}
-
-static void
-gtk_switch_accessible_initialize (AtkObject *accessible,
- gpointer widget)
-{
- a11y_parent_class->initialize (accessible, widget);
-
- atk_object_set_role (accessible, ATK_ROLE_TOGGLE_BUTTON);
- atk_object_set_name (accessible, C_("light switch widget", "Switch"));
- atk_object_set_description (accessible, _("Switches between on and off states"));
-}
-
-static void
-gtk_switch_accessible_class_init (AtkObjectClass *klass)
-{
- a11y_parent_class = g_type_class_peek_parent (klass);
-
- klass->initialize = gtk_switch_accessible_initialize;
- klass->ref_state_set = gtk_switch_accessible_ref_state_set;
-}
-
-static GType
-gtk_switch_accessible_get_type (void)
-{
- static GType type = 0;
-
- /* Action interface
- Name etc. ... */
- if (G_UNLIKELY (type == 0))
- {
- GType parent_atk_type;
- GTypeInfo tinfo = { 0 };
- GTypeQuery query;
- AtkObjectFactory *factory;
-
- if ((type = g_type_from_name ("GtkSwitchAccessible")) != G_TYPE_INVALID)
- return type;
-
- /* we inherit from the same ATK factory that provides support
- * for GtkWidget; if Gail is being used then this means GailWidget.
- */
- factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET);
- if (factory == G_TYPE_INVALID)
- return G_TYPE_INVALID;
-
- parent_atk_type = atk_object_factory_get_accessible_type (factory);
- if (parent_atk_type == G_TYPE_INVALID)
- return G_TYPE_INVALID;
-
- g_type_query (parent_atk_type, &query);
-
- tinfo.class_init = (GClassInitFunc) gtk_switch_accessible_class_init;
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- type = g_type_register_static (parent_atk_type,
- I_("GtkSwitchAccessible"),
- &tinfo, 0);
- }
-
- return type;
-}
-/* accessibility: factory */
-
-typedef AtkObjectFactoryClass GtkSwitchAccessibleFactoryClass;
-typedef AtkObjectFactory GtkSwitchAccessibleFactory;
-
-G_DEFINE_TYPE (GtkSwitchAccessibleFactory,
- gtk_switch_accessible_factory,
- ATK_TYPE_OBJECT_FACTORY);
-
-static GType
-gtk_switch_accessible_factory_get_accessible_type (void)
-{
- return gtk_switch_accessible_get_type ();
-}
-
-static AtkObject *
-gtk_switch_accessible_factory_create_accessible (GObject *obj)
-{
- AtkObject *accessible;
-
- accessible = g_object_new (gtk_switch_accessible_get_type (), NULL);
- atk_object_initialize (accessible, obj);
-
- return accessible;
-}
-
-static void
-gtk_switch_accessible_factory_class_init (AtkObjectFactoryClass *klass)
-{
- klass->create_accessible = gtk_switch_accessible_factory_create_accessible;
- klass->get_accessible_type = gtk_switch_accessible_factory_get_accessible_type;
-}
-
-static void
-gtk_switch_accessible_factory_init (AtkObjectFactory *factory)
-{
-}