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