2009-27-09 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / tests / dummyatk / my-atk-table.c
1 /* This file contains both declaration and definition of the MyAtkTable,
2  * a GObject that pretends to implement the AtkTableIface interface (it 
3  * registers appropriate interface), but provides no implementation for any of the
4  * methods of this interface (NULL-filled vftbl).
5  */
6
7 #include <glib-object.h>
8 #include <atk/atk.h> 
9
10 #include "my-atk-object.h"
11 #include "my-atk-table.h"
12     
13 ///////////////////////////////////////////////////////////////////////////
14 // Helper functions and data
15 ///////////////////////////////////////////////////////////////////////////
16 void
17 my_atk_table_select_rows (MyAtkTable* table, gboolean sel_scheme[])
18 {
19     // the function does nothing  
20 }
21
22 void
23 my_atk_table_select_columns (MyAtkTable* table, gboolean sel_scheme[])
24 {
25     // the function does nothing
26 }
27
28 ///////////////////////////////////////////////////////////////////////////
29 // Implementation
30 ///////////////////////////////////////////////////////////////////////////
31 static GObjectClass *parent_class_table = NULL;
32
33 /******************************************************************/
34 static void
35 table_interface_init (gpointer g_iface, gpointer iface_data)
36 {
37     AtkTableIface *klass = (AtkTableIface *)g_iface;
38     
39     /* set up overrides here */
40     klass-> ref_at =
41         (AtkObject* (*) (AtkTable *table, gint row, gint column)) NULL;
42     klass-> get_index_at =
43         (gint (*) (AtkTable *table, gint row, gint column)) NULL;
44     klass-> get_column_at_index =
45         (gint (*) (AtkTable *table, gint index_)) NULL;
46     klass-> get_row_at_index =
47         (gint (*) (AtkTable *table, gint index_)) NULL;
48     klass-> get_n_columns =
49         (gint (*) (AtkTable *table)) NULL;
50     klass-> get_n_rows =
51         (gint (*) (AtkTable *table)) NULL;
52     klass-> get_column_extent_at =
53         (gint (*) (AtkTable *table, gint row, gint column)) NULL;
54     klass-> get_row_extent_at =
55         (gint (*) (AtkTable *table, gint row, gint column)) NULL;
56     klass-> get_caption =
57         (AtkObject* (*) (AtkTable *table)) NULL;
58     klass-> get_column_description =
59         (const gchar* (*) (AtkTable *table, gint column)) NULL;
60     klass-> get_column_header =
61         (AtkObject* (*) (AtkTable *table, gint column)) NULL;
62     klass-> get_row_description =
63         (const gchar* (*) (AtkTable *table, gint row)) NULL;
64     klass-> get_row_header =
65         (AtkObject* (*) (AtkTable *table, gint row)) NULL;
66     klass-> get_summary =
67         (AtkObject* (*) (AtkTable *table)) NULL;
68     klass-> set_caption =
69         (void (*) (AtkTable *table, AtkObject *caption)) NULL;
70     klass-> set_column_description =
71         (void (*) (AtkTable *table, gint column, const gchar *description)) NULL;
72     klass-> set_column_header =
73         (void (*) (AtkTable *table, gint column, AtkObject *header)) NULL;
74     klass-> set_row_description =
75         (void (*) (AtkTable *table, gint row, const gchar *description)) NULL;
76     klass-> set_row_header =
77         (void (*) (AtkTable *table, gint row, AtkObject *header)) NULL;
78     klass-> set_summary =
79         (void (*) (AtkTable *table, AtkObject *accessible)) NULL;
80     klass-> get_selected_columns =
81         (gint (*) (AtkTable *table, gint **selected)) NULL;
82     klass-> get_selected_rows =
83         (gint (*) (AtkTable *table, gint **selected)) NULL;
84     klass-> is_column_selected =
85         (gboolean (*) (AtkTable *table, gint column)) NULL;
86     klass-> is_row_selected =
87         (gboolean (*) (AtkTable *table, gint row)) NULL;
88     klass-> is_selected =
89         (gboolean (*) (AtkTable *table, gint row, gint column)) NULL;
90     klass-> add_row_selection =
91         (gboolean (*) (AtkTable *table, gint row)) NULL;
92     klass-> remove_row_selection =
93         (gboolean (*) (AtkTable *table, gint row)) NULL;
94     klass-> add_column_selection =
95         (gboolean (*) (AtkTable *table, gint column)) NULL;
96     klass-> remove_column_selection =
97         (gboolean (*) (AtkTable *table, gint column)) NULL;
98 }
99
100 static void
101 table_instance_init (GTypeInstance *instance, gpointer g_class)
102 {
103     MyAtkTable *self = (MyAtkTable *)instance;
104     
105     self->disposed = FALSE;
106 }
107
108 static void
109 my_atk_table_dispose (GObject *obj)
110 {
111     MyAtkTable *self = (MyAtkTable *)obj;
112
113     if (self->disposed) 
114     {
115         return;
116     }
117     
118     /* Make sure dispose does not run twice. */
119     self->disposed = TRUE;
120
121     /* Chain up to the parent class */
122     G_OBJECT_CLASS (parent_class_table)->dispose (obj);
123 }
124
125 static void
126 my_atk_table_finalize (GObject *obj)
127 {
128     /* Chain up to the parent class */
129     G_OBJECT_CLASS (parent_class_table)->finalize (obj);
130 }
131
132 static void
133 my_atk_table_class_init (gpointer g_class, gpointer g_class_data)
134 {
135     GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
136     MyAtkTableClass *klass = MY_ATK_TABLE_CLASS (g_class);
137
138     gobject_class->dispose = my_atk_table_dispose;
139     gobject_class->finalize = my_atk_table_finalize;
140
141     parent_class_table = g_type_class_peek_parent (klass);
142 }
143
144 GType 
145 my_atk_table_get_type (void)
146 {
147     static GType type = 0;
148     if (type == 0) 
149     {
150         static const GTypeInfo info = 
151         {
152             sizeof (MyAtkTableClass),
153             NULL,   /* base_init */
154             NULL,   /* base_finalize */
155             my_atk_table_class_init, /* class_init */
156             NULL,   /* class_finalize */
157             NULL,   /* class_data */
158             sizeof (MyAtkTable),
159             0,      /* n_preallocs */
160             table_instance_init    /* instance_init */
161         };
162                 
163         static const GInterfaceInfo iface_info = 
164         {
165             (GInterfaceInitFunc) table_interface_init,    /* interface_init */
166             NULL,                                       /* interface_finalize */
167             NULL                                        /* interface_data */
168         };
169         type = g_type_register_static (MY_TYPE_ATK_OBJECT,
170                                        "MyAtkTableType",
171                                        &info, 0);
172         g_type_add_interface_static (type,
173                                      ATK_TYPE_TABLE,
174                                      &iface_info);
175     }
176     return type;
177 }