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.
7 * Copyright 2010, 2011 Novell, Inc.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
25 #include "atspi-private.h"
28 * atspi_selection_get_n_selected_children:
29 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
31 * Get the number of children of an #AtspiSelection implementor which are
34 * Returns: a #gint indicating the number of #Accessible children
35 * of the #AtspiSelection implementor which are currently selected.
39 atspi_selection_get_n_selected_children (AtspiSelection *obj, GError **error)
41 dbus_int32_t retval = -1;
43 g_return_val_if_fail (obj != NULL, -1);
45 _atspi_dbus_get_property (obj, atspi_interface_selection, "NSelectedChildren", error, "i", &retval);
51 * atspi_selection_get_selected_child:
52 * @obj: a pointer to the #AtspiSelection on which to operate.
53 * @selected_child_index: a #gint indicating which of the selected
54 * children is specified.
56 * Get the i-th selected #AtspiAccessible child of an #AtspiSelection.
57 * Note that @child_index refers to the index in the list of 'selected'
58 * children and generally differs from that used in
59 * #atspi_accessible_get_child_at_index() or returned by
60 * #atspi_accessible_get_index_in_parent(). @selected_child_index must lie between 0
61 * and #Atspi_selection_get_n_selected_children()-1, inclusive.
63 * Returns: (transfer full): a pointer to a selected #AtspiAccessible child
64 * object, specified by @child_index.
68 atspi_selection_get_selected_child (AtspiSelection *obj,
69 gint selected_child_index, GError **error)
71 dbus_int32_t d_selected_child_index = selected_child_index;
74 g_return_val_if_fail (obj != NULL, NULL);
76 reply = _atspi_dbus_call_partial (obj, atspi_interface_selection,
77 "GetSelectedChild", error, "i",
78 d_selected_child_index);
80 return _atspi_dbus_return_accessible_from_message (reply);
84 * atspi_selection_select_child:
85 * @obj: a pointer to the #AtspiSelection on which to operate.
86 * @child_index: a #gint indicating which child of the #Accessible
89 * Add a child to the selected children list of an #AtspiSelection.
90 * For #AtspiSelection implementors that only allow
91 * single selections, this may replace the (single) current
94 * Returns: #TRUE if the child was successfully selected, #FALSE otherwise.
97 atspi_selection_select_child (AtspiSelection *obj,
101 dbus_int32_t d_child_index = child_index;
102 dbus_bool_t retval = FALSE;
104 g_return_val_if_fail (obj != NULL, FALSE);
106 _atspi_dbus_call (obj, atspi_interface_selection, "SelectChild", error, "i=>b", &d_child_index, &retval);
112 * atspi_selection_deselect_selected_child:
113 * @obj: a pointer to the #AtspiSelection on which to operate.
114 * @selected_child_index: a #gint indicating which of the selected children
115 * of the #Accessible is to be selected.
117 * Remove a child to the selected children list of an #AtspiSelection.
118 * Note that @child_index is the index in the selected-children list,
119 * not the index in the parent container. @selectedChildIndex in this
120 * method, and @child_index in #atspi_selection_select_child
123 * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
126 atspi_selection_deselect_selected_child (AtspiSelection *obj,
127 gint selected_child_index,
130 dbus_int32_t d_selected_child_index = selected_child_index;
131 dbus_bool_t retval = FALSE;
133 g_return_val_if_fail (obj != NULL, FALSE);
135 _atspi_dbus_call (obj, atspi_interface_selection, "DeselectSelectedChild", error, "i=>b", d_selected_child_index, &retval);
141 * atspi_selection_deselect_child:
142 * @obj: a pointer to the #AtspiSelection on which to operate.
143 * @child_index: a #gint indicating which of the children
144 * of the #AtspiAccessible is to be de-selected.
146 * Deselect a specific child of an #AtspiSelection.
147 * Note that @child_index is the index of the child
148 * in the parent container.
150 * See #atspi_selection_deselect_selected_child
152 * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
155 atspi_selection_deselect_child (AtspiSelection *obj,
159 dbus_int32_t d_child_index = child_index;
160 dbus_bool_t retval = FALSE;
162 g_return_val_if_fail (obj != NULL, FALSE);
164 _atspi_dbus_call (obj, atspi_interface_selection, "DeselectChild", error, "i=>b", &d_child_index, &retval);
170 * atspi_selection_is_child_selected:
171 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
172 * @child_index: an index into the #AtspiSelection's list of children.
174 * Determine whether a particular child of an #AtspiSelection implementor
175 * is currently selected. Note that @child_index is the index into the
176 * standard #Accessible container's list of children.
178 * Returns: #TRUE if the specified child is currently selected,
182 atspi_selection_is_child_selected (AtspiSelection *obj,
186 dbus_int32_t d_child_index = child_index;
187 dbus_bool_t retval = FALSE;
189 g_return_val_if_fail (obj != NULL, FALSE);
191 _atspi_dbus_call (obj, atspi_interface_selection, "IsChildSelected", error, "i=>b", &d_child_index, &retval);
197 * atspi_selection_select_all:
198 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
200 * Attempt to select all of the children of an #AtspiSelection implementor.
201 * Not all #AtspiSelection implementors support this operation.
203 * Returns: #TRUE if successful, #FALSE otherwise.
207 atspi_selection_select_all (AtspiSelection *obj, GError **error)
209 dbus_bool_t retval = FALSE;
211 g_return_val_if_fail (obj != NULL, FALSE);
213 _atspi_dbus_call (obj, atspi_interface_selection, "SelectAll", error, "=>b", &retval);
219 * atspi_selection_clear_selection:
220 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
222 * Clear the current selection, removing all selected children from the
223 * specified #AtspiSelection implementor's selection list.
225 * Returns: #TRUE if successful, #FALSE otherwise.
229 atspi_selection_clear_selection (AtspiSelection *obj, GError **error)
231 dbus_bool_t retval = FALSE;
233 g_return_val_if_fail (obj != NULL, FALSE);
235 _atspi_dbus_call (obj, atspi_interface_selection, "ClearSelection", error, "=>b", &retval);
241 atspi_selection_base_init (AtspiSelection *klass)
246 atspi_selection_get_type (void)
248 static GType type = 0;
251 static const GTypeInfo tinfo =
253 sizeof (AtspiSelection),
254 (GBaseInitFunc) atspi_selection_base_init,
255 (GBaseFinalizeFunc) NULL,
258 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiSelection", &tinfo, 0);