Changes to introspection generation to remove DOCTYPE and XML
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_selection.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
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.
12  *
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.
17  *
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.
22  */
23
24 #include <cspi/spi-private.h>
25
26 /**
27  * AccessibleSelection_ref:
28  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
29  *
30  * Increment the reference count for an #AccessibleSelection object.
31  *
32  **/
33 void
34 AccessibleSelection_ref (AccessibleSelection *obj)
35 {
36   cspi_object_ref (obj);
37 }
38
39 /**
40  * AccessibleSelection_unref:
41  * @obj: a pointer to the #AccessibleSelection implementor on which to operate. 
42  *
43  * Decrement the reference count for an #Accessible object.
44  *
45  **/
46 void
47 AccessibleSelection_unref (AccessibleSelection *obj)
48 {
49   cspi_object_unref (obj);
50 }
51
52 /**
53  * AccessibleSelection_getNSelectedChildren:
54  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
55  *
56  * Get the number of children of an #AccessibleSelection implementor which are
57  *        currently selected.
58  *
59  * Returns: a #long indicating the number of #Accessible children
60  *        of the #AccessibleSelection implementor which are currently selected.
61  *
62  **/
63 long
64 AccessibleSelection_getNSelectedChildren (AccessibleSelection *obj)
65 {
66   long retval;
67
68   cspi_return_val_if_fail (obj != NULL, -1);
69
70   retval =
71     Accessibility_Selection__get_nSelectedChildren (CSPI_OBJREF (obj),
72                                                     cspi_ev ());
73
74   cspi_return_val_if_ev ("getNSelectedChildren", -1);
75
76   return retval;
77 }
78
79 /**
80  * AccessibleSelection_getSelectedChild:
81  * @obj: a pointer to the #AccessibleSelection on which to operate.
82  * @selectedChildIndex: a #long indicating which of the selected
83  *      children is specified.
84  *
85  * Get the i-th selected #Accessible child of an #AccessibleSelection.
86  *      Note that @childIndex refers to the index in the list of 'selected'
87  *      children and generally differs from that used in
88  *      #Accessible_getChildAtIndex() or returned by
89  *      #Accessible_getIndexInParent(). @selectedChildIndex must lie between 0
90  *      and #AccessibleSelection_getNSelectedChildren()-1, inclusive.
91  *
92  * Returns: a pointer to a selected #Accessible child object,
93  *          specified by @childIndex.
94  *
95  **/
96 Accessible *
97 AccessibleSelection_getSelectedChild (AccessibleSelection *obj,
98                                       long int selectedChildIndex)
99 {
100   Accessibility_Accessible child;
101
102   cspi_return_val_if_fail (obj != NULL, NULL);
103   
104   child = Accessibility_Selection_getSelectedChild (
105     CSPI_OBJREF (obj),
106     selectedChildIndex, cspi_ev ());
107
108   return  cspi_object_add (child);
109 }
110
111 /**
112  * AccessibleSelection_selectChild:
113  * @obj: a pointer to the #AccessibleSelection on which to operate.
114  * @childIndex: a #long indicating which child of the #Accessible
115  *              is to be selected.
116  *
117  * Add a child to the selected children list of an #AccessibleSelection.
118  *         For #AccessibleSelection implementors that only allow
119  *         single selections, this may replace the (single) current
120  *         selection.
121  *
122  * Returns: #TRUE if the child was successfully selected, #FALSE otherwise.
123  **/
124 SPIBoolean
125 AccessibleSelection_selectChild (AccessibleSelection *obj,
126                                  long int childIndex)
127 {
128   SPIBoolean retval;
129
130   cspi_return_val_if_fail (obj != NULL, FALSE);
131
132   retval =
133     Accessibility_Selection_selectChild (CSPI_OBJREF (obj),
134                                          childIndex, cspi_ev ());
135
136   cspi_return_val_if_ev ("selectChild", FALSE);
137
138   return retval;
139 }
140
141 /**
142  * AccessibleSelection_deselectSelectedChild:
143  * @obj: a pointer to the #AccessibleSelection on which to operate.
144  * @selectedChildIndex: a #long indicating which of the selected children
145  *              of the #Accessible is to be selected.
146  *
147  * Remove a child to the selected children list of an #AccessibleSelection.
148  *          Note that @childIndex is the index in the selected-children list,
149  *          not the index in the parent container.  @selectedChildIndex in this
150  *          method, and @childIndex in #AccessibleSelection_selectChild
151  *          are asymmettric.
152  *
153  * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
154  **/
155 SPIBoolean
156 AccessibleSelection_deselectSelectedChild (AccessibleSelection *obj,
157                                            long int selectedChildIndex)
158 {
159   SPIBoolean retval;
160
161   cspi_return_val_if_fail (obj != NULL, FALSE);
162
163   retval = Accessibility_Selection_deselectSelectedChild (
164     CSPI_OBJREF (obj), selectedChildIndex, cspi_ev ());
165
166   cspi_return_val_if_ev ("deselectSelectedChild", FALSE);
167
168   return retval;
169 }
170
171 /**
172  * AccessibleSelection_deselectChild:
173  * @obj: a pointer to the #AccessibleSelection on which to operate.
174  * @childIndex: a #long indicating which of the children
175  *              of the #Accessible is to be de-selected.
176  *
177  * Deselect a specific child of an #AccessibleSelection.
178  *          Note that @childIndex is the index of the child
179  *          in the parent container.
180  * 
181  * See #AccessibleSelection_deselectSelectedChild
182  *
183  * Since AT-SPI 1.8.0
184  * 
185  * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
186  **/
187 SPIBoolean
188 AccessibleSelection_deselectChild (AccessibleSelection *obj,
189                                    long int childIndex)
190 {
191   SPIBoolean retval;
192
193   cspi_return_val_if_fail (obj != NULL, FALSE);
194
195   retval = Accessibility_Selection_deselectChild (
196     CSPI_OBJREF (obj), childIndex, cspi_ev ());
197
198   cspi_return_val_if_ev ("deselectChild", FALSE);
199
200   return retval;
201 }
202
203 /**
204  * AccessibleSelection_isChildSelected:
205  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
206  * @childIndex: an index into the #AccessibleSelection's list of children.
207  *
208  * Determine whether a particular child of an #AccessibleSelection implementor
209  *        is currently selected.  Note that @childIndex is the index into the
210  *        standard #Accessible container's list of children.
211  *
212  * Returns: #TRUE if the specified child is currently selected,
213  *          #FALSE otherwise.
214  **/
215 SPIBoolean
216 AccessibleSelection_isChildSelected (AccessibleSelection *obj,
217                                      long int childIndex)
218 {
219   SPIBoolean retval;
220
221   cspi_return_val_if_fail (obj != NULL, FALSE);
222
223   retval = Accessibility_Selection_isChildSelected (
224     CSPI_OBJREF (obj),
225     childIndex, cspi_ev ());
226
227   cspi_return_val_if_ev ("isChildSelected", FALSE);
228
229   return retval;
230 }
231
232 /**
233  * AccessibleSelection_selectAll:
234  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
235  *
236  * Attempt to select all of the children of an #AccessibleSelection implementor.
237  * Not all #AccessibleSelection implementors support this operation.
238  *
239  * Returns: #TRUE if successful, #FALSE otherwise.
240  *
241  **/
242 SPIBoolean
243 AccessibleSelection_selectAll (AccessibleSelection *obj)
244 {
245   SPIBoolean retval;
246   
247   cspi_return_val_if_fail (obj != NULL, FALSE);
248
249   retval = Accessibility_Selection_selectAll (CSPI_OBJREF (obj), cspi_ev ());
250
251   cspi_return_val_if_ev ("selectAll", FALSE);
252
253   return retval;
254 }
255
256 /**
257  * AccessibleSelection_clearSelection:
258  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
259  *
260  * Clear the current selection, removing all selected children from the
261  *       specified #AccessibleSelection implementor's selection list.
262  *
263  * Returns: #TRUE if successful, #FALSE otherwise.
264  *
265  **/
266 SPIBoolean
267 AccessibleSelection_clearSelection (AccessibleSelection *obj)
268 {
269   SPIBoolean retval;
270   
271   cspi_return_val_if_fail (obj != NULL, FALSE);
272
273   retval = Accessibility_Selection_clearSelection (CSPI_OBJREF (obj), cspi_ev ());
274   cspi_return_val_if_ev ("clearSelection", FALSE);
275
276   return retval;
277 }
278
279