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 ("AccessibleComponent_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,
209 cspi_return_if_fail (obj != NULL);
211 Accessibility_Component_getSize (CSPI_OBJREF (obj),
212 (CORBA_long *) width,
213 (CORBA_long *) height,
218 * AccessibleComponent_getLayer:
219 * @obj: a pointer to the #AccessibleComponent to query.
221 * Query which layer the component is painted into, to help determine its
222 * visibility in terms of stacking order.
224 * Returns: the #AccessibleComponentLayer into which this component is painted.
226 AccessibleComponentLayer
227 AccessibleComponent_getLayer (AccessibleComponent *obj)
229 AccessibleComponentLayer retval;
230 Accessibility_ComponentLayer zlayer;
232 cspi_return_val_if_fail (obj != NULL, FALSE);
234 zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj),
237 cspi_return_val_if_ev ("getLayer", SPI_LAYER_INVALID);
241 case Accessibility_LAYER_BACKGROUND:
242 retval = SPI_LAYER_BACKGROUND;
244 case Accessibility_LAYER_CANVAS:
245 retval = SPI_LAYER_CANVAS;
247 case Accessibility_LAYER_WIDGET:
248 retval = SPI_LAYER_WIDGET;
250 case Accessibility_LAYER_MDI:
251 retval = SPI_LAYER_MDI;
253 case Accessibility_LAYER_POPUP:
254 retval = SPI_LAYER_POPUP;
256 case Accessibility_LAYER_OVERLAY:
257 retval = SPI_LAYER_OVERLAY;
260 retval = SPI_LAYER_INVALID;
268 * AccessibleComponent_getMDIZOrder:
269 * @obj: a pointer to the #AccessibleComponent to query.
271 * Query the z stacking order of a component which is in the MDI layer.
272 * (Bigger z-order numbers mean nearer the top)
274 * Returns: a short integer indicating the stacking order of the component
275 * in the MDI layer, or -1 if the component is not in the MDI layer.
278 AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
282 cspi_return_val_if_fail (obj != NULL, FALSE);
284 retval = Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj),
287 cspi_return_val_if_ev ("getMDIZOrder", FALSE);
293 * AccessibleComponent_grabFocus:
294 * @obj: a pointer to the #AccessibleComponent on which to operate.
296 * Attempt to set the keyboard input focus to the specified
297 * #AccessibleComponent.
299 * Returns: #TRUE if successful, #FALSE otherwise.
303 AccessibleComponent_grabFocus (AccessibleComponent *obj)
307 cspi_return_val_if_fail (obj != NULL, FALSE);
309 retval = Accessibility_Component_grabFocus (CSPI_OBJREF (obj),
312 cspi_return_val_if_ev ("grabFocus", FALSE);