Ejemplos que usan la API de accesibilidad
As noted earlier, you should have little or no work to do to make your application accessible if you use the GTK widget set, or any other widget library that implements the ATK interfaces. The two most common things you may have to do in this case are:
-
provide descriptions of some controls and images using atk_object_set_description() or atk_image_set_description():
Ejemplo 1-3 Establecer la descripción accesible para un botón{ AtkObject *obj; obj = gtk_widget_get_accessible(button); atk_object_set_description(obj,_("Abre el diálogo de preferencias")); }
-
Especifique la relación entre cualquier agrupación inusual de widgets usando atk_relation_new() y atk_relation_set_add():
Ejemplo 1-4 Especificar la relación accesible entre dos controles{ GtkWidget *widget; GtkLabel *label; AtkObject *atk_widget, *atk_label; AtkRelationSet *relation_set; AtkRelation *relation; AtkObject *targets[1]; atk_widget = gtk_widget_get_accessible (widget); atk_label = gtk_widget_get_accessible (GTK_WIDGET(label)); relation_set = atk_object_ref_relation_set (atk_label); targets[0] = atk_widget; relation = atk_relation_new(targets,1, ATK_RELATION_LABEL_FOR); atk_relation_set_add(relation_set,relation); g_object_unref(G_OBJECT(relation)); }
The examples in the rest of this section are mostly to give you a flavor of the scope of the ATK. They cover techniques that you may never need to use as an application developer, although they may be of interest if you are writing your own custom widgets (see Making Custom Components Accessible) or if you want to write an assistive technology application. Whatever the purpose, the GAIL source code serves as an excellent tutorial for advanced ATK usage.