Implementación ATK para un objeto específico
- Guía de accesibilidad para los desarrolladores de GNOME
- ¿Qué es la accesibilidad?
- Ejemplos que usan la API de accesibilidad
- Implementar un objeto ATK
All GObjects implement a get_type() function. Using the above example the naming convention for this function name would be myatkimp_mytype_get_type().
In this function, you specify which interfaces your object implements. If the following logic were included in this get_type() function, this object would implement the ATK_TEXT interface:
Ejemplo 1-5 Ejemplo de función get_type()
static const GInterfaceInfo atk_text_info = { (GInterfaceInitFunc) atk_text_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
La función atl_text_interface_init(), que tiene el siguiente prototipo, deberá implementarse:
void atk_text_interface_init (AtkTextIface *iface);
Esta función conectará las llamadas de función de interfaz con la implementación específica tal y como sigue:
Ejemplo 1-6 Conectar llamadas de interfaz personalizadas con una implementación de un AtkObject
void atk_text_interface_init (AtkTextIface *iface) { g_return_if_fail (iface != NULL); iface->get_text = myatkimp_mytype_get_text; iface->get_character_at_offset = myatkimp_mytype_get_character_at_offset; ... }
Then the functions myatkimp_mytype_get_text(), myatkimp_mytype_get_character_at_offset(), and the rest of the ATK_TEXT interface functions would need to be implemented.