Revert "Merge remote-tracking branch 'origin/sandbox/mniesluchow/upstream_2_16' into...
[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 "atk.h"
21 #include "atknoopobject.h"
22
23 /**
24  * SECTION:atknoopobject
25  * @Short_description: An AtkObject which purports to implement all ATK interfaces.
26  * @Title:AtkNoOpObject
27  *
28  * An AtkNoOpObject is an AtkObject which purports to implement all
29  * ATK interfaces. It is the type of AtkObject which is created if an
30  * accessible object is requested for an object type for which no
31  * factory type is specified.
32  *
33  */
34
35
36 static void atk_no_op_object_class_init (AtkNoOpObjectClass *klass);
37
38 static gpointer parent_class = NULL;
39
40
41 GType
42 atk_no_op_object_get_type (void)
43 {
44   static GType type = 0;
45
46   if (!type)
47   {
48     static const GTypeInfo tinfo =
49     {
50       sizeof (AtkObjectClass),
51       (GBaseInitFunc) NULL, /* base init */
52       (GBaseFinalizeFunc) NULL, /* base finalize */
53       (GClassInitFunc) atk_no_op_object_class_init, /* class init */
54       (GClassFinalizeFunc) NULL, /* class finalize */
55       NULL, /* class data */
56       sizeof (AtkNoOpObject), /* instance size */
57       0, /* nb preallocs */
58       (GInstanceInitFunc) NULL, /* instance init */
59       NULL /* value table */
60     };
61
62     static const GInterfaceInfo atk_component_info =
63     {
64         (GInterfaceInitFunc) NULL,
65         (GInterfaceFinalizeFunc) NULL,
66         NULL
67     };
68
69     static const GInterfaceInfo atk_action_info =
70     {
71         (GInterfaceInitFunc) NULL,
72         (GInterfaceFinalizeFunc) NULL,
73         NULL
74     };
75
76     static const GInterfaceInfo atk_editable_text_info =
77     {
78         (GInterfaceInitFunc) NULL,
79         (GInterfaceFinalizeFunc) NULL,
80         NULL
81     };
82
83     static const GInterfaceInfo atk_image_info =
84     {
85         (GInterfaceInitFunc) NULL,
86         (GInterfaceFinalizeFunc) NULL,
87         NULL
88     };
89
90     static const GInterfaceInfo atk_selection_info =
91     {
92         (GInterfaceInitFunc) NULL,
93         (GInterfaceFinalizeFunc) NULL,
94         NULL
95     };
96
97     static const GInterfaceInfo atk_table_info =
98     {
99         (GInterfaceInitFunc) NULL,
100         (GInterfaceFinalizeFunc) NULL,
101         NULL
102     };
103
104     static const GInterfaceInfo atk_table_cell_info =
105     {
106         (GInterfaceInitFunc) NULL,
107         (GInterfaceFinalizeFunc) NULL,
108         NULL
109     };
110
111     static const GInterfaceInfo atk_text_info =
112     {
113         (GInterfaceInitFunc) NULL,
114         (GInterfaceFinalizeFunc) NULL,
115         NULL
116     };
117
118     static const GInterfaceInfo atk_hypertext_info =
119     {
120         (GInterfaceInitFunc) NULL,
121         (GInterfaceFinalizeFunc) NULL,
122         NULL
123     };
124
125     static const GInterfaceInfo atk_value_info =
126     {
127         (GInterfaceInitFunc) NULL,
128         (GInterfaceFinalizeFunc) NULL,
129         NULL
130     };
131
132     static const GInterfaceInfo atk_document_info =
133     {
134         (GInterfaceInitFunc) NULL,
135         (GInterfaceFinalizeFunc) NULL,
136         NULL
137     };
138
139     static const GInterfaceInfo atk_window_info =
140     {
141         (GInterfaceInitFunc) NULL,
142         (GInterfaceFinalizeFunc) NULL,
143         NULL
144     };
145
146     type = g_type_register_static (ATK_TYPE_OBJECT,
147                                     "AtkNoOpObject", &tinfo, 0);
148     g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
149                                  &atk_component_info);
150     g_type_add_interface_static (type, ATK_TYPE_ACTION,
151                                  &atk_action_info);
152     g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT,
153                                  &atk_editable_text_info);
154     g_type_add_interface_static (type, ATK_TYPE_IMAGE,
155                                  &atk_image_info);
156     g_type_add_interface_static (type, ATK_TYPE_SELECTION,
157                                  &atk_selection_info);
158     g_type_add_interface_static (type, ATK_TYPE_TABLE,
159                                  &atk_table_info);
160     g_type_add_interface_static (type, ATK_TYPE_TABLE_CELL,
161                                  &atk_table_cell_info);
162     g_type_add_interface_static (type, ATK_TYPE_TEXT,
163                                  &atk_text_info);
164     g_type_add_interface_static (type, ATK_TYPE_HYPERTEXT,
165                                  &atk_hypertext_info);
166     g_type_add_interface_static (type, ATK_TYPE_VALUE,
167                                  &atk_value_info);
168     g_type_add_interface_static (type, ATK_TYPE_DOCUMENT,
169                                  &atk_document_info);
170     g_type_add_interface_static (type, ATK_TYPE_WINDOW,
171                                  &atk_window_info);
172   }
173   return type;
174 }
175
176 static void
177 atk_no_op_object_class_init (AtkNoOpObjectClass *klass)
178 {
179   parent_class = g_type_class_peek_parent (klass);
180 }
181
182 /**
183  * atk_no_op_object_new:
184  * @obj: a #GObject
185  *
186  * Provides a default (non-functioning stub) #AtkObject.
187  * Application maintainers should not use this method. 
188  *
189  * Returns: a default (non-functioning stub) #AtkObject
190  **/
191 AtkObject*
192 atk_no_op_object_new (GObject *obj)
193 {
194   AtkObject *accessible;
195
196   g_return_val_if_fail (obj != NULL, NULL);
197
198   accessible = g_object_new (ATK_TYPE_NO_OP_OBJECT, NULL);
199   g_return_val_if_fail (accessible != NULL, NULL);
200
201   accessible->role = ATK_ROLE_INVALID;
202   accessible->layer = ATK_LAYER_INVALID;
203
204   return accessible;
205 }
206