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