X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=inline;f=cspi%2Fspi_component.c;h=44d3ef63a9f05246e6051259e796edf906da50f9;hb=fc127cbb0f6101f0dc98416737d651c0cda2ca10;hp=ff4b6d8b3afcf3b5c8e8e6b83d8447fe458d021d;hpb=8e873a6ebbed811c4f41cbdddf6e6ba23d6bce0a;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/cspi/spi_component.c b/cspi/spi_component.c index ff4b6d8..44d3ef6 100644 --- a/cspi/spi_component.c +++ b/cspi/spi_component.c @@ -1,4 +1,27 @@ /* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* * * AccessibleComponent function implementations * @@ -11,15 +34,11 @@ * @obj: a pointer to an object implementing #AccessibleComponent on which to operate. * * Increment the reference count for an #AccessibleComponent. - * - * Returns: (no return code implemented yet). - * **/ -int +void AccessibleComponent_ref (AccessibleComponent *obj) { - Accessibility_Component_ref (*obj, spi_ev ()); - return 0; + cspi_object_ref (obj); } /** @@ -27,15 +46,11 @@ AccessibleComponent_ref (AccessibleComponent *obj) * @obj: a pointer to the object implementing #AccessibleComponent on which to operate. * * Decrement the reference count for an #AccessibleComponent. - * - * Returns: (no return code implemented yet). - * **/ -int +void AccessibleComponent_unref (AccessibleComponent *obj) { - Accessibility_Component_unref (*obj, spi_ev ()); - return 0; + cspi_object_unref (obj); } /** @@ -44,24 +59,31 @@ AccessibleComponent_unref (AccessibleComponent *obj) * @x: a #long specifying the x coordinate in question. * @y: a #long specifying the y coordinate in question. * @ctype: the desired coordinate system of the point (@x, @y) - * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN). + * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN). * * Query whether a given #AccessibleComponent contains a particular point. * * Returns: a #TRUE if the specified component contains the point (@x, @y), * otherwise #FALSE. **/ -boolean +SPIBoolean AccessibleComponent_contains (AccessibleComponent *obj, long int x, long int y, AccessibleCoordType ctype) { - return Accessibility_Component_contains (*obj, - (CORBA_long) x, - (CORBA_long) y, - ctype, - spi_ev ()); + SPIBoolean retval; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + retval = Accessibility_Component_contains (CSPI_OBJREF (obj), + x, + y, + ctype, + cspi_ev ()); + cspi_return_val_if_ev ("contains", FALSE); + + return retval; } /** @@ -70,7 +92,7 @@ AccessibleComponent_contains (AccessibleComponent *obj, * @x: a #long specifying the x coordinate of the point in question. * @y: a #long specifying the y coordinate of the point in question. * @ctype: the coordinate system of the point (@x, @y) - * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN). + * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN). * * Get the accessible child at a given coordinate within an #AccessibleComponent. * @@ -83,13 +105,16 @@ AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj, long int y, AccessibleCoordType ctype) { - Accessible child; - child = Accessibility_Component_getAccessibleAtPoint(*obj, - (CORBA_long) x, - (CORBA_long) y, - ctype, - spi_ev ()); - return spi_object_add (child); + Accessibility_Accessible child; + + cspi_return_val_if_fail (obj != NULL, NULL); + + child = Accessibility_Component_getAccessibleAtPoint (CSPI_OBJREF (obj), + x, + y, + ctype, + cspi_ev ()); + return cspi_object_add (child); } /** @@ -100,7 +125,7 @@ AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj, * @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. * @ctype: the desired coordinate system into which to return the results, - * (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN). + * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN). * * Get the bounding box of the specified #AccessibleComponent. * @@ -113,19 +138,24 @@ AccessibleComponent_getExtents (AccessibleComponent *obj, long int *height, AccessibleCoordType ctype) { - CORBA_long cx, cy, cw, ch; - Accessibility_Component_getExtents (*obj, - &cx, - &cy, - &cw, - &ch, - ctype, - spi_ev ()); - spi_warn_ev (spi_ev (), "AccessibleComponent_getExtents"); - *x = (long) cx; - *y = (long) cy; - *width = (long) cw; - *height = (long) ch; + Accessibility_BoundingBox bbox; + + cspi_return_if_fail (obj != NULL); + + bbox = Accessibility_Component_getExtents (CSPI_OBJREF (obj), + ctype, + cspi_ev ()); + if (!cspi_check_ev ("getExtents")) + { + *x = *y = *width = *height = 0; + } + else + { + *x = bbox.x; + *y = bbox.y; + *width = bbox.width; + *height = bbox.height; + } } /** @@ -134,7 +164,7 @@ AccessibleComponent_getExtents (AccessibleComponent *obj, * @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). + * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN). * * Get the minimum x and y coordinates of the specified #AccessibleComponent. * @@ -145,11 +175,22 @@ AccessibleComponent_getPosition (AccessibleComponent *obj, long int *y, AccessibleCoordType ctype) { - Accessibility_Component_getPosition (*obj, - (CORBA_long *) x, - (CORBA_long *) y, - ctype, - spi_ev ()); + CORBA_long cx, cy; + + cspi_return_if_fail (obj != NULL); + + Accessibility_Component_getPosition (CSPI_OBJREF (obj), + &cx, &cy, ctype, cspi_ev ()); + + if (!cspi_check_ev ("getPosition")) + { + *x = *y = 0; + } + else + { + *x = cx; + *y = cy; + } } /** @@ -166,10 +207,101 @@ AccessibleComponent_getSize (AccessibleComponent *obj, long int *width, long int *height) { - Accessibility_Component_getSize (*obj, - (CORBA_long *) width, - (CORBA_long *) height, - spi_ev ()); + CORBA_long cw, ch; + + cspi_return_if_fail (obj != NULL); + + Accessibility_Component_getSize (CSPI_OBJREF (obj), + &cw, + &ch, + cspi_ev ()); + if (cspi_check_ev ("getSize")) + { + *width = *height = 0; + } + else + { + *width = cw; + *height = ch; + } +} + +/** + * AccessibleComponent_getLayer: + * @obj: a pointer to the #AccessibleComponent to query. + * + * Query which layer the component is painted into, to help determine its + * visibility in terms of stacking order. + * + * Returns: the #AccessibleComponentLayer into which this component is painted. + **/ +AccessibleComponentLayer +AccessibleComponent_getLayer (AccessibleComponent *obj) +{ + AccessibleComponentLayer retval; + Accessibility_ComponentLayer zlayer; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj), + cspi_ev ()); + + cspi_return_val_if_ev ("getLayer", SPI_LAYER_INVALID); + + switch (zlayer) + { + case Accessibility_LAYER_BACKGROUND: + retval = SPI_LAYER_BACKGROUND; + break; + case Accessibility_LAYER_CANVAS: + retval = SPI_LAYER_CANVAS; + break; + case Accessibility_LAYER_WIDGET: + retval = SPI_LAYER_WIDGET; + break; + case Accessibility_LAYER_MDI: + retval = SPI_LAYER_MDI; + break; + case Accessibility_LAYER_POPUP: + retval = SPI_LAYER_POPUP; + break; + case Accessibility_LAYER_OVERLAY: + retval = SPI_LAYER_OVERLAY; + break; + case Accessibility_LAYER_WINDOW: + retval = SPI_LAYER_WINDOW; + break; + default: + retval = SPI_LAYER_INVALID; + break; + } + + return retval; +} + +/** + * AccessibleComponent_getMDIZOrder: + * @obj: a pointer to the #AccessibleComponent to query. + * + * Query the z stacking order of a component which is in the MDI or window + * layer. (Bigger z-order numbers mean nearer the top) + * + * Returns: a short integer indicating the stacking order of the component + * in the MDI layer, or -1 if the component is not in the MDI layer. + **/ +short +AccessibleComponent_getMDIZOrder (AccessibleComponent *obj) +{ + short retval; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + retval = Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj), + cspi_ev ()); + + cspi_return_val_if_ev ("getMDIZOrder", FALSE); + + return retval; } /** @@ -179,9 +311,21 @@ AccessibleComponent_getSize (AccessibleComponent *obj, * Attempt to set the keyboard input focus to the specified * #AccessibleComponent. * + * Returns: #TRUE if successful, #FALSE otherwise. + * **/ -void +SPIBoolean AccessibleComponent_grabFocus (AccessibleComponent *obj) { - ; + SPIBoolean retval; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + retval = Accessibility_Component_grabFocus (CSPI_OBJREF (obj), + cspi_ev ()); + + cspi_return_val_if_ev ("grabFocus", FALSE); + + return retval; } +