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