Revert "Merge remote-tracking branch 'origin/sandbox/mniesluchow/upstream_2_16' into...
[platform/upstream/atk.git] / atk / atknoopobjectfactory.c
1 /* ATK - Accessibility Toolkit
2  * Copyright 2001 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 "atkobject.h"
21 #include "atknoopobject.h"
22 #include "atknoopobjectfactory.h"
23
24 /**
25  * SECTION:atknoopobjectfactory
26  * @Short_description: The AtkObjectFactory which creates an AtkNoOpObject.
27  * @Title:AtkNoOpObjectFactory
28  *
29  * The AtkObjectFactory which creates an AtkNoOpObject. An instance of
30  * this is created by an AtkRegistry if no factory type has not been
31  * specified to create an accessible object of a particular type.
32  */
33 static void atk_no_op_object_factory_class_init (
34                               AtkNoOpObjectFactoryClass        *klass);
35
36 static AtkObject* atk_no_op_object_factory_create_accessible (
37                               GObject                          *obj);
38 static GType      atk_no_op_object_factory_get_accessible_type (void);
39
40 static gpointer    parent_class = NULL;
41
42 GType
43 atk_no_op_object_factory_get_type (void)
44 {
45   static GType type = 0;
46
47   if (!type) 
48   {
49     static const GTypeInfo tinfo =
50     {
51       sizeof (AtkNoOpObjectFactoryClass),
52       (GBaseInitFunc) NULL, /* base init */
53       (GBaseFinalizeFunc) NULL, /* base finalize */
54       (GClassInitFunc) atk_no_op_object_factory_class_init, /* class init */
55       (GClassFinalizeFunc) NULL, /* class finalize */
56       NULL, /* class data */
57       sizeof (AtkNoOpObjectFactory), /* instance size */
58       0, /* nb preallocs */
59       (GInstanceInitFunc) NULL, /* instance init */
60       NULL /* value table */
61     };
62     type = g_type_register_static (
63                            ATK_TYPE_OBJECT_FACTORY, 
64                            "AtkNoOpObjectFactory" , &tinfo, 0);
65   }
66
67   return type;
68 }
69
70 static void 
71 atk_no_op_object_factory_class_init (AtkNoOpObjectFactoryClass *klass)
72 {
73   AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass);
74
75   parent_class = g_type_class_peek_parent (klass);
76
77   class->create_accessible = atk_no_op_object_factory_create_accessible;
78   class->get_accessible_type = atk_no_op_object_factory_get_accessible_type;
79 }
80
81 /**
82  * atk_no_op_object_factory_new:
83  *
84  * Creates an instance of an #AtkObjectFactory which generates primitive
85  * (non-functioning) #AtkObjects. 
86  *
87  * Returns: an instance of an #AtkObjectFactory
88  **/
89 AtkObjectFactory* 
90 atk_no_op_object_factory_new (void)
91 {
92   GObject *factory;
93
94   factory = g_object_new (ATK_TYPE_NO_OP_OBJECT_FACTORY, NULL);
95
96   g_return_val_if_fail (factory != NULL, NULL);
97   return ATK_OBJECT_FACTORY (factory);
98
99
100 static AtkObject* 
101 atk_no_op_object_factory_create_accessible (GObject   *obj)
102 {
103   AtkObject     *accessible;
104
105   accessible = atk_no_op_object_new (obj);
106
107   return accessible;
108 }
109
110 static GType
111 atk_no_op_object_factory_get_accessible_type (void)
112 {
113   return ATK_TYPE_NO_OP_OBJECT;
114 }