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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
23 #include "gtkimagecellaccessible.h"
25 static void atk_image_interface_init (AtkImageIface *iface);
27 G_DEFINE_TYPE_WITH_CODE (GtkImageCellAccessible, _gtk_image_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE,
28 G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
31 gtk_image_cell_accessible_finalize (GObject *object)
33 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (object);
35 g_free (image_cell->image_description);
36 G_OBJECT_CLASS (_gtk_image_cell_accessible_parent_class)->finalize (object);
40 _gtk_image_cell_accessible_class_init (GtkImageCellAccessibleClass *klass)
42 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
44 gobject_class->finalize = gtk_image_cell_accessible_finalize;
48 _gtk_image_cell_accessible_init (GtkImageCellAccessible *image_cell)
50 image_cell->image_description = NULL;
54 gtk_image_cell_accessible_get_image_description (AtkImage *image)
56 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
58 return image_cell->image_description;
62 gtk_image_cell_accessible_set_image_description (AtkImage *image,
63 const gchar *description)
65 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
67 g_free (image_cell->image_description);
68 image_cell->image_description = g_strdup (description);
70 if (image_cell->image_description)
77 gtk_image_cell_accessible_get_image_position (AtkImage *image,
80 AtkCoordType coord_type)
82 atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);
86 gtk_image_cell_accessible_get_image_size (AtkImage *image,
90 GtkImageCellAccessible *cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
91 GtkCellRenderer *cell_renderer;
92 GdkPixbuf *pixbuf = NULL;
97 cell_renderer = GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer;
98 g_object_get (GTK_CELL_RENDERER_PIXBUF (cell_renderer),
104 *width = gdk_pixbuf_get_width (pixbuf);
105 *height = gdk_pixbuf_get_height (pixbuf);
106 g_object_unref (pixbuf);
111 atk_image_interface_init (AtkImageIface *iface)
113 iface->get_image_description = gtk_image_cell_accessible_get_image_description;
114 iface->set_image_description = gtk_image_cell_accessible_set_image_description;
115 iface->get_image_position = gtk_image_cell_accessible_get_image_position;
116 iface->get_image_size = gtk_image_cell_accessible_get_image_size;