1 /* ATK - Accessibility Toolkit
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.
24 * @Short_description: The ATK Interface implemented by components
25 * which expose image or pixmap content on-screen.
28 * #AtkImage should be implemented by #AtkObject subtypes on behalf of
29 * components which display image/pixmap information onscreen, and
30 * which provide information (other than just widget borders, etc.)
31 * via that image content. For instance, icons, buttons with icons,
32 * toolbar elements, and image viewing panes typically should
33 * implement #AtkImage.
35 * #AtkImage primarily provides two types of information: coordinate
36 * information (useful for screen review mode of screenreaders, and
37 * for use by onscreen magnifiers), and descriptive information. The
38 * descriptive information is provided for alternative, text-only
39 * presentation of the most significant information present in the
44 atk_image_get_type (void)
46 static GType type = 0;
49 static const GTypeInfo tinfo =
51 sizeof (AtkImageIface),
53 (GBaseFinalizeFunc) NULL
56 type = g_type_register_static (G_TYPE_INTERFACE, "AtkImage", &tinfo, 0);
63 * atk_image_get_image_description:
64 * @image: a #GObject instance that implements AtkImageIface
66 * Get a textual description of this image.
68 * Returns: a string representing the image description
71 atk_image_get_image_description (AtkImage *image)
75 g_return_val_if_fail (ATK_IS_IMAGE (image), NULL);
77 iface = ATK_IMAGE_GET_IFACE (image);
79 if (iface->get_image_description)
81 return (iface->get_image_description) (image);
90 * atk_image_get_image_size:
91 * @image: a #GObject instance that implements AtkImageIface
92 * @width: filled with the image width, or -1 if the value cannot be obtained.
93 * @height: filled with the image height, or -1 if the value cannot be obtained.
95 * Get the width and height in pixels for the specified image.
96 * The values of @width and @height are returned as -1 if the
97 * values cannot be obtained (for instance, if the object is not onscreen).
100 atk_image_get_image_size (AtkImage *image,
104 AtkImageIface *iface;
105 gint local_width, local_height;
106 gint *real_width, *real_height;
108 g_return_if_fail (ATK_IS_IMAGE (image));
113 real_width = &local_width;
115 real_height = height;
117 real_height = &local_height;
119 iface = ATK_IMAGE_GET_IFACE (image);
121 if (iface->get_image_size)
123 iface->get_image_size (image, real_width, real_height);
133 * atk_image_set_image_description:
134 * @image: a #GObject instance that implements AtkImageIface
135 * @description: a string description to set for @image
137 * Sets the textual description for this image.
139 * Returns: boolean TRUE, or FALSE if operation could
143 atk_image_set_image_description (AtkImage *image,
144 const gchar *description)
146 AtkImageIface *iface;
148 g_return_val_if_fail (ATK_IS_IMAGE (image), FALSE);
150 iface = ATK_IMAGE_GET_IFACE (image);
152 if (iface->set_image_description)
154 return (iface->set_image_description) (image, description);
163 * atk_image_get_image_position:
164 * @image: a #GObject instance that implements AtkImageIface
165 * @x: address of #gint to put x coordinate position; otherwise, -1 if value cannot be obtained.
166 * @y: address of #gint to put y coordinate position; otherwise, -1 if value cannot be obtained.
167 * @coord_type: specifies whether the coordinates are relative to the screen
168 * or to the components top level window
170 * Gets the position of the image in the form of a point specifying the
171 * images top-left corner.
174 atk_image_get_image_position (AtkImage *image,
177 AtkCoordType coord_type)
179 AtkImageIface *iface;
180 gint local_x, local_y;
181 gint *real_x, *real_y;
183 g_return_if_fail (ATK_IS_IMAGE (image));
194 iface = ATK_IMAGE_GET_IFACE (image);
196 if (iface->get_image_position)
198 (iface->get_image_position) (image, real_x, real_y, coord_type);
208 * atk_image_get_image_locale:
209 * @image: An #AtkImage
213 * Returns: a string corresponding to the POSIX LC_MESSAGES locale
214 * used by the image description, or NULL if the image does not
219 atk_image_get_image_locale (AtkImage *image)
222 AtkImageIface *iface;
224 g_return_val_if_fail (ATK_IS_IMAGE (image), NULL);
226 iface = ATK_IMAGE_GET_IFACE (image);
228 if (iface->get_image_locale)
230 return (iface->get_image_locale) (image);