d66d5cd9098d81a793f812b9c5b07bf244c6ec57
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_selection.c
1 #include <cspi/spi-private.h>
2
3 /**
4  * AccessibleSelection_ref:
5  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
6  *
7  * Increment the reference count for an #AccessibleSelection object.
8  *
9  **/
10 void
11 AccessibleSelection_ref (AccessibleSelection *obj)
12 {
13   cspi_object_ref (obj);
14 }
15
16 /**
17  * AccessibleSelection_unref:
18  * @obj: a pointer to the #AccessibleSelection implementor on which to operate. 
19  *
20  * Decrement the reference count for an #Accessible object.
21  *
22  **/
23 void
24 AccessibleSelection_unref (AccessibleSelection *obj)
25 {
26   cspi_object_unref (obj);
27 }
28
29 /**
30  * AccessibleSelection_getNSelectedChildren:
31  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
32  *
33  * Get the number of children of an #AccessibleSelection implementor which are
34  *        currently selected.
35  *
36  * Returns: a #long indicating the number of #Accessible children
37  *        of the #AccessibleSelection implementor which are currently selected.
38  *
39  **/
40 long
41 AccessibleSelection_getNSelectedChildren (AccessibleSelection *obj)
42 {
43   long retval;
44
45   cspi_return_val_if_fail (obj != NULL, -1);
46
47   retval =
48     Accessibility_Selection__get_nSelectedChildren (CSPI_OBJREF (obj),
49                                                     cspi_ev ());
50
51   cspi_return_val_if_ev ("getNSelectedChildren", -1);
52
53   return retval;
54 }
55
56 /**
57  * AccessibleSelection_getSelectedChild:
58  * @obj: a pointer to the #AccessibleSelection on which to operate.
59  * @selectedChildIndex: a #long indicating which of the selected
60  *      children is specified.
61  *
62  * Get the i-th selected #Accessible child of an #AccessibleSelection.
63  *      Note that @childIndex refers to the index in the list of 'selected'
64  *      children and generally differs from that used in
65  *      #Accessible_getChildAtIndex() or returned by
66  *      #Accessible_getIndexInParent(). @selectedChildIndex must lie between 0
67  *      and #AccessibleSelection_getNSelectedChildren()-1, inclusive.
68  *
69  * Returns: a pointer to a selected #Accessible child object,
70  *          specified by @childIndex.
71  *
72  **/
73 Accessible *
74 AccessibleSelection_getSelectedChild (AccessibleSelection *obj,
75                                       long int selectedChildIndex)
76 {
77   Accessibility_Accessible child;
78
79   cspi_return_val_if_fail (obj != NULL, NULL);
80   
81   child = Accessibility_Selection_getSelectedChild (
82     CSPI_OBJREF (obj),
83     (CORBA_long) selectedChildIndex, cspi_ev ());
84
85   return (Accessible *) cspi_object_add (child);
86 }
87
88 /**
89  * AccessibleSelection_selectChild:
90  * @obj: a pointer to the #AccessibleSelection on which to operate.
91  * @childIndex: a #long indicating which child of the #Accessible
92  *              is to be selected.
93  *
94  * Add a child to the selected children list of an #AccessibleSelection.
95  *         For #AccessibleSelection implementors that only allow
96  *         single selections, this may replace the (single) current
97  *         selection.
98  *
99  * Returns: #TRUE if the child was successfully selected, #FALSE otherwise.
100  **/
101 SPIBoolean
102 AccessibleSelection_selectChild (AccessibleSelection *obj,
103                                  long int childIndex)
104 {
105   SPIBoolean retval;
106
107   cspi_return_val_if_fail (obj != NULL, FALSE);
108
109   retval =
110     Accessibility_Selection_selectChild (CSPI_OBJREF (obj),
111                                          (CORBA_long) childIndex, cspi_ev ());
112
113   cspi_return_val_if_ev ("selectChild", FALSE);
114
115   return retval;
116 }
117
118 /**
119  * AccessibleSelection_deselectSelectedChild:
120  * @obj: a pointer to the #AccessibleSelection on which to operate.
121  * @selectedChildIndex: a #long indicating which of the selected children
122  *              of the #Accessible is to be selected.
123  *
124  * Remove a child to the selected children list of an #AccessibleSelection.
125  *          Note that @childIndex is the index in the selected-children list,
126  *          not the index in the parent container.  @selectedChildIndex in this
127  *          method, and @childIndex in #AccessibleSelection_selectChild
128  *          are asymmettric.
129  *
130  * Returns: #TRUE if the child was successfully deselected, #FALSE otherwise.
131  **/
132 SPIBoolean
133 AccessibleSelection_deselectSelectedChild (AccessibleSelection *obj,
134                                            long int selectedChildIndex)
135 {
136   SPIBoolean retval;
137
138   cspi_return_val_if_fail (obj != NULL, FALSE);
139
140   retval = Accessibility_Selection_deselectSelectedChild (
141     CSPI_OBJREF (obj), (CORBA_long) selectedChildIndex, cspi_ev ());
142
143   cspi_return_val_if_ev ("deselectSelectedChild", FALSE);
144
145   return retval;
146 }
147
148 /**
149  * AccessibleSelection_isChildSelected:
150  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
151  * @childIndex: an index into the #AccessibleSelection's list of children.
152  *
153  * Determine whether a particular child of an #AccessibleSelection implementor
154  *        is currently selected.  Note that @childIndex is the index into the
155  *        standard #Accessible container's list of children.
156  *
157  * Returns: #TRUE if the specified child is currently selected,
158  *          #FALSE otherwise.
159  **/
160 SPIBoolean
161 AccessibleSelection_isChildSelected (AccessibleSelection *obj,
162                                      long int childIndex)
163 {
164   SPIBoolean retval;
165
166   cspi_return_val_if_fail (obj != NULL, FALSE);
167
168   retval = Accessibility_Selection_isChildSelected (
169     CSPI_OBJREF (obj),
170     (CORBA_long) childIndex, cspi_ev ());
171
172   cspi_return_val_if_ev ("isChildSelected", FALSE);
173
174   return (SPIBoolean) retval;
175 }
176
177 /**
178  * AccessibleSelection_selectAll:
179  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
180  *
181  * Attempt to select all of the children of an #AccessibleSelection implementor.
182  * Not all #AccessibleSelection implementors support this operation.
183  *
184  * Returns: #TRUE if successful, #FALSE otherwise.
185  *
186  **/
187 SPIBoolean
188 AccessibleSelection_selectAll (AccessibleSelection *obj)
189 {
190   cspi_return_val_if_fail (obj != NULL, FALSE);
191
192   Accessibility_Selection_selectAll (CSPI_OBJREF (obj), cspi_ev ());
193
194   cspi_check_ev ("selectAll");
195
196   return TRUE; /* TODO: change the CORBA method to return SPIBoolean */
197 }
198
199 /**
200  * AccessibleSelection_clearSelection:
201  * @obj: a pointer to the #AccessibleSelection implementor on which to operate.
202  *
203  * Clear the current selection, removing all selected children from the
204  *       specified #AccessibleSelection implementor's selection list.
205  **/
206 void
207 AccessibleSelection_clearSelection (AccessibleSelection *obj)
208 {
209   cspi_return_if_fail (obj != NULL);
210
211   Accessibility_Selection_clearSelection (CSPI_OBJREF (obj), cspi_ev ());
212   cspi_check_ev ("clearSelection");
213 }
214
215