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 * Gets 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 * Gets the i-th selected #AtspiAccessible child of an #AtspiSelection.
57 * Note that @selected_child_index refers to the index in the list
59 * children and generally differs from that used in
60 * #atspi_accessible_get_child_at_index or returned by
61 * #atspi_accessible_get_index_in_parent.
62 * @selected_child_index must lie between 0
63 * and #atspi_selection_get_n_selected_children - 1, inclusive.
65 * Returns: (transfer full): a pointer to a selected #AtspiAccessible child
66 * object, specified by @selected_child_index.
70 atspi_selection_get_selected_child (AtspiSelection *obj,
71 gint selected_child_index, GError **error)
73 dbus_int32_t d_selected_child_index = selected_child_index;
76 g_return_val_if_fail (obj != NULL, NULL);
78 reply = _atspi_dbus_call_partial (obj, atspi_interface_selection,
79 "GetSelectedChild", error, "i",
80 d_selected_child_index);
82 return _atspi_dbus_return_accessible_from_message (reply);
86 * atspi_selection_select_child:
87 * @obj: a pointer to the #AtspiSelection on which to operate.
88 * @child_index: a #gint indicating which child of the #Accessible
91 * Adds a child to the selected children list of an #AtspiSelection.
92 * For #AtspiSelection implementors that only allow
93 * single selections, this may replace the (single) current
96 * Returns: #TRUE if the child was successfully selected, #FALSE otherwise.
99 atspi_selection_select_child (AtspiSelection *obj,
103 dbus_int32_t d_child_index = child_index;
104 dbus_bool_t retval = FALSE;
106 g_return_val_if_fail (obj != NULL, FALSE);
108 _atspi_dbus_call (obj, atspi_interface_selection, "SelectChild", error, "i=>b", d_child_index, &retval);
114 * atspi_selection_deselect_selected_child:
115 * @obj: a pointer to the #AtspiSelection on which to operate.
116 * @selected_child_index: a #gint indicating which of the selected children
117 * of the #Accessible is to be selected.
119 * Removes a child from the selected children list of an #AtspiSelection.
120 * Note that @child_index is the index in the selected-children list,
121 * not the index in the parent container. @selectedChildIndex in this
122 * method, and @child_index in #atspi_selection_select_child
125 * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
128 atspi_selection_deselect_selected_child (AtspiSelection *obj,
129 gint selected_child_index,
132 dbus_int32_t d_selected_child_index = selected_child_index;
133 dbus_bool_t retval = FALSE;
135 g_return_val_if_fail (obj != NULL, FALSE);
137 _atspi_dbus_call (obj, atspi_interface_selection, "DeselectSelectedChild", error, "i=>b", d_selected_child_index, &retval);
143 * atspi_selection_deselect_child:
144 * @obj: a pointer to the #AtspiSelection on which to operate.
145 * @child_index: a #gint indicating which of the children
146 * of the #AtspiAccessible is to be de-selected.
148 * Deselects a specific child of an #AtspiSelection.
149 * Note that @child_index is the index of the child
150 * in the parent container.
152 * See #atspi_selection_deselect_selected_child
154 * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
157 atspi_selection_deselect_child (AtspiSelection *obj,
161 dbus_int32_t d_child_index = child_index;
162 dbus_bool_t retval = FALSE;
164 g_return_val_if_fail (obj != NULL, FALSE);
166 _atspi_dbus_call (obj, atspi_interface_selection, "DeselectChild", error, "i=>b", d_child_index, &retval);
172 * atspi_selection_is_child_selected:
173 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
174 * @child_index: an index into the #AtspiSelection's list of children.
176 * Determines whether a particular child of an #AtspiSelection implementor
177 * is currently selected. Note that @child_index is the index into the
178 * standard #AtspiAccessible container's list of children.
180 * Returns: #TRUE if the specified child is currently selected,
184 atspi_selection_is_child_selected (AtspiSelection *obj,
188 dbus_int32_t d_child_index = child_index;
189 dbus_bool_t retval = FALSE;
191 g_return_val_if_fail (obj != NULL, FALSE);
193 _atspi_dbus_call (obj, atspi_interface_selection, "IsChildSelected", error, "i=>b", d_child_index, &retval);
199 * atspi_selection_select_all:
200 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
202 * Attempts to select all of the children of an #AtspiSelection implementor.
203 * Not all #AtspiSelection implementors support this operation.
205 * Returns: #TRUE if successful, #FALSE otherwise.
209 atspi_selection_select_all (AtspiSelection *obj, GError **error)
211 dbus_bool_t retval = FALSE;
213 g_return_val_if_fail (obj != NULL, FALSE);
215 _atspi_dbus_call (obj, atspi_interface_selection, "SelectAll", error, "=>b", &retval);
221 * atspi_selection_clear_selection:
222 * @obj: a pointer to the #AtspiSelection implementor on which to operate.
224 * Clears the current selection, removing all selected children from the
225 * specified #AtspiSelection implementor's selection list.
227 * Returns: #TRUE if successful, #FALSE otherwise.
231 atspi_selection_clear_selection (AtspiSelection *obj, GError **error)
233 dbus_bool_t retval = FALSE;
235 g_return_val_if_fail (obj != NULL, FALSE);
237 _atspi_dbus_call (obj, atspi_interface_selection, "ClearSelection", error, "=>b", &retval);
243 atspi_selection_base_init (AtspiSelection *klass)
248 atspi_selection_get_type (void)
250 static GType type = 0;
253 static const GTypeInfo tinfo =
255 sizeof (AtspiSelection),
256 (GBaseInitFunc) atspi_selection_base_init,
257 (GBaseFinalizeFunc) NULL,
260 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiSelection", &tinfo, 0);