]> Pileus Git - ~andy/gtk/blob - gtk/a11y/gtkarrowaccessible.c
cd97adf0917d4d6a3128a2c73aac22ba44463cd2
[~andy/gtk] / gtk / a11y / gtkarrowaccessible.c
1 /* GAIL - The GNOME Accessibility Implementation Library
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 <gtk/gtk.h>
23 #include "gtkarrowaccessible.h"
24
25
26 static void atk_image_interface_init (AtkImageIface  *iface);
27
28 G_DEFINE_TYPE_WITH_CODE (GtkArrowAccessible, _gtk_arrow_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
29                          G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
30
31 static void
32 gtk_arrow_accessible_initialize (AtkObject *accessible,
33                                  gpointer   data)
34 {
35   ATK_OBJECT_CLASS (_gtk_arrow_accessible_parent_class)->initialize (accessible, data);
36
37   accessible->role = ATK_ROLE_ICON;
38 }
39
40 static void
41 gtk_arrow_accessible_finalize (GObject *object)
42 {
43   GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (object);
44
45   g_free (arrow->image_description);
46
47   G_OBJECT_CLASS (_gtk_arrow_accessible_parent_class)->finalize (object);
48 }
49
50 static void
51 _gtk_arrow_accessible_class_init (GtkArrowAccessibleClass *klass)
52 {
53   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
54   AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
55
56   atk_object_class->initialize = gtk_arrow_accessible_initialize;
57
58   gobject_class->finalize = gtk_arrow_accessible_finalize;
59 }
60
61 static void
62 _gtk_arrow_accessible_init (GtkArrowAccessible *arrow)
63 {
64   arrow->image_description = NULL;
65 }
66
67 static const gchar *
68 gtk_arrow_accessible_get_image_description (AtkImage *obj)
69 {
70   GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
71
72   return arrow->image_description;
73 }
74
75 static gboolean
76 gtk_arrow_accessible_set_image_description (AtkImage    *obj,
77                                             const gchar *description)
78 {
79   GtkArrowAccessible *arrow = GTK_ARROW_ACCESSIBLE (obj);
80
81   g_free (arrow->image_description);
82   arrow->image_description = g_strdup (description);
83
84   return TRUE;
85
86 }
87
88 static void
89 atk_image_interface_init (AtkImageIface *iface)
90 {
91   iface->get_image_description = gtk_arrow_accessible_get_image_description;
92   iface->set_image_description = gtk_arrow_accessible_set_image_description;
93 }