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
 * AtkNoOpObject:
27
 *
28
 * An AtkObject which purports to implement all ATK interfaces.
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
static void atk_no_op_object_class_init (AtkNoOpObjectClass *klass);
38

            
39
static gpointer parent_class = NULL;
40

            
41
GType
42
161
atk_no_op_object_get_type (void)
43
{
44
  static GType type = 0;
45

            
46
161
  if (!type)
47
    {
48
      static const GTypeInfo tinfo = {
49
        sizeof (AtkObjectClass),
50
        (GBaseInitFunc) NULL,                         /* base init */
51
        (GBaseFinalizeFunc) NULL,                     /* base finalize */
52
        (GClassInitFunc) atk_no_op_object_class_init, /* class init */
53
        (GClassFinalizeFunc) NULL,                    /* class finalize */
54
        NULL,                                         /* class data */
55
        sizeof (AtkNoOpObject),                       /* instance size */
56
        0,                                            /* nb preallocs */
57
        (GInstanceInitFunc) NULL,                     /* instance init */
58
        NULL                                          /* value table */
59
      };
60

            
61
      static const GInterfaceInfo atk_component_info = {
62
        (GInterfaceInitFunc) NULL,
63
        (GInterfaceFinalizeFunc) NULL,
64
        NULL
65
      };
66

            
67
      static const GInterfaceInfo atk_action_info = {
68
        (GInterfaceInitFunc) NULL,
69
        (GInterfaceFinalizeFunc) NULL,
70
        NULL
71
      };
72

            
73
      static const GInterfaceInfo atk_editable_text_info = {
74
        (GInterfaceInitFunc) NULL,
75
        (GInterfaceFinalizeFunc) NULL,
76
        NULL
77
      };
78

            
79
      static const GInterfaceInfo atk_image_info = {
80
        (GInterfaceInitFunc) NULL,
81
        (GInterfaceFinalizeFunc) NULL,
82
        NULL
83
      };
84

            
85
      static const GInterfaceInfo atk_selection_info = {
86
        (GInterfaceInitFunc) NULL,
87
        (GInterfaceFinalizeFunc) NULL,
88
        NULL
89
      };
90

            
91
      static const GInterfaceInfo atk_table_info = {
92
        (GInterfaceInitFunc) NULL,
93
        (GInterfaceFinalizeFunc) NULL,
94
        NULL
95
      };
96

            
97
      static const GInterfaceInfo atk_table_cell_info = {
98
        (GInterfaceInitFunc) NULL,
99
        (GInterfaceFinalizeFunc) NULL,
100
        NULL
101
      };
102

            
103
      static const GInterfaceInfo atk_text_info = {
104
        (GInterfaceInitFunc) NULL,
105
        (GInterfaceFinalizeFunc) NULL,
106
        NULL
107
      };
108

            
109
      static const GInterfaceInfo atk_hypertext_info = {
110
        (GInterfaceInitFunc) NULL,
111
        (GInterfaceFinalizeFunc) NULL,
112
        NULL
113
      };
114

            
115
      static const GInterfaceInfo atk_value_info = {
116
        (GInterfaceInitFunc) NULL,
117
        (GInterfaceFinalizeFunc) NULL,
118
        NULL
119
      };
120

            
121
      static const GInterfaceInfo atk_document_info = {
122
        (GInterfaceInitFunc) NULL,
123
        (GInterfaceFinalizeFunc) NULL,
124
        NULL
125
      };
126

            
127
      static const GInterfaceInfo atk_window_info = {
128
        (GInterfaceInitFunc) NULL,
129
        (GInterfaceFinalizeFunc) NULL,
130
        NULL
131
      };
132

            
133
161
      type = g_type_register_static (ATK_TYPE_OBJECT,
134
                                     "AtkNoOpObject", &tinfo, 0);
135
161
      g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
136
                                   &atk_component_info);
137
161
      g_type_add_interface_static (type, ATK_TYPE_ACTION,
138
                                   &atk_action_info);
139
161
      g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT,
140
                                   &atk_editable_text_info);
141
161
      g_type_add_interface_static (type, ATK_TYPE_IMAGE,
142
                                   &atk_image_info);
143
161
      g_type_add_interface_static (type, ATK_TYPE_SELECTION,
144
                                   &atk_selection_info);
145
161
      g_type_add_interface_static (type, ATK_TYPE_TABLE,
146
                                   &atk_table_info);
147
161
      g_type_add_interface_static (type, ATK_TYPE_TABLE_CELL,
148
                                   &atk_table_cell_info);
149
161
      g_type_add_interface_static (type, ATK_TYPE_TEXT,
150
                                   &atk_text_info);
151
161
      g_type_add_interface_static (type, ATK_TYPE_HYPERTEXT,
152
                                   &atk_hypertext_info);
153
161
      g_type_add_interface_static (type, ATK_TYPE_VALUE,
154
                                   &atk_value_info);
155
161
      g_type_add_interface_static (type, ATK_TYPE_DOCUMENT,
156
                                   &atk_document_info);
157
161
      g_type_add_interface_static (type, ATK_TYPE_WINDOW,
158
                                   &atk_window_info);
159
    }
160
161
  return type;
161
}
162

            
163
static void
164
161
atk_no_op_object_class_init (AtkNoOpObjectClass *klass)
165
{
166
161
  parent_class = g_type_class_peek_parent (klass);
167
161
}
168

            
169
/**
170
 * atk_no_op_object_new:
171
 * @obj: a #GObject
172
 *
173
 * Provides a default (non-functioning stub) #AtkObject.
174
 * Application maintainers should not use this method.
175
 *
176
 * Returns: a default (non-functioning stub) #AtkObject
177
 **/
178
AtkObject *
179
161
atk_no_op_object_new (GObject *obj)
180
{
181
  AtkObject *accessible;
182

            
183
161
  g_return_val_if_fail (obj != NULL, NULL);
184

            
185
161
  accessible = g_object_new (ATK_TYPE_NO_OP_OBJECT, NULL);
186
161
  g_return_val_if_fail (accessible != NULL, NULL);
187

            
188
161
  accessible->role = ATK_ROLE_INVALID;
189
161
  accessible->layer = ATK_LAYER_INVALID;
190

            
191
161
  return accessible;
192
}