1 /* GTK+ - accessibility implementations
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 struct _GtkImageCellAccessiblePrivate
25 gchar *image_description;
28 static void atk_image_interface_init (AtkImageIface *iface);
30 G_DEFINE_TYPE_WITH_CODE (GtkImageCellAccessible, gtk_image_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE,
31 G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
34 gtk_image_cell_accessible_finalize (GObject *object)
36 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (object);
38 g_free (image_cell->priv->image_description);
39 G_OBJECT_CLASS (gtk_image_cell_accessible_parent_class)->finalize (object);
43 gtk_image_cell_accessible_class_init (GtkImageCellAccessibleClass *klass)
45 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
47 gobject_class->finalize = gtk_image_cell_accessible_finalize;
49 g_type_class_add_private (klass, sizeof (GtkImageCellAccessiblePrivate));
53 gtk_image_cell_accessible_init (GtkImageCellAccessible *image_cell)
55 image_cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (image_cell,
56 GTK_TYPE_IMAGE_CELL_ACCESSIBLE,
57 GtkImageCellAccessiblePrivate);
61 gtk_image_cell_accessible_get_image_description (AtkImage *image)
63 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
65 return image_cell->priv->image_description;
69 gtk_image_cell_accessible_set_image_description (AtkImage *image,
70 const gchar *description)
72 GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
74 g_free (image_cell->priv->image_description);
75 image_cell->priv->image_description = g_strdup (description);
77 if (image_cell->priv->image_description)
84 gtk_image_cell_accessible_get_image_position (AtkImage *image,
87 AtkCoordType coord_type)
89 atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);
93 gtk_image_cell_accessible_get_image_size (AtkImage *image,
97 GtkImageCellAccessible *cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
98 GtkCellRenderer *cell_renderer;
99 GdkPixbuf *pixbuf = NULL;
104 g_object_get (cell, "renderer", &cell_renderer, NULL);
105 g_object_get (cell_renderer,
108 g_object_unref (cell_renderer);
112 *width = gdk_pixbuf_get_width (pixbuf);
113 *height = gdk_pixbuf_get_height (pixbuf);
114 g_object_unref (pixbuf);
119 atk_image_interface_init (AtkImageIface *iface)
121 iface->get_image_description = gtk_image_cell_accessible_get_image_description;
122 iface->set_image_description = gtk_image_cell_accessible_set_image_description;
123 iface->get_image_position = gtk_image_cell_accessible_get_image_position;
124 iface->get_image_size = gtk_image_cell_accessible_get_image_size;