Updated Traditional Chinese translation.
[evolution.git] / a11y / gal-a11y-factory.h
blob22da85eca8961265570929142c0a74836539c597
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* GAL A11Y
3 * gal-a11y-factory.h
5 * Copyright 2003 Ximian Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
22 * Authors:
23 * Gilbert Fang <gilbert.fang@sun.com>, Sun Microsystem Inc. 2003.
25 * This file is mainly from the gailfactory.h of GAIL.
28 #ifndef _GAL_A11Y_FACTORY_H__
29 #define _GAL_A11Y_FACTORY_H__
31 #include <glib-object.h>
32 #include <atk/atkobject.h>
33 #include <atk/atkobjectfactory.h>
35 #define GAL_A11Y_FACTORY(type, type_as_function, opt_create_accessible) \
37 static GType \
38 type_as_function ## _factory_get_accessible_type (void) \
39 { \
40 return type; \
41 } \
43 static AtkObject* \
44 type_as_function ## _factory_create_accessible (GObject *obj) \
45 { \
46 GtkWidget *widget; \
47 AtkObject *accessible; \
49 g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL); \
51 widget = GTK_WIDGET (obj); \
53 accessible = opt_create_accessible (widget); \
55 return accessible; \
56 } \
58 static void \
59 type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
60 { \
61 klass->create_accessible = type_as_function ## _factory_create_accessible; \
62 klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
63 } \
65 static GType \
66 type_as_function ## _factory_get_type (void) \
67 { \
68 static GType t = 0; \
70 if (!t) \
71 { \
72 char *name; \
73 static const GTypeInfo tinfo = \
74 { \
75 sizeof (AtkObjectFactoryClass), \
76 NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
77 NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
78 }; \
80 name = g_strconcat (g_type_name (type), "Factory", NULL); \
81 t = g_type_register_static ( \
82 ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
83 g_free (name); \
84 } \
86 return t; \
89 #define GAL_A11Y_WIDGET_SET_FACTORY(widget_type, type_as_function) \
90 atk_registry_set_factory_type (atk_get_default_registry (), \
91 widget_type, \
92 type_as_function ## _factory_get_type ())
94 #endif /* _GAL_A11Y_FACTORY_H__ */