X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=atk%2Fatkimage.c;h=3a00886496af3747542bdf0278c4ff911c8b99e4;hb=480f1fd937ae50a869555778c0ccb709c3a8590b;hp=9cc76752ba44ac72631cd93ba80f2b2d58d9d19c;hpb=1e52e12f06d2b3539102b9b954755ebf7fab3769;p=platform%2Fupstream%2Fatk.git diff --git a/atk/atkimage.c b/atk/atkimage.c old mode 100755 new mode 100644 index 9cc7675..3a00886 --- a/atk/atkimage.c +++ b/atk/atkimage.c @@ -17,10 +17,33 @@ * Boston, MA 02111-1307, USA. */ +#include "config.h" + #include "atkimage.h" +/** + * SECTION:atkimage + * @Short_description: The ATK Interface implemented by components + * which expose image or pixmap content on-screen. + * @Title:AtkImage + * + * #AtkImage should be implemented by #AtkObject subtypes on behalf of + * components which display image/pixmap information onscreen, and + * which provide information (other than just widget borders, etc.) + * via that image content. For instance, icons, buttons with icons, + * toolbar elements, and image viewing panes typically should + * implement #AtkImage. + * + * #AtkImage primarily provides two types of information: coordinate + * information (useful for screen review mode of screenreaders, and + * for use by onscreen magnifiers), and descriptive information. The + * descriptive information is provided for alternative, text-only + * presentation of the most significant information present in the + * image. + */ + GType -atk_image_get_type () +atk_image_get_type (void) { static GType type = 0; @@ -29,8 +52,7 @@ atk_image_get_type () { sizeof (AtkImageIface), (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - + (GBaseFinalizeFunc) NULL }; type = g_type_register_static (G_TYPE_INTERFACE, "AtkImage", &tinfo, 0); @@ -47,19 +69,18 @@ atk_image_get_type () * * Returns: a string representing the image description **/ -G_CONST_RETURN gchar* -atk_image_get_image_description (AtkImage *obj) +const gchar* +atk_image_get_image_description (AtkImage *image) { AtkImageIface *iface; - g_return_val_if_fail (obj != NULL, NULL); - g_return_val_if_fail (ATK_IS_IMAGE (obj), NULL); + g_return_val_if_fail (ATK_IS_IMAGE (image), NULL); - iface = ATK_IMAGE_GET_IFACE (obj); + iface = ATK_IMAGE_GET_IFACE (image); if (iface->get_image_description) { - return (iface->get_image_description) (obj); + return (iface->get_image_description) (image); } else { @@ -70,31 +91,44 @@ atk_image_get_image_description (AtkImage *obj) /** * atk_image_get_image_size: * @image: a #GObject instance that implements AtkImageIface - * @height: filled with the image height - * @width: filled with the image width - * - * Get the height, in pixels/screen coords, of this image. + * @width: (out) (optional): filled with the image width, or -1 if the value cannot be obtained. + * @height: (out) (optional): filled with the image height, or -1 if the value cannot be obtained. * - * Returns: an integer representing the image height in pixel coords + * Get the width and height in pixels for the specified image. + * The values of @width and @height are returned as -1 if the + * values cannot be obtained (for instance, if the object is not onscreen). **/ void -atk_image_get_image_size (AtkImage *obj, int *height, int *width) +atk_image_get_image_size (AtkImage *image, + int *width, + int *height) { AtkImageIface *iface; + gint local_width, local_height; + gint *real_width, *real_height; - g_return_if_fail (obj != NULL); - g_return_if_fail (ATK_IS_IMAGE (obj)); + g_return_if_fail (ATK_IS_IMAGE (image)); - iface = ATK_IMAGE_GET_IFACE (obj); + if (width) + real_width = width; + else + real_width = &local_width; + if (height) + real_height = height; + else + real_height = &local_height; + + iface = ATK_IMAGE_GET_IFACE (image); if (iface->get_image_size) - { - return (iface->get_image_size) (obj, height, width); - } + { + iface->get_image_size (image, real_width, real_height); + } else - { - return; - } + { + *real_width = -1; + *real_height = -1; + } } /** @@ -108,19 +142,18 @@ atk_image_get_image_size (AtkImage *obj, int *height, int *width) * not be completed. **/ gboolean -atk_image_set_image_description (AtkImage *obj, - const gchar *description) +atk_image_set_image_description (AtkImage *image, + const gchar *description) { AtkImageIface *iface; - g_return_val_if_fail (obj != NULL, FALSE); - g_return_val_if_fail (ATK_IS_IMAGE (obj), FALSE); + g_return_val_if_fail (ATK_IS_IMAGE (image), FALSE); - iface = ATK_IMAGE_GET_IFACE (obj); + iface = ATK_IMAGE_GET_IFACE (image); if (iface->set_image_description) { - return (iface->set_image_description) (obj, description); + return (iface->set_image_description) (image, description); } else { @@ -129,35 +162,77 @@ atk_image_set_image_description (AtkImage *obj, } /** - * atk_image_get_position: + * atk_image_get_image_position: * @image: a #GObject instance that implements AtkImageIface - * @x: address of #gint to put x coordinate position - * @y: address of #gint to put y coordinate position + * @x: (out) (optional): address of #gint to put x coordinate position; otherwise, -1 if value cannot be obtained. + * @y: (out) (optional): address of #gint to put y coordinate position; otherwise, -1 if value cannot be obtained. * @coord_type: specifies whether the coordinates are relative to the screen * or to the components top level window * * Gets the position of the image in the form of a point specifying the - * images top-left corner + * images top-left corner. **/ void -atk_image_get_position (AtkImage *image, +atk_image_get_image_position (AtkImage *image, gint *x, gint *y, AtkCoordType coord_type) { AtkImageIface *iface; + gint local_x, local_y; + gint *real_x, *real_y; - g_return_if_fail (image != NULL); g_return_if_fail (ATK_IS_IMAGE (image)); + if (x) + real_x = x; + else + real_x = &local_x; + if (y) + real_y = y; + else + real_y = &local_y; + iface = ATK_IMAGE_GET_IFACE (image); - if (iface->get_position) - (iface->get_position) (image, x, y, coord_type); + if (iface->get_image_position) + { + (iface->get_image_position) (image, real_x, real_y, coord_type); + } + else + { + *real_x = -1; + *real_y = -1; + } } +/** + * atk_image_get_image_locale: + * @image: An #AtkImage + * + * Since: 1.12 + * + * Returns: (nullable): a string corresponding to the POSIX + * LC_MESSAGES locale used by the image description, or %NULL if the + * image does not specify a locale. + * + */ +const gchar* +atk_image_get_image_locale (AtkImage *image) +{ + + AtkImageIface *iface; + g_return_val_if_fail (ATK_IS_IMAGE (image), NULL); + iface = ATK_IMAGE_GET_IFACE (image); - - + if (iface->get_image_locale) + { + return (iface->get_image_locale) (image); + } + else + { + return NULL; + } +}