2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 * AccessibleComponent function implementations
30 #include <cspi/spi-private.h>
33 * AccessibleComponent_ref:
34 * @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
36 * Increment the reference count for an #AccessibleComponent.
39 AccessibleComponent_ref (AccessibleComponent *obj)
41 cspi_object_ref (obj);
45 * AccessibleComponent_unref:
46 * @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
48 * Decrement the reference count for an #AccessibleComponent.
51 AccessibleComponent_unref (AccessibleComponent *obj)
53 cspi_object_unref (obj);
57 * AccessibleComponent_contains:
58 * @obj: a pointer to the #AccessibleComponent to query.
59 * @x: a #long specifying the x coordinate in question.
60 * @y: a #long specifying the y coordinate in question.
61 * @ctype: the desired coordinate system of the point (@x, @y)
62 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
64 * Query whether a given #AccessibleComponent contains a particular point.
66 * Returns: a #TRUE if the specified component contains the point (@x, @y),
70 AccessibleComponent_contains (AccessibleComponent *obj,
73 AccessibleCoordType ctype)
77 cspi_return_val_if_fail (obj != NULL, FALSE);
79 retval = Accessibility_Component_contains (CSPI_OBJREF (obj),
84 cspi_return_val_if_ev ("contains", FALSE);
90 * AccessibleComponent_getAccessibleAtPoint:
91 * @obj: a pointer to the #AccessibleComponent to query.
92 * @x: a #long specifying the x coordinate of the point in question.
93 * @y: a #long specifying the y coordinate of the point in question.
94 * @ctype: the coordinate system of the point (@x, @y)
95 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
97 * Get the accessible child at a given coordinate within an #AccessibleComponent.
99 * Returns: a pointer to an #Accessible child of the specified component which
100 * contains the point (@x, @y), or NULL of no child contains the point.
103 AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj,
106 AccessibleCoordType ctype)
108 Accessibility_Accessible child;
110 cspi_return_val_if_fail (obj != NULL, NULL);
112 child = Accessibility_Component_getAccessibleAtPoint (CSPI_OBJREF (obj),
117 return cspi_object_add (child);
121 * AccessibleComponent_getExtents:
122 * @obj: a pointer to the #AccessibleComponent to query.
123 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
124 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
125 * @width: a pointer to a #long into which the x extents (width) will be returned.
126 * @height: a pointer to a #long into which the y extents (height) will be returned.
127 * @ctype: the desired coordinate system into which to return the results,
128 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
130 * Get the bounding box of the specified #AccessibleComponent.
134 AccessibleComponent_getExtents (AccessibleComponent *obj,
139 AccessibleCoordType ctype)
141 Accessibility_BoundingBox bbox;
143 cspi_return_if_fail (obj != NULL);
145 bbox = Accessibility_Component_getExtents (CSPI_OBJREF (obj),
148 if (!cspi_check_ev ("getExtents"))
150 *x = *y = *width = *height = 0;
157 *height = bbox.height;
162 * AccessibleComponent_getPosition:
163 * @obj: a pointer to the #AccessibleComponent to query.
164 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
165 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
166 * @ctype: the desired coordinate system into which to return the results,
167 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
169 * Get the minimum x and y coordinates of the specified #AccessibleComponent.
173 AccessibleComponent_getPosition (AccessibleComponent *obj,
176 AccessibleCoordType ctype)
180 cspi_return_if_fail (obj != NULL);
182 Accessibility_Component_getPosition (CSPI_OBJREF (obj),
183 &cx, &cy, ctype, cspi_ev ());
185 if (!cspi_check_ev ("getPosition"))
197 * AccessibleComponent_getSize:
198 * @obj: a pointer to the #AccessibleComponent to query.
199 * @width: a pointer to a #long into which the x extents (width) will be returned.
200 * @height: a pointer to a #long into which the y extents (height) will be returned.
202 * Get the size of the specified #AccessibleComponent.
206 AccessibleComponent_getSize (AccessibleComponent *obj,
212 cspi_return_if_fail (obj != NULL);
214 Accessibility_Component_getSize (CSPI_OBJREF (obj),
218 if (cspi_check_ev ("getSize"))
220 *width = *height = 0;
230 * AccessibleComponent_getLayer:
231 * @obj: a pointer to the #AccessibleComponent to query.
233 * Query which layer the component is painted into, to help determine its
234 * visibility in terms of stacking order.
236 * Returns: the #AccessibleComponentLayer into which this component is painted.
238 AccessibleComponentLayer
239 AccessibleComponent_getLayer (AccessibleComponent *obj)
241 AccessibleComponentLayer retval;
242 Accessibility_ComponentLayer zlayer;
244 cspi_return_val_if_fail (obj != NULL, FALSE);
246 zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj),
249 cspi_return_val_if_ev ("getLayer", SPI_LAYER_INVALID);
253 case Accessibility_LAYER_BACKGROUND:
254 retval = SPI_LAYER_BACKGROUND;
256 case Accessibility_LAYER_CANVAS:
257 retval = SPI_LAYER_CANVAS;
259 case Accessibility_LAYER_WIDGET:
260 retval = SPI_LAYER_WIDGET;
262 case Accessibility_LAYER_MDI:
263 retval = SPI_LAYER_MDI;
265 case Accessibility_LAYER_POPUP:
266 retval = SPI_LAYER_POPUP;
268 case Accessibility_LAYER_OVERLAY:
269 retval = SPI_LAYER_OVERLAY;
271 case Accessibility_LAYER_WINDOW:
272 retval = SPI_LAYER_WINDOW;
275 retval = SPI_LAYER_INVALID;
283 * AccessibleComponent_getMDIZOrder:
284 * @obj: a pointer to the #AccessibleComponent to query.
286 * Query the z stacking order of a component which is in the MDI or window
287 * layer. (Bigger z-order numbers mean nearer the top)
289 * Returns: a short integer indicating the stacking order of the component
290 * in the MDI layer, or -1 if the component is not in the MDI layer.
293 AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
297 cspi_return_val_if_fail (obj != NULL, FALSE);
299 retval = Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj),
302 cspi_return_val_if_ev ("getMDIZOrder", FALSE);
308 * AccessibleComponent_grabFocus:
309 * @obj: a pointer to the #AccessibleComponent on which to operate.
311 * Attempt to set the keyboard input focus to the specified
312 * #AccessibleComponent.
314 * Returns: #TRUE if successful, #FALSE otherwise.
318 AccessibleComponent_grabFocus (AccessibleComponent *obj)
322 cspi_return_val_if_fail (obj != NULL, FALSE);
324 retval = Accessibility_Component_grabFocus (CSPI_OBJREF (obj),
327 cspi_return_val_if_ev ("grabFocus", FALSE);
333 * AccessibleComponent_getAlpha:
334 * Return the opacity/alpha value of a component, if alpha blending is in use.
335 * @obj: The #AccessibleComponent to be queried.
336 * Returns: the opacity value of a component, as a double between 0.0 and 1.0.
339 AccessibleComponent_getAlpha (AccessibleComponent *obj)
343 cspi_return_val_if_fail (obj != NULL, 1.0);
345 retval = Accessibility_Component_getAlpha (CSPI_OBJREF (obj),
348 cspi_return_val_if_ev ("getAlpha", 1.0);