atkimplementor: use the G_DEFINE_INTERFACE macro to declare it as interface in the...
[atk.git] / atk / atknoopobjectfactory.c
blob501476b73865a6f4f140b885fb830a58340aaa75
1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
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.
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.
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.
20 #include "config.h"
22 #include "atkobject.h"
23 #include "atknoopobject.h"
24 #include "atknoopobjectfactory.h"
26 /**
27 * SECTION:atknoopobjectfactory
28 * @Short_description: The AtkObjectFactory which creates an AtkNoOpObject.
29 * @Title:AtkNoOpObjectFactory
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.
35 static void atk_no_op_object_factory_class_init (
36 AtkNoOpObjectFactoryClass *klass);
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);
42 static gpointer parent_class = NULL;
44 GType
45 atk_no_op_object_factory_get_type (void)
47 static GType type = 0;
49 if (!type)
51 static const GTypeInfo tinfo =
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 */
64 type = g_type_register_static (
65 ATK_TYPE_OBJECT_FACTORY,
66 "AtkNoOpObjectFactory" , &tinfo, 0);
69 return type;
72 static void
73 atk_no_op_object_factory_class_init (AtkNoOpObjectFactoryClass *klass)
75 AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass);
77 parent_class = g_type_class_peek_parent (klass);
79 class->create_accessible = atk_no_op_object_factory_create_accessible;
80 class->get_accessible_type = atk_no_op_object_factory_get_accessible_type;
83 /**
84 * atk_no_op_object_factory_new:
86 * Creates an instance of an #AtkObjectFactory which generates primitive
87 * (non-functioning) #AtkObjects.
89 * Returns: an instance of an #AtkObjectFactory
90 **/
91 AtkObjectFactory*
92 atk_no_op_object_factory_new (void)
94 GObject *factory;
96 factory = g_object_new (ATK_TYPE_NO_OP_OBJECT_FACTORY, NULL);
98 g_return_val_if_fail (factory != NULL, NULL);
99 return ATK_OBJECT_FACTORY (factory);
102 static AtkObject*
103 atk_no_op_object_factory_create_accessible (GObject *obj)
105 AtkObject *accessible;
107 accessible = atk_no_op_object_new (obj);
109 return accessible;
112 static GType
113 atk_no_op_object_factory_get_accessible_type (void)
115 return ATK_TYPE_NO_OP_OBJECT;