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 * AtspiComponent function implementations
30 #include "atspi-private.h"
33 * atspi_component_contains:
34 * @obj: a pointer to the #AtspiComponent to query.
35 * @x: a #long specifying the x coordinate in question.
36 * @y: a #long specifying the y coordinate in question.
37 * @ctype: the desired coordinate system of the point (@x, @y)
38 * (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
40 * Query whether a given #AtspiComponent contains a particular point.
42 * Returns: a #TRUE if the specified component contains the point (@x, @y),
46 atspi_component_contains (AtspiComponent *obj,
49 AtspiCoordType ctype, GError **error)
51 dbus_bool_t retval = FALSE;
52 dbus_int32_t d_x = x, d_y = y;
53 dbus_uint16_t d_ctype = ctype;
55 g_return_val_if_fail (obj != NULL, FALSE);
57 _atspi_dbus_call (obj, atspi_interface_component, "Contains", error, "iin=>b", d_x, d_y, d_ctype, &retval);
63 * atspi_component_ref_accessible_at_point:
64 * @obj: a pointer to the #AtspiComponent to query.
65 * @x: a #gint specifying the x coordinate of the point in question.
66 * @y: a #gint specifying the y coordinate of the point in question.
67 * @ctype: the coordinate system of the point (@x, @y)
68 * (e.g. ATSPI_COORD_TYPE_WINDOW, ATSPI_COORD_TYPE_SCREEN).
70 * Get the accessible child at a given coordinate within an #AtspiComponent.
72 * Returns: a pointer to an #AtspiAccessible child of the specified component
73 * which contains the point (@x, @y), or NULL of no child contains
77 atspi_component_ref_accessible_at_point (AtspiComponent *obj,
80 AtspiCoordType ctype, GError **error)
82 dbus_int32_t d_x = x, d_y = y;
83 dbus_uint16_t d_ctype = ctype;
86 AtspiAccessible *retval = NULL;
88 g_return_val_if_fail (obj != NULL, FALSE);
90 reply = _atspi_dbus_call_partial (obj, atspi_interface_component, "GetAccessibleAtPoint", error, "iin", d_x, d_y, d_ctype);
92 return _atspi_dbus_return_accessible_from_message (reply);
96 * atspi_component_get_extents:
97 * @obj: a pointer to the #AtspiComponent to query.
98 * @x: a pointer to a #int into which the minimum x coordinate will be returned.
99 * @y: a pointer to a #int into which the minimum y coordinate will be returned.
100 * @width: a pointer to a #int into which the x extents (width) will be returned.
101 * @height: a pointer to a #int into which the y extents (height) will be returned.
102 * @ctype: the desired coordinate system into which to return the results,
103 * (e.g. ATSPI_COORD_TYPE_WINDOW, ATSPI_COORD_TYPE_SCREEN).
105 * Get the bounding box of the specified #AtspiComponent.
109 atspi_component_get_extents (AtspiComponent *obj,
114 AtspiCoordType ctype, GError **error)
116 dbus_int16_t d_ctype = ctype;
119 g_return_if_fail (obj != NULL);
121 _atspi_dbus_call (obj, atspi_interface_component, "GetExtents", error, "n=>(iiii)", d_ctype, &bbox);
126 * atspi_component_get_position:
127 * @obj: a pointer to the #AtspiComponent to query.
128 * @ctype: the desired coordinate system into which to return the results,
129 * (e.g. ATSPI_COORD_TYPE_WINDOW, ATSPI_COORD_TYPE_SCREEN).
131 * returns: A #AtspiPoint giving the position.
132 * Get the minimum x and y coordinates of the specified #AtspiComponent.
136 atspi_component_get_position (AtspiComponent *obj,
137 AtspiCoordType ctype, GError **error)
139 dbus_int32_t d_x, d_y;
140 dbus_uint16_t d_ctype = ctype;
148 _atspi_dbus_call (obj, atspi_interface_component, "GetPosition", error, "n=>ii", d_ctype, &d_x, &d_y);
156 * atspi_component_get_size:
157 * @obj: a pointer to the #AtspiComponent to query.
158 * returns: A #AtspiPoint giving the siize.
160 * Get the size of the specified #AtspiComponent.
164 atspi_component_get_size (AtspiComponent *obj, GError **error)
166 dbus_int32_t d_w, d_h;
173 _atspi_dbus_call (obj, atspi_interface_component, "GetSize", error, "=>ii", &d_w, &d_h);
180 * atspi_component_get_layer:
181 * @obj: a pointer to the #AtspiComponent to query.
183 * Query which layer the component is painted into, to help determine its
184 * visibility in terms of stacking order.
186 * Returns: the #AtspiComponentLayer into which this component is painted.
189 atspi_component_get_layer (AtspiComponent *obj, GError **error)
191 dbus_uint32_t zlayer = 0;
193 _atspi_dbus_call (obj, atspi_interface_component, "GetLayer", error, "=>u", &zlayer);
199 * atspi_component_get_mdi_z_order:
200 * @obj: a pointer to the #AtspiComponent to query.
202 * Query the z stacking order of a component which is in the MDI or window
203 * layer. (Bigger z-order numbers mean nearer the top)
205 * Returns: a short integer indicating the stacking order of the component
206 * in the MDI layer, or -1 if the component is not in the MDI layer.
209 atspi_component_get_mdi_z_order (AtspiComponent *obj, GError **error)
211 dbus_uint16_t retval = -1;
213 _atspi_dbus_call (obj, atspi_interface_component, "GetMDIZOrder", error, "=>n", &retval);
219 * atspi_component_grab_focus:
220 * @obj: a pointer to the #AtspiComponent on which to operate.
222 * Attempt to set the keyboard input focus to the specified
225 * Returns: #TRUE if successful, #FALSE otherwise.
229 atspi_component_grab_focus (AtspiComponent *obj, GError **error)
231 dbus_bool_t retval = FALSE;
233 _atspi_dbus_call (obj, atspi_interface_component, "GrabFocus", error, "=>b", &retval);
239 * atspi_component_get_alpha:
240 * @obj: The #AtspiComponent to be queried.
242 * Get the opacity/alpha value of a component, if alpha blending is in use.
244 * Returns: the opacity value of a component, as a double between 0.0 and 1.0.
247 atspi_component_get_alpha (AtspiComponent *obj, GError **error)
251 _atspi_dbus_call (obj, atspi_interface_component, "GetAlpha", error, "=>d", &retval);
257 atspi_component_base_init (AtspiComponentIface *klass)
259 static gboolean initialized = FALSE;
263 klass->contains = atspi_component_contains;
264 klass->ref_accessible_at_point = atspi_component_ref_accessible_at_point;
265 klass->get_extents = atspi_component_get_extents;
266 klass->get_position = atspi_component_get_position;
267 klass->get_size = atspi_component_get_size;
268 klass->get_layer = atspi_component_get_layer;
269 klass->get_mdi_z_order = atspi_component_get_mdi_z_order;
270 klass->grab_focus = atspi_component_grab_focus;
271 klass->get_alpha = atspi_component_get_alpha;
278 atspi_component_get_type (void)
280 static GType type = 0;
283 static const GTypeInfo tinfo =
285 sizeof (AtspiComponentIface),
286 (GBaseInitFunc) atspi_component_base_init,
287 (GBaseFinalizeFunc) NULL,
291 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiComponent", &tinfo, 0);