Updated Hungarian translation
[evolution.git] / e-util / gal-a11y-factory.h
blob191a9e429600f5b9793212d1c5a52f3734ab034a
1 /*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU Lesser General Public License as published by
4 * the Free Software Foundation.
6 * This program is distributed in the hope that it will be useful, but
7 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9 * for more details.
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, see <http://www.gnu.org/licenses/>.
15 * Authors:
16 * Gilbert Fang <gilbert.fang@sun.com>
18 * This file is mainly from the gailfactory.h of GAIL.
20 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
24 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
25 #error "Only <e-util/e-util.h> should be included directly."
26 #endif
28 #ifndef _GAL_A11Y_FACTORY_H__
29 #define _GAL_A11Y_FACTORY_H__
31 #include <atk/atkobject.h>
32 #include <atk/atkobjectfactory.h>
34 #define GAL_A11Y_FACTORY(type, type_as_function, opt_create_accessible) \
36 static GType \
37 type_as_function ## _factory_get_accessible_type (void) \
38 { \
39 return type; \
40 } \
42 static AtkObject * \
43 type_as_function ## _factory_create_accessible (GObject *obj) \
44 { \
45 GtkWidget *widget; \
46 AtkObject *accessible; \
48 g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL); \
50 widget = GTK_WIDGET (obj); \
52 accessible = opt_create_accessible (widget); \
54 return accessible; \
55 } \
57 static void \
58 type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
59 { \
60 klass->create_accessible = type_as_function ## _factory_create_accessible; \
61 klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
62 } \
64 static GType \
65 type_as_function ## _factory_get_type (void) \
66 { \
67 static GType t = 0; \
69 if (!t) \
70 { \
71 gchar *name; \
72 static const GTypeInfo tinfo = \
73 { \
74 sizeof (AtkObjectFactoryClass), \
75 NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
76 NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
77 }; \
79 name = g_strconcat (g_type_name (type), "Factory", NULL); \
80 t = g_type_register_static ( \
81 ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
82 g_free (name); \
83 } \
85 return t; \
88 #endif /* _GAL_A11Y_FACTORY_H__ */