1 /* GAIL - The GNOME Accessibility Enabling 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, see <http://www.gnu.org/licenses/>.
21 #include "gtkimagecellaccessible.h"
23 static void atk_image_interface_init (AtkImageIface *iface);
25 G_DEFINE_TYPE_WITH_CODE (GtkImageCellAccessible, _gtk_image_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE,
26 G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
29 gtk_image_cell_accessible_finalize (GObject *object)
31 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (object);
33 g_free (image_cell->image_description);
34 G_OBJECT_CLASS (_gtk_image_cell_accessible_parent_class)->finalize (object);
38 _gtk_image_cell_accessible_class_init (GtkImageCellAccessibleClass *klass)
40 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
42 gobject_class->finalize = gtk_image_cell_accessible_finalize;
46 _gtk_image_cell_accessible_init (GtkImageCellAccessible *image_cell)
48 image_cell->image_description = NULL;
52 gtk_image_cell_accessible_get_image_description (AtkImage *image)
54 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
56 return image_cell->image_description;
60 gtk_image_cell_accessible_set_image_description (AtkImage *image,
61 const gchar *description)
63 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
65 g_free (image_cell->image_description);
66 image_cell->image_description = g_strdup (description);
68 if (image_cell->image_description)
75 gtk_image_cell_accessible_get_image_position (AtkImage *image,
78 AtkCoordType coord_type)
80 atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);
84 gtk_image_cell_accessible_get_image_size (AtkImage *image,
88 GtkImageCellAccessible *cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
89 GtkCellRenderer *cell_renderer;
90 GdkPixbuf *pixbuf = NULL;
95 cell_renderer = GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer;
96 g_object_get (GTK_CELL_RENDERER_PIXBUF (cell_renderer),
102 *width = gdk_pixbuf_get_width (pixbuf);
103 *height = gdk_pixbuf_get_height (pixbuf);
104 g_object_unref (pixbuf);
109 atk_image_interface_init (AtkImageIface *iface)
111 iface->get_image_description = gtk_image_cell_accessible_get_image_description;
112 iface->set_image_description = gtk_image_cell_accessible_set_image_description;
113 iface->get_image_position = gtk_image_cell_accessible_get_image_position;
114 iface->get_image_size = gtk_image_cell_accessible_get_image_size;