Added boolean return types for methods in Component, Selection,
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_editabletext.c
1 #include <cspi/spi-private.h>
2
3 /**
4  * AccessibleEditableText_ref:
5  * @obj: a pointer to the #AccessibleEditableText object on which to operate.
6  *
7  * Increment the reference count for an #AccessibleEditableText object.
8  *       Since AccessibleEditableText is derived from AccessibleText,
9  *       this is the same as AccessibleText_ref().
10  **/
11 void
12 AccessibleEditableText_ref (AccessibleEditableText *obj)
13 {
14   cspi_object_ref (obj);
15 }
16
17 /**
18  * AccessibleEditableText_unref:
19  * @obj: a pointer to the #AccessibleEditableText object on which to operate.
20  *
21  * Decrement the reference count for an #AccessibleEdiitableText object.
22  *       Since AccessibleEditableText is derived from AccessibleText,
23  *       this is the same as AccessibleText_unref().
24  **/
25 void
26 AccessibleEditableText_unref (AccessibleEditableText *obj)
27 {
28   cspi_object_unref (obj);
29 }
30
31 /**
32  * AccessibleEditableText_setAttributes:
33  * @obj: a pointer to the #AccessibleEditableText object to modify.
34  * @attributes: a character string indicating the attributes to apply to the range,
35  *        delimited by ':'.
36  * @startOffset: a #long indicating the start of the desired text range.
37  * @endOffset: a #long indicating the first character past the desired range.
38  *
39  * Set the attributes applied to a range of text from an #AccessibleEditableText
40  *          object, and the bounds of the range.
41  *
42  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
43  **/
44 SPIBoolean
45 AccessibleEditableText_setAttributes (AccessibleEditableText *obj,
46                                       const char *attributes,
47                                       long int startPos,
48                                       long int endPos)
49 {
50   SPIBoolean retval;
51
52   cspi_return_val_if_fail (obj != NULL, FALSE);
53
54   retval = 
55     Accessibility_EditableText_setAttributes (CSPI_OBJREF (obj),
56                                               (CORBA_char *) attributes,
57                                               (CORBA_long) startPos,
58                                               (CORBA_long) endPos, cspi_ev ());
59
60   cspi_return_val_if_ev ("setAttributes", FALSE);
61
62   return retval;
63 }
64
65 /**
66  * AccessibleEditableText_setTextContents:
67  * @obj: a pointer to the #AccessibleEditableText object to modify.
68  * @newContents: a character string, encoded in UTF-8, which is to
69  *      become the new text contents of the #AccessibleEditableText object.
70  *
71  * Replace the entire text contents of an #AccessibleEditableText object.
72  *
73  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
74  **/
75 SPIBoolean
76 AccessibleEditableText_setTextContents (AccessibleEditableText *obj,
77                                         const char *newContents)
78 {
79   SPIBoolean retval;
80
81   cspi_return_val_if_fail (obj != NULL, FALSE);
82
83   retval = Accessibility_EditableText_setTextContents (CSPI_OBJREF (obj),
84                                        (CORBA_char *) newContents, cspi_ev ());
85
86   cspi_return_val_if_ev ("setTextContents", FALSE);
87
88   return retval;
89 }
90
91 /**
92  * AccessibleEditableText_insertText:
93  * @obj: a pointer to the #AccessibleEditableText object to modify.
94  * @position: an integer indicating the character offset at which to insert
95  *       the new text.  
96  * @text: a char* pointer to the text to insert, in UTF-8 encoding.
97  * @length: (frankly I'm not sure this parameter should be here)
98  *
99  * Insert text into an #AccessibleEditableText object.
100  * As with all character offsets, the specified @position may not be the
101  *       same as the resulting byte offset, since the text is in a
102  *       variable-width encoding.
103  *
104  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
105  **/
106 SPIBoolean
107 AccessibleEditableText_insertText (AccessibleEditableText *obj,
108                                    long int position,
109                                    const char *text,
110                                    long int length)
111 {
112   SPIBoolean retval;
113
114   cspi_return_val_if_fail (obj != NULL, FALSE);
115
116   retval = Accessibility_EditableText_insertText (CSPI_OBJREF (obj),
117                                          (CORBA_long) position, (const CORBA_char *) text,
118                                          (CORBA_long) length, cspi_ev ());
119
120   cspi_return_val_if_ev ("insertText", FALSE);
121
122   return retval;
123 }
124
125 /**
126  * AccessibleEditableText_copyText:
127  * @obj: a pointer to the #AccessibleEditableText object to modify.
128  * @startPos: an integer indicating the starting character offset
129  *       of the text to copy.
130  * @endPos: an integer indicating the offset of the first character
131  *       past the end of the text section to be copied.
132  *
133  * Copy text from an #AccessibleEditableText object into the clipboard.
134  *
135  * @see: AccessibleEditableText_pasteText 
136  *
137  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
138  **/
139 SPIBoolean
140 AccessibleEditableText_copyText (AccessibleText *obj,
141                                  long int startPos,
142                                  long int endPos)
143 {
144   cspi_return_val_if_fail (obj != NULL, FALSE);
145
146   Accessibility_EditableText_copyText (
147     CSPI_OBJREF (obj), (CORBA_long) startPos,
148     (CORBA_long) endPos, cspi_ev ());
149
150   cspi_return_val_if_ev ("copyText", FALSE);
151
152   return TRUE;
153 }
154
155 /**
156  * AccessibleEditableText_cutText:
157  * @obj: a pointer to the #AccessibleEditableText object to modify.
158  * @startPos: an integer indicating the starting character offset
159  *       of the text to cut.
160  * @endPos: an integer indicating the offset of the first character
161  *       past the end of the text section to be cut.
162  *
163  * Delete text from an #AccessibleEditableText object, copying the
164  *       excised portion into the clipboard.
165  *
166  * @see: AccessibleEditableText_pasteText
167  *
168  * Returns: #TRUE if operation was successful, #FALSE otherwise.
169  **/
170 SPIBoolean
171 AccessibleEditableText_cutText (AccessibleEditableText *obj,
172                                 long int startPos,
173                                 long int endPos)
174 {
175   SPIBoolean retval;
176
177   cspi_return_val_if_fail (obj != NULL, FALSE);
178
179   retval = Accessibility_EditableText_cutText (
180     CSPI_OBJREF (obj),
181     (CORBA_long) startPos, (CORBA_long) endPos, cspi_ev ());
182
183   cspi_return_val_if_ev ("cutText", FALSE);
184
185   return retval;
186 }
187
188 /**
189  * AccessibleEditableText_deleteText:
190  * @obj: a pointer to the #AccessibleEditableText object to modify.
191  * @startPos: an integer indicating the starting character offset
192  *       of the text to delete.
193  * @endPos: an integer indicating the offset of the first character
194  *       past the end of the text section to be deleted.
195  *
196  * Delete text from an #AccessibleEditableText object, without copying the
197  *       excised portion into the clipboard.
198  *
199  * @see: AccessibleEditableText_cutText
200  *
201  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
202  **/
203 SPIBoolean
204 AccessibleEditableText_deleteText (AccessibleEditableText *obj,
205                                    long startPos,
206                                    long endPos)
207 {
208   SPIBoolean retval;
209
210   cspi_return_val_if_fail (obj != NULL, FALSE);
211
212   retval = Accessibility_EditableText_deleteText (
213     CSPI_OBJREF (obj),
214     (CORBA_long) startPos, (CORBA_long) endPos, cspi_ev ());
215
216   cspi_return_val_if_ev ("deleteText", FALSE);
217
218   return retval;
219 }
220
221 /**
222  * AccessibleEditableText_pasteText:
223  * @obj: a pointer to the #AccessibleEditableText object to modify.
224  * @position: an integer indicating the character offset at which to insert
225  *       the new text.  
226  *
227  * Insert text from the clipboard into an #AccessibleEditableText object.
228  * As with all character offsets, the specified @position may not be the
229  *       same as the resulting byte offset, since the text is in a
230  *       variable-width encoding.
231  *
232  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
233  **/
234 SPIBoolean
235 AccessibleEditableText_pasteText (AccessibleEditableText *obj,
236                                   long int position)
237 {
238   SPIBoolean retval;
239
240   cspi_return_val_if_fail (obj != NULL, FALSE);
241
242   retval = Accessibility_EditableText_pasteText (
243     CSPI_OBJREF (obj), (CORBA_long) position, cspi_ev ());
244
245   cspi_return_val_if_ev ("pasteText", FALSE);
246
247   return retval;
248 }