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.
26 * @Short_description: The ATK Interface implemented by components
27 * which expose image or pixmap content on-screen.
30 * #AtkImage should be implemented by #AtkObject subtypes on behalf of
31 * components which display image/pixmap information onscreen, and
32 * which provide information (other than just widget borders, etc.)
33 * via that image content. For instance, icons, buttons with icons,
34 * toolbar elements, and image viewing panes typically should
35 * implement #AtkImage.
37 * #AtkImage primarily provides two types of information: coordinate
38 * information (useful for screen review mode of screenreaders, and
39 * for use by onscreen magnifiers), and descriptive information. The
40 * descriptive information is provided for alternative, text-only
41 * presentation of the most significant information present in the
46 atk_image_get_type (void)
48 static GType type
= 0;
51 static const GTypeInfo tinfo
=
53 sizeof (AtkImageIface
),
55 (GBaseFinalizeFunc
) NULL
58 type
= g_type_register_static (G_TYPE_INTERFACE
, "AtkImage", &tinfo
, 0);
65 * atk_image_get_image_description:
66 * @image: a #GObject instance that implements AtkImageIface
68 * Get a textual description of this image.
70 * Returns: a string representing the image description
73 atk_image_get_image_description (AtkImage
*image
)
77 g_return_val_if_fail (ATK_IS_IMAGE (image
), NULL
);
79 iface
= ATK_IMAGE_GET_IFACE (image
);
81 if (iface
->get_image_description
)
83 return (iface
->get_image_description
) (image
);
92 * atk_image_get_image_size:
93 * @image: a #GObject instance that implements AtkImageIface
94 * @width: filled with the image width, or -1 if the value cannot be obtained.
95 * @height: filled with the image height, or -1 if the value cannot be obtained.
97 * Get the width and height in pixels for the specified image.
98 * The values of @width and @height are returned as -1 if the
99 * values cannot be obtained (for instance, if the object is not onscreen).
102 atk_image_get_image_size (AtkImage
*image
,
106 AtkImageIface
*iface
;
107 gint local_width
, local_height
;
108 gint
*real_width
, *real_height
;
110 g_return_if_fail (ATK_IS_IMAGE (image
));
115 real_width
= &local_width
;
117 real_height
= height
;
119 real_height
= &local_height
;
121 iface
= ATK_IMAGE_GET_IFACE (image
);
123 if (iface
->get_image_size
)
125 iface
->get_image_size (image
, real_width
, real_height
);
135 * atk_image_set_image_description:
136 * @image: a #GObject instance that implements AtkImageIface
137 * @description: a string description to set for @image
139 * Sets the textual description for this image.
141 * Returns: boolean TRUE, or FALSE if operation could
145 atk_image_set_image_description (AtkImage
*image
,
146 const gchar
*description
)
148 AtkImageIface
*iface
;
150 g_return_val_if_fail (ATK_IS_IMAGE (image
), FALSE
);
152 iface
= ATK_IMAGE_GET_IFACE (image
);
154 if (iface
->set_image_description
)
156 return (iface
->set_image_description
) (image
, description
);
165 * atk_image_get_image_position:
166 * @image: a #GObject instance that implements AtkImageIface
167 * @x: address of #gint to put x coordinate position; otherwise, -1 if value cannot be obtained.
168 * @y: address of #gint to put y coordinate position; otherwise, -1 if value cannot be obtained.
169 * @coord_type: specifies whether the coordinates are relative to the screen
170 * or to the components top level window
172 * Gets the position of the image in the form of a point specifying the
173 * images top-left corner.
176 atk_image_get_image_position (AtkImage
*image
,
179 AtkCoordType coord_type
)
181 AtkImageIface
*iface
;
182 gint local_x
, local_y
;
183 gint
*real_x
, *real_y
;
185 g_return_if_fail (ATK_IS_IMAGE (image
));
196 iface
= ATK_IMAGE_GET_IFACE (image
);
198 if (iface
->get_image_position
)
200 (iface
->get_image_position
) (image
, real_x
, real_y
, coord_type
);
210 * atk_image_get_image_locale:
211 * @image: An #AtkImage
215 * Returns: a string corresponding to the POSIX LC_MESSAGES locale
216 * used by the image description, or NULL if the image does not
221 atk_image_get_image_locale (AtkImage
*image
)
224 AtkImageIface
*iface
;
226 g_return_val_if_fail (ATK_IS_IMAGE (image
), NULL
);
228 iface
= ATK_IMAGE_GET_IFACE (image
);
230 if (iface
->get_image_locale
)
232 return (iface
->get_image_locale
) (image
);