2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 * AccessibleComponent function implementations
29 #include <cspi/spi-private.h>
32 * AccessibleComponent_ref:
33 * @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
35 * Increment the reference count for an #AccessibleComponent.
38 AccessibleComponent_ref (AccessibleComponent *obj)
40 cspi_object_ref (obj);
44 * AccessibleComponent_unref:
45 * @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
47 * Decrement the reference count for an #AccessibleComponent.
50 AccessibleComponent_unref (AccessibleComponent *obj)
52 cspi_object_unref (obj);
56 * AccessibleComponent_contains:
57 * @obj: a pointer to the #AccessibleComponent to query.
58 * @x: a #long specifying the x coordinate in question.
59 * @y: a #long specifying the y coordinate in question.
60 * @ctype: the desired coordinate system of the point (@x, @y)
61 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
63 * Query whether a given #AccessibleComponent contains a particular point.
65 * Returns: a #TRUE if the specified component contains the point (@x, @y),
69 AccessibleComponent_contains (AccessibleComponent *obj,
72 AccessibleCoordType ctype)
76 cspi_return_val_if_fail (obj != NULL, FALSE);
78 retval = Accessibility_Component_contains (CSPI_OBJREF (obj),
83 cspi_return_val_if_ev ("contains", FALSE);
89 * AccessibleComponent_getAccessibleAtPoint:
90 * @obj: a pointer to the #AccessibleComponent to query.
91 * @x: a #long specifying the x coordinate of the point in question.
92 * @y: a #long specifying the y coordinate of the point in question.
93 * @ctype: the coordinate system of the point (@x, @y)
94 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
96 * Get the accessible child at a given coordinate within an #AccessibleComponent.
98 * Returns: a pointer to an #Accessible child of the specified component which
99 * contains the point (@x, @y), or NULL of no child contains the point.
102 AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj,
105 AccessibleCoordType ctype)
107 Accessibility_Accessible child;
109 cspi_return_val_if_fail (obj != NULL, NULL);
111 child = Accessibility_Component_getAccessibleAtPoint (CSPI_OBJREF (obj),
116 return cspi_object_add (child);
120 * AccessibleComponent_getExtents:
121 * @obj: a pointer to the #AccessibleComponent to query.
122 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
123 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
124 * @width: a pointer to a #long into which the x extents (width) will be returned.
125 * @height: a pointer to a #long into which the y extents (height) will be returned.
126 * @ctype: the desired coordinate system into which to return the results,
127 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
129 * Get the bounding box of the specified #AccessibleComponent.
133 AccessibleComponent_getExtents (AccessibleComponent *obj,
138 AccessibleCoordType ctype)
140 Accessibility_BoundingBox bbox;
142 cspi_return_if_fail (obj != NULL);
144 bbox = Accessibility_Component_getExtents (CSPI_OBJREF (obj),
147 if (!cspi_check_ev ("getExtents"))
149 *x = *y = *width = *height = 0;
156 *height = bbox.height;
161 * AccessibleComponent_getPosition:
162 * @obj: a pointer to the #AccessibleComponent to query.
163 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
164 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
165 * @ctype: the desired coordinate system into which to return the results,
166 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
168 * Get the minimum x and y coordinates of the specified #AccessibleComponent.
172 AccessibleComponent_getPosition (AccessibleComponent *obj,
175 AccessibleCoordType ctype)
179 cspi_return_if_fail (obj != NULL);
181 Accessibility_Component_getPosition (CSPI_OBJREF (obj),
182 &cx, &cy, ctype, cspi_ev ());
184 if (!cspi_check_ev ("getPosition"))
196 * AccessibleComponent_getSize:
197 * @obj: a pointer to the #AccessibleComponent to query.
198 * @width: a pointer to a #long into which the x extents (width) will be returned.
199 * @height: a pointer to a #long into which the y extents (height) will be returned.
201 * Get the size of the specified #AccessibleComponent.
205 AccessibleComponent_getSize (AccessibleComponent *obj,
211 cspi_return_if_fail (obj != NULL);
213 Accessibility_Component_getSize (CSPI_OBJREF (obj),
217 if (cspi_check_ev ("getSize"))
219 *width = *height = 0;
229 * AccessibleComponent_getLayer:
230 * @obj: a pointer to the #AccessibleComponent to query.
232 * Query which layer the component is painted into, to help determine its
233 * visibility in terms of stacking order.
235 * Returns: the #AccessibleComponentLayer into which this component is painted.
237 AccessibleComponentLayer
238 AccessibleComponent_getLayer (AccessibleComponent *obj)
240 AccessibleComponentLayer retval;
241 Accessibility_ComponentLayer zlayer;
243 cspi_return_val_if_fail (obj != NULL, FALSE);
245 zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj),
248 cspi_return_val_if_ev ("getLayer", SPI_LAYER_INVALID);
252 case Accessibility_LAYER_BACKGROUND:
253 retval = SPI_LAYER_BACKGROUND;
255 case Accessibility_LAYER_CANVAS:
256 retval = SPI_LAYER_CANVAS;
258 case Accessibility_LAYER_WIDGET:
259 retval = SPI_LAYER_WIDGET;
261 case Accessibility_LAYER_MDI:
262 retval = SPI_LAYER_MDI;
264 case Accessibility_LAYER_POPUP:
265 retval = SPI_LAYER_POPUP;
267 case Accessibility_LAYER_OVERLAY:
268 retval = SPI_LAYER_OVERLAY;
271 retval = SPI_LAYER_INVALID;
279 * AccessibleComponent_getMDIZOrder:
280 * @obj: a pointer to the #AccessibleComponent to query.
282 * Query the z stacking order of a component which is in the MDI layer.
283 * (Bigger z-order numbers mean nearer the top)
285 * Returns: a short integer indicating the stacking order of the component
286 * in the MDI layer, or -1 if the component is not in the MDI layer.
289 AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
293 cspi_return_val_if_fail (obj != NULL, FALSE);
295 retval = Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj),
298 cspi_return_val_if_ev ("getMDIZOrder", FALSE);
304 * AccessibleComponent_grabFocus:
305 * @obj: a pointer to the #AccessibleComponent on which to operate.
307 * Attempt to set the keyboard input focus to the specified
308 * #AccessibleComponent.
310 * Returns: #TRUE if successful, #FALSE otherwise.
314 AccessibleComponent_grabFocus (AccessibleComponent *obj)
318 cspi_return_val_if_fail (obj != NULL, FALSE);
320 retval = Accessibility_Component_grabFocus (CSPI_OBJREF (obj),
323 cspi_return_val_if_ev ("grabFocus", FALSE);