Revert "Revert "Merge remote-tracking branch 'origin/sandbox/mniesluchow/upstream_2_1...
[platform/upstream/atk.git] / atk / atknoopobject.c
1 /* ATK -  Accessibility Toolkit
2  * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include "atk.h"
23 #include "atknoopobject.h"
24
25 /**
26  * SECTION:atknoopobject
27  * @Short_description: An AtkObject which purports to implement all ATK interfaces.
28  * @Title:AtkNoOpObject
29  *
30  * An AtkNoOpObject is an AtkObject which purports to implement all
31  * ATK interfaces. It is the type of AtkObject which is created if an
32  * accessible object is requested for an object type for which no
33  * factory type is specified.
34  *
35  */
36
37
38 static void atk_no_op_object_class_init (AtkNoOpObjectClass *klass);
39
40 static gpointer parent_class = NULL;
41
42
43 GType
44 atk_no_op_object_get_type (void)
45 {
46   static GType type = 0;
47
48   if (!type)
49   {
50     static const GTypeInfo tinfo =
51     {
52       sizeof (AtkObjectClass),
53       (GBaseInitFunc) NULL, /* base init */
54       (GBaseFinalizeFunc) NULL, /* base finalize */
55       (GClassInitFunc) atk_no_op_object_class_init, /* class init */
56       (GClassFinalizeFunc) NULL, /* class finalize */
57       NULL, /* class data */
58       sizeof (AtkNoOpObject), /* instance size */
59       0, /* nb preallocs */
60       (GInstanceInitFunc) NULL, /* instance init */
61       NULL /* value table */
62     };
63
64     static const GInterfaceInfo atk_component_info =
65     {
66         (GInterfaceInitFunc) NULL,
67         (GInterfaceFinalizeFunc) NULL,
68         NULL
69     };
70
71     static const GInterfaceInfo atk_action_info =
72     {
73         (GInterfaceInitFunc) NULL,
74         (GInterfaceFinalizeFunc) NULL,
75         NULL
76     };
77
78     static const GInterfaceInfo atk_editable_text_info =
79     {
80         (GInterfaceInitFunc) NULL,
81         (GInterfaceFinalizeFunc) NULL,
82         NULL
83     };
84
85     static const GInterfaceInfo atk_image_info =
86     {
87         (GInterfaceInitFunc) NULL,
88         (GInterfaceFinalizeFunc) NULL,
89         NULL
90     };
91
92     static const GInterfaceInfo atk_selection_info =
93     {
94         (GInterfaceInitFunc) NULL,
95         (GInterfaceFinalizeFunc) NULL,
96         NULL
97     };
98
99     static const GInterfaceInfo atk_table_info =
100     {
101         (GInterfaceInitFunc) NULL,
102         (GInterfaceFinalizeFunc) NULL,
103         NULL
104     };
105
106     static const GInterfaceInfo atk_table_cell_info =
107     {
108         (GInterfaceInitFunc) NULL,
109         (GInterfaceFinalizeFunc) NULL,
110         NULL
111     };
112
113     static const GInterfaceInfo atk_text_info =
114     {
115         (GInterfaceInitFunc) NULL,
116         (GInterfaceFinalizeFunc) NULL,
117         NULL
118     };
119
120     static const GInterfaceInfo atk_hypertext_info =
121     {
122         (GInterfaceInitFunc) NULL,
123         (GInterfaceFinalizeFunc) NULL,
124         NULL
125     };
126
127     static const GInterfaceInfo atk_value_info =
128     {
129         (GInterfaceInitFunc) NULL,
130         (GInterfaceFinalizeFunc) NULL,
131         NULL
132     };
133
134     static const GInterfaceInfo atk_document_info =
135     {
136         (GInterfaceInitFunc) NULL,
137         (GInterfaceFinalizeFunc) NULL,
138         NULL
139     };
140
141     static const GInterfaceInfo atk_window_info =
142     {
143         (GInterfaceInitFunc) NULL,
144         (GInterfaceFinalizeFunc) NULL,
145         NULL
146     };
147
148     type = g_type_register_static (ATK_TYPE_OBJECT,
149                                     "AtkNoOpObject", &tinfo, 0);
150     g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
151                                  &atk_component_info);
152     g_type_add_interface_static (type, ATK_TYPE_ACTION,
153                                  &atk_action_info);
154     g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT,
155                                  &atk_editable_text_info);
156     g_type_add_interface_static (type, ATK_TYPE_IMAGE,
157                                  &atk_image_info);
158     g_type_add_interface_static (type, ATK_TYPE_SELECTION,
159                                  &atk_selection_info);
160     g_type_add_interface_static (type, ATK_TYPE_TABLE,
161                                  &atk_table_info);
162     g_type_add_interface_static (type, ATK_TYPE_TABLE_CELL,
163                                  &atk_table_cell_info);
164     g_type_add_interface_static (type, ATK_TYPE_TEXT,
165                                  &atk_text_info);
166     g_type_add_interface_static (type, ATK_TYPE_HYPERTEXT,
167                                  &atk_hypertext_info);
168     g_type_add_interface_static (type, ATK_TYPE_VALUE,
169                                  &atk_value_info);
170     g_type_add_interface_static (type, ATK_TYPE_DOCUMENT,
171                                  &atk_document_info);
172     g_type_add_interface_static (type, ATK_TYPE_WINDOW,
173                                  &atk_window_info);
174   }
175   return type;
176 }
177
178 static void
179 atk_no_op_object_class_init (AtkNoOpObjectClass *klass)
180 {
181   parent_class = g_type_class_peek_parent (klass);
182 }
183
184 /**
185  * atk_no_op_object_new:
186  * @obj: a #GObject
187  *
188  * Provides a default (non-functioning stub) #AtkObject.
189  * Application maintainers should not use this method. 
190  *
191  * Returns: a default (non-functioning stub) #AtkObject
192  **/
193 AtkObject*
194 atk_no_op_object_new (GObject *obj)
195 {
196   AtkObject *accessible;
197
198   g_return_val_if_fail (obj != NULL, NULL);
199
200   accessible = g_object_new (ATK_TYPE_NO_OP_OBJECT, NULL);
201   g_return_val_if_fail (accessible != NULL, NULL);
202
203   accessible->role = ATK_ROLE_INVALID;
204   accessible->layer = ATK_LAYER_INVALID;
205
206   return accessible;
207 }
208