1 /* GAIL - The GNOME Accessibility Implementation Library
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.
21 #include "gailarrow.h"
23 static void gail_arrow_class_init (GailArrowClass *klass);
24 static void gail_arrow_init (GailArrow *arrow);
27 static void atk_image_interface_init (AtkImageIface *iface);
28 static G_CONST_RETURN gchar* gail_arrow_get_image_description
30 static gboolean gail_arrow_set_image_description
32 const gchar *description);
33 static void gail_arrow_finalize (GObject *object);
35 G_DEFINE_TYPE_WITH_CODE (GailArrow, gail_arrow, GAIL_TYPE_WIDGET,
36 G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
39 gail_arrow_class_init (GailArrowClass *klass)
41 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
43 gobject_class->finalize = gail_arrow_finalize;
47 gail_arrow_init (GailArrow *arrow)
49 arrow->image_description = NULL;
53 gail_arrow_new (GtkWidget *widget)
56 AtkObject *accessible;
58 g_return_val_if_fail (GTK_IS_ARROW (widget), NULL);
60 object = g_object_new (GAIL_TYPE_ARROW, NULL);
62 accessible = ATK_OBJECT (object);
63 atk_object_initialize (accessible, widget);
64 accessible->role = ATK_ROLE_ICON;
70 atk_image_interface_init (AtkImageIface *iface)
72 iface->get_image_description = gail_arrow_get_image_description;
73 iface->set_image_description = gail_arrow_set_image_description;
76 static G_CONST_RETURN gchar*
77 gail_arrow_get_image_description (AtkImage *obj)
81 g_return_val_if_fail(GAIL_IS_ARROW(obj), NULL);
83 arrow = GAIL_ARROW (obj);
85 return arrow->image_description;
89 gail_arrow_set_image_description (AtkImage *obj,
90 const gchar *description)
94 g_return_val_if_fail(GAIL_IS_ARROW(obj), FALSE);
96 arrow = GAIL_ARROW (obj);
97 g_free (arrow->image_description);
99 arrow->image_description = g_strdup (description);
107 * gail_arrow_get_image_size (AtkImage *obj,
111 * We dont implement this function for GailArrow as gtk hardcodes the size
112 * of the arrow to be 7x5 and it is not possible to query this.
116 gail_arrow_finalize (GObject *object)
118 GailArrow *arrow = GAIL_ARROW (object);
120 g_free (arrow->image_description);
121 G_OBJECT_CLASS (gail_arrow_parent_class)->finalize (object);