X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=cspi%2Fspi_image.c;h=bf5360e0063466b1adcbfa0451b6b0d2eba46d4d;hb=ebd9b297363b8b3bd6708e6f0c6c7673e5cc32d6;hp=506edacbda165498ee3cda8ae70a7d00f714102b;hpb=408978dd34f3338e49b6ace5f60b7606579ce7a9;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/cspi/spi_image.c b/cspi/spi_image.c index 506edac..bf5360e 100644 --- a/cspi/spi_image.c +++ b/cspi/spi_image.c @@ -1,51 +1,159 @@ -int -SpiAccessibleImage_ref (SpiAccessibleImage *obj) +#include + +/** + * AccessibleImage_ref: + * @obj: a pointer to the #AccessibleImage implementor on which to operate. + * + * Increment the reference count for an #AccessibleImage object. + **/ +void +AccessibleImage_ref (AccessibleImage *obj) { - Accessibility_SpiImage_ref (*obj, &ev); - return 0; + cspi_object_ref (obj); } - - -int -SpiAccessibleImage_unref (SpiAccessibleImage *obj) +/** + * AccessibleImage_unref: + * @obj: a pointer to the #AccessibleImage implementor on which to operate. + * + * Decrement the reference count for an #AccessibleImage object. + **/ +void +AccessibleImage_unref (AccessibleImage *obj) { - Accessibility_SpiImage_unref (*obj, &ev); - return 0; + cspi_object_unref (obj); } - - +/** + * AccessibleImage_getImageDescription: + * @obj: a pointer to the #AccessibleImage implementor on which to operate. + * + * Get the description of the image displayed in an #AccessibleImage object. + * + * Returns: a UTF-8 string describing the image. + **/ char * -SpiAccessibleImage_getImageDescription (SpiAccessibleImage *obj) +AccessibleImage_getImageDescription (AccessibleImage *obj) { - return (char *) - Accessibility_SpiImage__get_imageDescription (*obj, &ev); - } + char *retval; + + cspi_return_val_if_fail (obj != NULL, NULL); + retval = + Accessibility_Image__get_imageDescription (CSPI_OBJREF (obj), + cspi_ev ()); + cspi_return_val_if_ev ("getImageDescription", NULL); + + return retval; +} +/** + * AccessibleImage_getImageSize: + * @obj: a pointer to the #AccessibleImage to query. + * @width: a pointer to a #long into which the x extents (width) will be returned. + * @height: a pointer to a #long into which the y extents (height) will be returned. + * + * Get the size of the image displayed in a specified #AccessibleImage object. + **/ void -SpiAccessibleImage_getImageSize (SpiAccessibleImage *obj, - long *width, - long *height) +AccessibleImage_getImageSize (AccessibleImage *obj, + long int *width, + long int *height) { - Accessibility_SpiImage_getImageSize (*obj, - (CORBA_long *) width, (CORBA_long *) height, &ev); -} + CORBA_long w, h; + cspi_return_if_fail (obj != NULL); + Accessibility_Image_getImageSize (CSPI_OBJREF (obj), + &w, &h, cspi_ev ()); + if (!cspi_check_ev ("getImageSize")) + { + *width = 0; + *height = 0; + } + else + { + *width = w; + *height = h; + } +} + +/** + * AccessibleImage_getImagePosition: + * @obj: a pointer to the #AccessibleImage implementor to query. + * @x: a pointer to a #long into which the minimum x coordinate will be returned. + * @y: a pointer to a #long into which the minimum y coordinate will be returned. + * @ctype: the desired coordinate system into which to return the results, + * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN). + * + * Get the minimum x and y coordinates of the image displayed in a + * specified #AccessibleImage implementor. + **/ void -SpiAccessibleImage_getImagePosition (SpiAccessibleImage *obj, +AccessibleImage_getImagePosition (AccessibleImage *obj, long *x, long *y, - SpiAccessibleCoordType ctype) + AccessibleCoordType ctype) { - Accessibility_SpiImage_getImagePosition (*obj, - (CORBA_long *) x, (CORBA_long *) y, (CORBA_short) ctype, - &ev); + CORBA_long cx, cy; + + cspi_return_if_fail (obj != NULL); + + Accessibility_Image_getImagePosition (CSPI_OBJREF (obj), + &cx, &cy, ctype, cspi_ev ()); + + if (!cspi_check_ev ("getImagePosition")) + { + *x = 0; + *y = 0; + } + else + { + *x = cx; + *y = cy; + } } +/** + * AccessibleImage_getImageExtents: + * @obj: a pointer to the #AccessibleImage implementor to query. + * @x: a pointer to a #long into which the minimum x coordinate will be returned. + * @y: a pointer to a #long into which the minimum y coordinate will be returned. + * @width: a pointer to a #long into which the image x extent will be returned. + * @height: a pointer to a #long into which the image y extent will be returned. + * @ctype: the desired coordinate system into which to return the results, + * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN). + * + * Get the bounding box of the image displayed in a + * specified #AccessibleImage implementor. + **/ +void +AccessibleImage_getImageExtents (AccessibleImage *obj, + long *x, + long *y, + long *width, + long *height, + AccessibleCoordType ctype) +{ + Accessibility_BoundingBox bbox; + + cspi_return_if_fail (obj != NULL); + bbox = Accessibility_Image_getImageExtents (CSPI_OBJREF (obj), + (CORBA_short) ctype, + cspi_ev ()); + if (!cspi_check_ev ("getImageExtents")) + { + *x = *y = *width = *height = 0; + } + else + { + *x = bbox.x; + *y = bbox.y; + *width = bbox.width; + *height = bbox.height; + } +}