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.
24 #include "atspi-private.h"
27 * atspi_selection_get_n_selected_children:
28 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
30 * Get the number of children of an #AtspiSelection implementor which are
33 * Returns: a #gint indicating the number of #Accessible children
34 * of the #AtspiSelection implementor which are currently selected.
38 atspi_selection_get_n_selected_children (AtspiSelection *obj, GError **error)
40 dbus_int32_t retval = -1;
42 g_return_val_if_fail (obj != NULL, -1);
44 _atspi_dbus_get_property (obj, atspi_interface_selection, "nSelectedChildren", error, "i", &retval);
50 * atspi_selection_get_selected_child:
51 * @obj: a pointer to the #AtspiSelection on which to operate.
52 * @selected_child_index: a #gint indicating which of the selected
53 * children is specified.
55 * Get the i-th selected #AtspiAccessible child of an #AtspiSelection.
56 * Note that @child_index refers to the index in the list of 'selected'
57 * children and generally differs from that used in
58 * #atspi_accessible_get_child_at_index() or returned by
59 * #atspi_accessible_get_index_in_parent(). @selected_child_index must lie between 0
60 * and #Atspi_selection_get_n_selected_children()-1, inclusive.
62 * Returns: (transfer full): a pointer to a selected #AtspiAccessible child
63 * object, specified by @child_index.
67 atspi_selection_get_selected_child (AtspiSelection *obj,
68 gint selected_child_index, GError **error)
70 dbus_int32_t d_selected_child_index = selected_child_index;
71 AtspiAccessible *child = NULL;
73 g_return_val_if_fail (obj != NULL, NULL);
75 _atspi_dbus_call (obj, atspi_interface_selection, "GetSelectedChild", error, "i=>(so)", &d_selected_child_index, &child);
81 * atspi_selection_select_child:
82 * @obj: a pointer to the #AtspiSelection on which to operate.
83 * @child_index: a #gint indicating which child of the #Accessible
86 * Add a child to the selected children list of an #AtspiSelection.
87 * For #AtspiSelection implementors that only allow
88 * single selections, this may replace the (single) current
91 * Returns: #TRUE if the child was successfully selected, #FALSE otherwise.
94 atspi_selection_select_child (AtspiSelection *obj,
98 dbus_int32_t d_child_index = child_index;
99 dbus_bool_t retval = FALSE;
101 g_return_val_if_fail (obj != NULL, FALSE);
103 _atspi_dbus_call (obj, atspi_interface_selection, "SelectChild", error, "i=>b", &d_child_index, &retval);
109 * atspi_selection_deselect_selected_child:
110 * @obj: a pointer to the #AtspiSelection on which to operate.
111 * @selected_child_index: a #gint indicating which of the selected children
112 * of the #Accessible is to be selected.
114 * Remove a child to the selected children list of an #AtspiSelection.
115 * Note that @child_index is the index in the selected-children list,
116 * not the index in the parent container. @selectedChildIndex in this
117 * method, and @child_index in #atspi_selection_select_child
120 * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
123 atspi_selection_deselect_selected_child (AtspiSelection *obj,
124 gint selected_child_index,
127 dbus_int32_t d_selected_child_index = selected_child_index;
128 dbus_bool_t retval = FALSE;
130 g_return_val_if_fail (obj != NULL, FALSE);
132 _atspi_dbus_call (obj, atspi_interface_selection, "DeselectSelectedChild", error, "i=>b", d_selected_child_index, &retval);
138 * atspi_selection_deselect_child:
139 * @obj: a pointer to the #AtspiSelection on which to operate.
140 * @child_index: a #gint indicating which of the children
141 * of the #AtspiAccessible is to be de-selected.
143 * Deselect a specific child of an #AtspiSelection.
144 * Note that @child_index is the index of the child
145 * in the parent container.
147 * See #atspi_selection_deselect_selected_child
149 * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
152 atspi_selection_deselect_child (AtspiSelection *obj,
156 dbus_int32_t d_child_index = child_index;
157 dbus_bool_t retval = FALSE;
159 g_return_val_if_fail (obj != NULL, FALSE);
161 _atspi_dbus_call (obj, atspi_interface_selection, "DeselectChild", error, "i=>b", &d_child_index, &retval);
167 * atspi_selection_is_child_selected:
168 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
169 * @child_index: an index into the #AtspiSelection's list of children.
171 * Determine whether a particular child of an #AtspiSelection implementor
172 * is currently selected. Note that @child_index is the index into the
173 * standard #Accessible container's list of children.
175 * Returns: #TRUE if the specified child is currently selected,
179 atspi_selection_is_child_selected (AtspiSelection *obj,
183 dbus_int32_t d_child_index = child_index;
184 dbus_bool_t retval = FALSE;
186 g_return_val_if_fail (obj != NULL, FALSE);
188 _atspi_dbus_call (obj, atspi_interface_selection, "IsChildSelected", error, "i=>b", &d_child_index, &retval);
194 * atspi_selection_select_all:
195 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
197 * Attempt to select all of the children of an #AtspiSelection implementor.
198 * Not all #AtspiSelection implementors support this operation.
200 * Returns: #TRUE if successful, #FALSE otherwise.
204 atspi_selection_select_all (AtspiSelection *obj, GError **error)
206 dbus_bool_t retval = FALSE;
208 g_return_val_if_fail (obj != NULL, FALSE);
210 _atspi_dbus_call (obj, atspi_interface_selection, "SelectAll", error, "=>b", &retval);
216 * atspi_selection_clear_selection:
217 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
219 * Clear the current selection, removing all selected children from the
220 * specified #AtspiSelection implementor's selection list.
222 * Returns: #TRUE if successful, #FALSE otherwise.
226 atspi_selection_clear_selection (AtspiSelection *obj, GError **error)
228 dbus_bool_t retval = FALSE;
230 g_return_val_if_fail (obj != NULL, FALSE);
232 _atspi_dbus_call (obj, atspi_interface_selection, "ClearSelection", error, "=>b", &retval);
238 atspi_selection_base_init (AtspiSelection *klass)
243 atspi_selection_get_type (void)
245 static GType type = 0;
248 static const GTypeInfo tinfo =
250 sizeof (AtspiSelection),
251 (GBaseInitFunc) atspi_selection_base_init,
252 (GBaseFinalizeFunc) NULL,
255 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiSelection", &tinfo, 0);