Added atk tests
[platform/core/uifw/at-spi2-atk.git] / atk-tests / MyAtkImplementor.c
1 #include "MyAtkImplementor.h"
2
3 //implementaion
4 static GObjectClass *parent_class = NULL;
5
6 static AtkObject* my_atk_implementor_ref_accessible(AtkImplementor *implementor)
7 {
8     AtkObject *result = ((MyAtkImplementor*)implementor)->accessible;
9     g_object_ref((GObject*)result);
10     return result;
11 }
12
13 static void my_atk_implementor_instance_init(GTypeInstance *instance, gpointer g_class)
14 {
15     MyAtkImplementor *self = (MyAtkImplementor*)instance;
16     
17     self->accessible = ATK_OBJECT(g_object_new(ATK_TYPE_OBJECT,NULL));
18     self->is_disposed = FALSE;
19 }
20
21 static void my_atk_implementor_interface_init(gpointer g_iface,gpointer iface_data)
22 {
23     AtkImplementorIface *iface = ((AtkImplementorIface*)g_iface);
24     iface->ref_accessible = my_atk_implementor_ref_accessible;
25 }
26
27 static void my_atk_implementor_dispose(GObject *obj)
28 {
29     MyAtkImplementor *self = (MyAtkImplementor*)obj;
30     if(!self->is_disposed)
31     {
32         g_object_unref(self->accessible);
33         self->is_disposed = TRUE;
34     }
35     parent_class->dispose(obj);
36 }
37
38 static void my_atk_implementor_class_init(gpointer g_class,gpointer g_data)
39 {
40     MyAtkImplementorClass *klass = MY_ATK_IMPLEMENTOR_CLASS(g_class);
41     parent_class = g_type_class_peek_parent(klass);
42 }
43
44 GType my_atk_implementor_get_type(void)
45 {
46     static GType type = 0;
47     if(type == 0)
48     {
49         static const GTypeInfo typeinfo = {
50             sizeof(MyAtkImplementorClass),
51             NULL, /*base_init */
52             NULL, /*base_finalize */
53             my_atk_implementor_class_init,/*class_init*/
54             NULL, /*class_finalize*/
55             NULL,/*class_data*/
56             sizeof(MyAtkImplementor),
57             0, /*n_prealloc*/
58             my_atk_implementor_instance_init/* instance_init*/
59         };
60         type = g_type_register_static(G_TYPE_OBJECT,"MyAtkImplementor",&typeinfo,0);
61         static const GInterfaceInfo interface_info = 
62         {
63             my_atk_implementor_interface_init, /*interface_init*/
64             NULL, /*interface_finalize*/
65             NULL, /*interface_data*/
66         };
67         g_type_add_interface_static(type, ATK_TYPE_IMPLEMENTOR,&interface_info);
68     }
69     return type;
70 }