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.
23 #include "gailarrow.h"
25 static void gail_arrow_class_init (GailArrowClass *klass);
26 static void gail_arrow_init (GailArrow *arrow);
27 static void gail_arrow_initialize (AtkObject *accessible,
31 static void atk_image_interface_init (AtkImageIface *iface);
32 static const gchar* gail_arrow_get_image_description
34 static gboolean gail_arrow_set_image_description
36 const gchar *description);
37 static void gail_arrow_finalize (GObject *object);
39 G_DEFINE_TYPE_WITH_CODE (GailArrow, gail_arrow, GAIL_TYPE_WIDGET,
40 G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
43 gail_arrow_class_init (GailArrowClass *klass)
45 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
46 AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
48 atk_object_class->initialize = gail_arrow_initialize;
50 gobject_class->finalize = gail_arrow_finalize;
54 gail_arrow_init (GailArrow *arrow)
56 arrow->image_description = NULL;
60 gail_arrow_initialize (AtkObject *accessible,
63 ATK_OBJECT_CLASS (gail_arrow_parent_class)->initialize (accessible, data);
65 accessible->role = ATK_ROLE_ICON;
69 atk_image_interface_init (AtkImageIface *iface)
71 iface->get_image_description = gail_arrow_get_image_description;
72 iface->set_image_description = gail_arrow_set_image_description;
76 gail_arrow_get_image_description (AtkImage *obj)
80 g_return_val_if_fail(GAIL_IS_ARROW(obj), NULL);
82 arrow = GAIL_ARROW (obj);
84 return arrow->image_description;
88 gail_arrow_set_image_description (AtkImage *obj,
89 const gchar *description)
93 g_return_val_if_fail(GAIL_IS_ARROW(obj), FALSE);
95 arrow = GAIL_ARROW (obj);
96 g_free (arrow->image_description);
98 arrow->image_description = g_strdup (description);
106 * gail_arrow_get_image_size (AtkImage *obj,
110 * We dont implement this function for GailArrow as gtk hardcodes the size
111 * of the arrow to be 7x5 and it is not possible to query this.
115 gail_arrow_finalize (GObject *object)
117 GailArrow *arrow = GAIL_ARROW (object);
119 g_free (arrow->image_description);
120 G_OBJECT_CLASS (gail_arrow_parent_class)->finalize (object);