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 "atkobjectfactory.h"
21 #include "atknoopobjectfactory.h"
23 static void atk_object_factory_class_init (AtkObjectFactoryClass *klass);
25 static gpointer parent_class = NULL;
28 atk_object_factory_get_type (void)
30 static GType type = 0;
35 sizeof (AtkObjectFactoryClass),
36 (GBaseInitFunc) NULL, /* base init */
37 (GBaseFinalizeFunc) NULL, /* base finalize */
38 (GClassInitFunc) atk_object_factory_class_init, /* class init */
39 (GClassFinalizeFunc) NULL, /* class finalize */
40 NULL, /* class data */
41 sizeof (AtkObjectFactory), /* instance size */
43 (GInstanceInitFunc) NULL, /* instance init */
44 NULL /* value table */
47 type = g_type_register_static (G_TYPE_OBJECT, "AtkObjectFactory", &tinfo, 0);
53 atk_object_factory_class_init (AtkObjectFactoryClass *klass)
55 parent_class = g_type_class_peek_parent (klass);
60 * atk_object_factory_create_accessible:
61 * @factory: The #AtkObjectFactory associated with @obj's
65 * Provides an #AtkObject that implements an accessibility interface
68 * Returns: an #AtkObject that implements an accessibility interface
72 atk_object_factory_create_accessible (AtkObjectFactory *factory,
75 AtkObjectFactoryClass *klass;
76 AtkObject *accessible = NULL;
78 g_return_val_if_fail (ATK_IS_OBJECT_FACTORY (factory), NULL);
79 g_return_val_if_fail (G_IS_OBJECT (obj), NULL);
81 klass = ATK_OBJECT_FACTORY_GET_CLASS (factory);
83 if (klass->create_accessible)
85 accessible = klass->create_accessible (obj);
91 * atk_object_factory_invalidate:
92 * @factory: an #AtkObjectFactory to invalidate
94 * Inform @factory that it is no longer being used to create
95 * accessibles. When called, @factory may need to inform
96 * #AtkObjects which it has created that they need to be re-instantiated.
97 * Note: primarily used for runtime replacement of #AtkObjectFactorys
98 * in object registries.
101 atk_object_factory_invalidate (AtkObjectFactory *factory)
103 AtkObjectFactoryClass *klass;
105 g_return_if_fail (ATK_OBJECT_FACTORY (factory));
107 klass = ATK_OBJECT_FACTORY_GET_CLASS (factory);
108 if (klass->invalidate)
109 (klass->invalidate) (factory);
113 * atk_object_factory_get_accessible_type:
114 * @factory: an #AtkObjectFactory
116 * Gets the GType of the accessible which is created by the factory.
117 * Returns: the type of the accessible which is created by the @factory.
118 * The value G_TYPE_INVALID is returned if no type if found.
121 atk_object_factory_get_accessible_type (AtkObjectFactory *factory)
123 AtkObjectFactoryClass *klass;
125 g_return_val_if_fail (ATK_OBJECT_FACTORY (factory), G_TYPE_INVALID);
127 klass = ATK_OBJECT_FACTORY_GET_CLASS (factory);
128 if (klass->get_accessible_type)
129 return (klass->get_accessible_type) ();
131 return G_TYPE_INVALID;