fix tyop
[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 Sun Microsystems Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #include <cspi/spi-private.h>
24
25 /**
26  * AccessibleSelection_ref:
27  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
28  *
29  * Increment the reference count for an #AccessibleSelection object.
30  *
31  **/
32 void
33 AccessibleSelection_ref (AccessibleSelection *obj)
34 {
35   cspi_object_ref (obj);
36 }
37
38 /**
39  * AccessibleSelection_unref:
40  * @obj: a pointer to the #AccessibleSelection implementor on which to operate. 
41  *
42  * Decrement the reference count for an #Accessible object.
43  *
44  **/
45 void
46 AccessibleSelection_unref (AccessibleSelection *obj)
47 {
48   cspi_object_unref (obj);
49 }
50
51 /**
52  * AccessibleSelection_getNSelectedChildren:
53  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
54  *
55  * Get the number of children of an #AccessibleSelection implementor which are
56  *        currently selected.
57  *
58  * Returns: a #long indicating the number of #Accessible children
59  *        of the #AccessibleSelection implementor which are currently selected.
60  *
61  **/
62 long
63 AccessibleSelection_getNSelectedChildren (AccessibleSelection *obj)
64 {
65   long retval;
66
67   cspi_return_val_if_fail (obj != NULL, -1);
68
69   retval =
70     Accessibility_Selection__get_nSelectedChildren (CSPI_OBJREF (obj),
71                                                     cspi_ev ());
72
73   cspi_return_val_if_ev ("getNSelectedChildren", -1);
74
75   return retval;
76 }
77
78 /**
79  * AccessibleSelection_getSelectedChild:
80  * @obj: a pointer to the #AccessibleSelection on which to operate.
81  * @selectedChildIndex: a #long indicating which of the selected
82  *      children is specified.
83  *
84  * Get the i-th selected #Accessible child of an #AccessibleSelection.
85  *      Note that @childIndex refers to the index in the list of 'selected'
86  *      children and generally differs from that used in
87  *      #Accessible_getChildAtIndex() or returned by
88  *      #Accessible_getIndexInParent(). @selectedChildIndex must lie between 0
89  *      and #AccessibleSelection_getNSelectedChildren()-1, inclusive.
90  *
91  * Returns: a pointer to a selected #Accessible child object,
92  *          specified by @childIndex.
93  *
94  **/
95 Accessible *
96 AccessibleSelection_getSelectedChild (AccessibleSelection *obj,
97                                       long int selectedChildIndex)
98 {
99   Accessibility_Accessible child;
100
101   cspi_return_val_if_fail (obj != NULL, NULL);
102   
103   child = Accessibility_Selection_getSelectedChild (
104     CSPI_OBJREF (obj),
105     (CORBA_long) selectedChildIndex, cspi_ev ());
106
107   return (Accessible *) cspi_object_add (child);
108 }
109
110 /**
111  * AccessibleSelection_selectChild:
112  * @obj: a pointer to the #AccessibleSelection on which to operate.
113  * @childIndex: a #long indicating which child of the #Accessible
114  *              is to be selected.
115  *
116  * Add a child to the selected children list of an #AccessibleSelection.
117  *         For #AccessibleSelection implementors that only allow
118  *         single selections, this may replace the (single) current
119  *         selection.
120  *
121  * Returns: #TRUE if the child was successfully selected, #FALSE otherwise.
122  **/
123 SPIBoolean
124 AccessibleSelection_selectChild (AccessibleSelection *obj,
125                                  long int childIndex)
126 {
127   SPIBoolean retval;
128
129   cspi_return_val_if_fail (obj != NULL, FALSE);
130
131   retval =
132     Accessibility_Selection_selectChild (CSPI_OBJREF (obj),
133                                          (CORBA_long) childIndex, cspi_ev ());
134
135   cspi_return_val_if_ev ("selectChild", FALSE);
136
137   return retval;
138 }
139
140 /**
141  * AccessibleSelection_deselectSelectedChild:
142  * @obj: a pointer to the #AccessibleSelection on which to operate.
143  * @selectedChildIndex: a #long indicating which of the selected children
144  *              of the #Accessible is to be selected.
145  *
146  * Remove a child to the selected children list of an #AccessibleSelection.
147  *          Note that @childIndex is the index in the selected-children list,
148  *          not the index in the parent container.  @selectedChildIndex in this
149  *          method, and @childIndex in #AccessibleSelection_selectChild
150  *          are asymmettric.
151  *
152  * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
153  **/
154 SPIBoolean
155 AccessibleSelection_deselectSelectedChild (AccessibleSelection *obj,
156                                            long int selectedChildIndex)
157 {
158   SPIBoolean retval;
159
160   cspi_return_val_if_fail (obj != NULL, FALSE);
161
162   retval = Accessibility_Selection_deselectSelectedChild (
163     CSPI_OBJREF (obj), (CORBA_long) selectedChildIndex, cspi_ev ());
164
165   cspi_return_val_if_ev ("deselectSelectedChild", FALSE);
166
167   return retval;
168 }
169
170 /**
171  * AccessibleSelection_isChildSelected:
172  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
173  * @childIndex: an index into the #AccessibleSelection's list of children.
174  *
175  * Determine whether a particular child of an #AccessibleSelection implementor
176  *        is currently selected.  Note that @childIndex is the index into the
177  *        standard #Accessible container's list of children.
178  *
179  * Returns: #TRUE if the specified child is currently selected,
180  *          #FALSE otherwise.
181  **/
182 SPIBoolean
183 AccessibleSelection_isChildSelected (AccessibleSelection *obj,
184                                      long int childIndex)
185 {
186   SPIBoolean retval;
187
188   cspi_return_val_if_fail (obj != NULL, FALSE);
189
190   retval = Accessibility_Selection_isChildSelected (
191     CSPI_OBJREF (obj),
192     (CORBA_long) childIndex, cspi_ev ());
193
194   cspi_return_val_if_ev ("isChildSelected", FALSE);
195
196   return (SPIBoolean) retval;
197 }
198
199 /**
200  * AccessibleSelection_selectAll:
201  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
202  *
203  * Attempt to select all of the children of an #AccessibleSelection implementor.
204  * Not all #AccessibleSelection implementors support this operation.
205  *
206  * Returns: #TRUE if successful, #FALSE otherwise.
207  *
208  **/
209 SPIBoolean
210 AccessibleSelection_selectAll (AccessibleSelection *obj)
211 {
212   SPIBoolean retval;
213   
214   cspi_return_val_if_fail (obj != NULL, FALSE);
215
216   retval = Accessibility_Selection_selectAll (CSPI_OBJREF (obj), cspi_ev ());
217
218   cspi_return_val_if_ev ("selectAll", FALSE);
219
220   return retval;
221 }
222
223 /**
224  * AccessibleSelection_clearSelection:
225  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
226  *
227  * Clear the current selection, removing all selected children from the
228  *       specified #AccessibleSelection implementor's selection list.
229  *
230  * Returns: #TRUE if successful, #FALSE otherwise.
231  *
232  **/
233 SPIBoolean
234 AccessibleSelection_clearSelection (AccessibleSelection *obj)
235 {
236   SPIBoolean retval;
237   
238   cspi_return_val_if_fail (obj != NULL, FALSE);
239
240   retval = Accessibility_Selection_clearSelection (CSPI_OBJREF (obj), cspi_ev ());
241   cspi_return_val_if_ev ("clearSelection", FALSE);
242
243   return retval;
244 }
245
246