*** empty log message ***
[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_isChildSelected:
173  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
174  * @childIndex: an index into the #AccessibleSelection's list of children.
175  *
176  * Determine whether a particular child of an #AccessibleSelection implementor
177  *        is currently selected.  Note that @childIndex is the index into the
178  *        standard #Accessible container's list of children.
179  *
180  * Returns: #TRUE if the specified child is currently selected,
181  *          #FALSE otherwise.
182  **/
183 SPIBoolean
184 AccessibleSelection_isChildSelected (AccessibleSelection *obj,
185                                      long int childIndex)
186 {
187   SPIBoolean retval;
188
189   cspi_return_val_if_fail (obj != NULL, FALSE);
190
191   retval = Accessibility_Selection_isChildSelected (
192     CSPI_OBJREF (obj),
193     childIndex, cspi_ev ());
194
195   cspi_return_val_if_ev ("isChildSelected", FALSE);
196
197   return retval;
198 }
199
200 /**
201  * AccessibleSelection_selectAll:
202  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
203  *
204  * Attempt to select all of the children of an #AccessibleSelection implementor.
205  * Not all #AccessibleSelection implementors support this operation.
206  *
207  * Returns: #TRUE if successful, #FALSE otherwise.
208  *
209  **/
210 SPIBoolean
211 AccessibleSelection_selectAll (AccessibleSelection *obj)
212 {
213   SPIBoolean retval;
214   
215   cspi_return_val_if_fail (obj != NULL, FALSE);
216
217   retval = Accessibility_Selection_selectAll (CSPI_OBJREF (obj), cspi_ev ());
218
219   cspi_return_val_if_ev ("selectAll", FALSE);
220
221   return retval;
222 }
223
224 /**
225  * AccessibleSelection_clearSelection:
226  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
227  *
228  * Clear the current selection, removing all selected children from the
229  *       specified #AccessibleSelection implementor's selection list.
230  *
231  * Returns: #TRUE if successful, #FALSE otherwise.
232  *
233  **/
234 SPIBoolean
235 AccessibleSelection_clearSelection (AccessibleSelection *obj)
236 {
237   SPIBoolean retval;
238   
239   cspi_return_val_if_fail (obj != NULL, FALSE);
240
241   retval = Accessibility_Selection_clearSelection (CSPI_OBJREF (obj), cspi_ev ());
242   cspi_return_val_if_ev ("clearSelection", FALSE);
243
244   return retval;
245 }
246
247