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 gchar *property_list[] = {
30 static void atk_image_interface_init (AtkImageIface *iface);
32 G_DEFINE_TYPE_WITH_CODE (GtkImageCellAccessible, _gtk_image_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE,
33 G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
36 gtk_image_cell_accessible_finalize (GObject *object)
38 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (object);
40 g_free (image_cell->image_description);
41 G_OBJECT_CLASS (_gtk_image_cell_accessible_parent_class)->finalize (object);
45 gtk_image_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
46 gboolean emit_change_signal)
52 _gtk_image_cell_accessible_class_init (GtkImageCellAccessibleClass *klass)
54 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
55 GtkRendererCellAccessibleClass *renderer_cell_class = GTK_RENDERER_CELL_ACCESSIBLE_CLASS (klass);
57 gobject_class->finalize = gtk_image_cell_accessible_finalize;
59 renderer_cell_class->update_cache = gtk_image_cell_accessible_update_cache;
60 renderer_cell_class->property_list = property_list;
64 _gtk_image_cell_accessible_init (GtkImageCellAccessible *image_cell)
66 image_cell->image_description = NULL;
70 gtk_image_cell_accessible_get_image_description (AtkImage *image)
72 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
74 return image_cell->image_description;
78 gtk_image_cell_accessible_set_image_description (AtkImage *image,
79 const gchar *description)
81 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
83 g_free (image_cell->image_description);
84 image_cell->image_description = g_strdup (description);
86 if (image_cell->image_description)
93 gtk_image_cell_accessible_get_image_position (AtkImage *image,
96 AtkCoordType coord_type)
98 atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);
102 gtk_image_cell_accessible_get_image_size (AtkImage *image,
106 GtkImageCellAccessible *cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
107 GtkCellRenderer *cell_renderer;
108 GdkPixbuf *pixbuf = NULL;
113 cell_renderer = GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer;
114 g_object_get (GTK_CELL_RENDERER_PIXBUF (cell_renderer),
120 *width = gdk_pixbuf_get_width (pixbuf);
121 *height = gdk_pixbuf_get_height (pixbuf);
122 g_object_unref (pixbuf);
127 atk_image_interface_init (AtkImageIface *iface)
129 iface->get_image_description = gtk_image_cell_accessible_get_image_description;
130 iface->set_image_description = gtk_image_cell_accessible_set_image_description;
131 iface->get_image_position = gtk_image_cell_accessible_get_image_position;
132 iface->get_image_size = gtk_image_cell_accessible_get_image_size;