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)
76 dbus_int32_t d_x = x, d_y = y;
77 dbus_uint16_t d_ctype = ctype;
79 cspi_return_val_if_fail (obj != NULL, FALSE);
81 cspi_dbus_call (obj, spi_interface_component, "contains", NULL, "iin=>b", d_x, d_y, d_ctype, &retval);
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 dbus_int32_t d_x = x, d_y = y;
108 dbus_uint16_t d_ctype = ctype;
112 cspi_return_val_if_fail (obj != NULL, FALSE);
114 cspi_dbus_call (obj, spi_interface_component, "getAccessibleAtPoint", NULL, "iin=>o", d_x, d_y, d_ctype, &path);
116 retval = cspi_ref_related_accessible (obj, path);
122 * AccessibleComponent_getExtents:
123 * @obj: a pointer to the #AccessibleComponent to query.
124 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
125 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
126 * @width: a pointer to a #long into which the x extents (width) will be returned.
127 * @height: a pointer to a #long into which the y extents (height) will be returned.
128 * @ctype: the desired coordinate system into which to return the results,
129 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
131 * Get the bounding box of the specified #AccessibleComponent.
135 AccessibleComponent_getExtents (AccessibleComponent *obj,
140 AccessibleCoordType ctype)
142 dbus_int16_t d_ctype = ctype;
143 Accessibility_BoundingBox bbox;
145 cspi_return_if_fail (obj != NULL);
147 cspi_dbus_call (obj, spi_interface_component, "getExtents", NULL, "n=>(iiii)", d_ctype, &bbox);
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)
178 dbus_int32_t d_x, d_y;
179 dbus_uint16_t d_ctype = ctype;
181 cspi_return_if_fail (obj != NULL);
183 cspi_dbus_call (obj, spi_interface_component, "getPosition", NULL, "n=>ii", d_ctype, &d_x, &d_y);
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,
210 dbus_int32_t d_w, d_h;
212 cspi_return_if_fail (obj != NULL);
214 cspi_dbus_call (obj, spi_interface_component, "getSize", NULL, "=>ii", &d_w, &d_h);
215 if (cspi_check_ev ("getSize"))
217 *width = *height = 0;
227 * AccessibleComponent_getLayer:
228 * @obj: a pointer to the #AccessibleComponent to query.
230 * Query which layer the component is painted into, to help determine its
231 * visibility in terms of stacking order.
233 * Returns: the #AccessibleComponentLayer into which this component is painted.
235 AccessibleComponentLayer
236 AccessibleComponent_getLayer (AccessibleComponent *obj)
238 AccessibleComponentLayer retval;
239 dbus_uint32_t zlayer;
241 cspi_return_val_if_fail (obj != NULL, FALSE);
243 cspi_dbus_call (obj, spi_interface_component, "getLayer", NULL, "=>u", &zlayer);
245 cspi_return_val_if_ev ("getLayer", SPI_LAYER_INVALID);
249 case Accessibility_LAYER_BACKGROUND:
250 retval = SPI_LAYER_BACKGROUND;
252 case Accessibility_LAYER_CANVAS:
253 retval = SPI_LAYER_CANVAS;
255 case Accessibility_LAYER_WIDGET:
256 retval = SPI_LAYER_WIDGET;
258 case Accessibility_LAYER_MDI:
259 retval = SPI_LAYER_MDI;
261 case Accessibility_LAYER_POPUP:
262 retval = SPI_LAYER_POPUP;
264 case Accessibility_LAYER_OVERLAY:
265 retval = SPI_LAYER_OVERLAY;
267 case Accessibility_LAYER_WINDOW:
268 retval = SPI_LAYER_WINDOW;
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 or window
283 * layer. (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)
291 dbus_uint16_t retval;
293 cspi_return_val_if_fail (obj != NULL, FALSE);
295 cspi_dbus_call (obj, spi_interface_component, "getMDIZOrder", NULL, "=>n", &retval);
297 cspi_return_val_if_ev ("getMDIZOrder", FALSE);
303 * AccessibleComponent_grabFocus:
304 * @obj: a pointer to the #AccessibleComponent on which to operate.
306 * Attempt to set the keyboard input focus to the specified
307 * #AccessibleComponent.
309 * Returns: #TRUE if successful, #FALSE otherwise.
313 AccessibleComponent_grabFocus (AccessibleComponent *obj)
317 cspi_return_val_if_fail (obj != NULL, FALSE);
319 cspi_dbus_call (obj, spi_interface_component, "grabFocus", NULL, "=>b", &retval);
321 cspi_return_val_if_ev ("grabFocus", FALSE);
327 * AccessibleComponent_getAlpha:
328 * @obj: The #AccessibleComponent to be queried.
330 * Get the opacity/alpha value of a component, if alpha blending is in use.
332 * Returns: the opacity value of a component, as a double between 0.0 and 1.0.
335 AccessibleComponent_getAlpha (AccessibleComponent *obj)
339 cspi_return_val_if_fail (obj != NULL, 1.0);
341 cspi_dbus_call (obj, spi_interface_component, "getAlpha", NULL, "=>d", &retval);
343 cspi_return_val_if_ev ("getAlpha", 1.0);