AtkObject Implementation
- GNOME アクセシビリティ開発者ガイド
- アクセシビリティとは何か?
- Examples that Use the Accessibility API
- Implementing an ATK Object
AtkObjects are GObjects, and all GObjects need to specify the get_type() function. Here is an example that sets up a class and instance initializer. This get_type() function also specifies that the object implements ATK_TEXT and specifies the parent object to be MYATKIMP_MYPARENTTYPE.
例 1-7 Sample get_type() implementation
GType myatkimp_mytype_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo tinfo = { sizeof (GailLabelClass), (GBaseInitFunc) NULL, /* base init */ (GBaseFinalizeFunc) NULL, /* base finalize */ (GClassInitFunc) myatkimp_mytype_class_init, /* class init */ (GClassFinalizeFunc) NULL, /* class finalize */ NULL, /* class data */ sizeof (GailLabel), /* instance size */ 0, /* nb preallocs */ (GInstanceInitFunc) myatkimp_mytype_instance_init, /* instance init */ NULL /* value table */ }; /* Set up atk_text_info structure used below */ static const GInterfaceInfo atk_text_info = { (GInterfaceInitFunc) atk_text_interface_init, (GInterfaceFinalizeFunc) NULL, NULL }; /* Set up typename and specify parent type */ type = g_type_register_static (MYATKIMP_MYPARENTTYPE, "MyatkimpMytype", &tinfo, 0); /* This class implements interface ATK_TYPE_TEXT */ g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info); } return type; }