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, see <http://www.gnu.org/licenses/>.
22 * @Short_description: The ATK Interface implemented by components
23 * which expose image or pixmap content on-screen.
26 * #AtkImage should be implemented by #AtkObject subtypes on behalf of
27 * components which display image/pixmap information onscreen, and
28 * which provide information (other than just widget borders, etc.)
29 * via that image content. For instance, icons, buttons with icons,
30 * toolbar elements, and image viewing panes typically should
31 * implement #AtkImage.
33 * #AtkImage primarily provides two types of information: coordinate
34 * information (useful for screen review mode of screenreaders, and
35 * for use by onscreen magnifiers), and descriptive information. The
36 * descriptive information is provided for alternative, text-only
37 * presentation of the most significant information present in the
42 atk_image_get_type (void)
44 static GType type = 0;
47 static const GTypeInfo tinfo =
49 sizeof (AtkImageIface),
51 (GBaseFinalizeFunc) NULL
54 type = g_type_register_static (G_TYPE_INTERFACE, "AtkImage", &tinfo, 0);
61 * atk_image_get_image_description:
62 * @image: a #GObject instance that implements AtkImageIface
64 * Get a textual description of this image.
66 * Returns: a string representing the image description
69 atk_image_get_image_description (AtkImage *image)
73 g_return_val_if_fail (ATK_IS_IMAGE (image), NULL);
75 iface = ATK_IMAGE_GET_IFACE (image);
77 if (iface->get_image_description)
79 return (iface->get_image_description) (image);
88 * atk_image_get_image_size:
89 * @image: a #GObject instance that implements AtkImageIface
90 * @width: filled with the image width, or -1 if the value cannot be obtained.
91 * @height: filled with the image height, or -1 if the value cannot be obtained.
93 * Get the width and height in pixels for the specified image.
94 * The values of @width and @height are returned as -1 if the
95 * values cannot be obtained (for instance, if the object is not onscreen).
98 atk_image_get_image_size (AtkImage *image,
102 AtkImageIface *iface;
103 gint local_width, local_height;
104 gint *real_width, *real_height;
106 g_return_if_fail (ATK_IS_IMAGE (image));
111 real_width = &local_width;
113 real_height = height;
115 real_height = &local_height;
117 iface = ATK_IMAGE_GET_IFACE (image);
119 if (iface->get_image_size)
121 iface->get_image_size (image, real_width, real_height);
131 * atk_image_set_image_description:
132 * @image: a #GObject instance that implements AtkImageIface
133 * @description: a string description to set for @image
135 * Sets the textual description for this image.
137 * Returns: boolean TRUE, or FALSE if operation could
141 atk_image_set_image_description (AtkImage *image,
142 const gchar *description)
144 AtkImageIface *iface;
146 g_return_val_if_fail (ATK_IS_IMAGE (image), FALSE);
148 iface = ATK_IMAGE_GET_IFACE (image);
150 if (iface->set_image_description)
152 return (iface->set_image_description) (image, description);
161 * atk_image_get_image_position:
162 * @image: a #GObject instance that implements AtkImageIface
163 * @x: address of #gint to put x coordinate position; otherwise, -1 if value cannot be obtained.
164 * @y: address of #gint to put y coordinate position; otherwise, -1 if value cannot be obtained.
165 * @coord_type: specifies whether the coordinates are relative to the screen
166 * or to the components top level window
168 * Gets the position of the image in the form of a point specifying the
169 * images top-left corner.
172 atk_image_get_image_position (AtkImage *image,
175 AtkCoordType coord_type)
177 AtkImageIface *iface;
178 gint local_x, local_y;
179 gint *real_x, *real_y;
181 g_return_if_fail (ATK_IS_IMAGE (image));
192 iface = ATK_IMAGE_GET_IFACE (image);
194 if (iface->get_image_position)
196 (iface->get_image_position) (image, real_x, real_y, coord_type);
206 * atk_image_get_image_locale:
207 * @image: An #AtkImage
211 * Returns: a string corresponding to the POSIX LC_MESSAGES locale
212 * used by the image description, or NULL if the image does not
217 atk_image_get_image_locale (AtkImage *image)
220 AtkImageIface *iface;
222 g_return_val_if_fail (ATK_IS_IMAGE (image), NULL);
224 iface = ATK_IMAGE_GET_IFACE (image);
226 if (iface->get_image_locale)
228 return (iface->get_image_locale) (image);