2001-12-10 Michael Meeks <michael@ximian.com>
[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   cspi_return_val_if_fail (obj != NULL, FALSE);
80
81   Accessibility_EditableText_setTextContents (CSPI_OBJREF (obj),
82                                               (CORBA_char *) newContents, cspi_ev ());
83
84   cspi_return_val_if_ev ("setTextContents", FALSE);
85
86   return TRUE;
87 }
88
89 /**
90  * AccessibleEditableText_insertText:
91  * @obj: a pointer to the #AccessibleEditableText object to modify.
92  * @position: an integer indicating the character offset at which to insert
93  *       the new text.  
94  * @text: a char* pointer to the text to insert, in UTF-8 encoding.
95  * @length: (frankly I'm not sure this parameter should be here)
96  *
97  * Insert text into an #AccessibleEditableText object.
98  * As with all character offsets, the specified @position may not be the
99  *       same as the resulting byte offset, since the text is in a
100  *       variable-width encoding.
101  *
102  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
103  **/
104 SPIBoolean
105 AccessibleEditableText_insertText (AccessibleEditableText *obj,
106                                    long int position,
107                                    const char *text,
108                                    long int length)
109 {
110   cspi_return_val_if_fail (obj != NULL, FALSE);
111
112   Accessibility_EditableText_insertText (CSPI_OBJREF (obj),
113                                          (CORBA_long) position, (const CORBA_char *) text,
114                                          (CORBA_long) length, cspi_ev ());
115
116   cspi_return_val_if_ev ("insertText", FALSE);
117
118   return TRUE;
119 }
120
121 /**
122  * AccessibleEditableText_copyText:
123  * @obj: a pointer to the #AccessibleEditableText object to modify.
124  * @startPos: an integer indicating the starting character offset
125  *       of the text to copy.
126  * @endPos: an integer indicating the offset of the first character
127  *       past the end of the text section to be copied.
128  *
129  * Copy text from an #AccessibleEditableText object into the clipboard.
130  *
131  * @see: AccessibleEditableText_pasteText 
132  *
133  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
134  **/
135 SPIBoolean
136 AccessibleEditableText_copyText (AccessibleText *obj,
137                                  long int startPos,
138                                  long int endPos)
139 {
140   cspi_return_val_if_fail (obj != NULL, FALSE);
141
142   Accessibility_EditableText_copyText (
143     CSPI_OBJREF (obj), (CORBA_long) startPos,
144     (CORBA_long) endPos, cspi_ev ());
145
146   cspi_return_val_if_ev ("copyText", FALSE);
147
148   return TRUE;
149 }
150
151 /**
152  * AccessibleEditableText_cutText:
153  * @obj: a pointer to the #AccessibleEditableText object to modify.
154  * @startPos: an integer indicating the starting character offset
155  *       of the text to cut.
156  * @endPos: an integer indicating the offset of the first character
157  *       past the end of the text section to be cut.
158  *
159  * Delete text from an #AccessibleEditableText object, copying the
160  *       excised portion into the clipboard.
161  *
162  * @see: AccessibleEditableText_pasteText
163  *
164  * Returns: #TRUE if operation was successful, #FALSE otherwise.
165  **/
166 SPIBoolean
167 AccessibleEditableText_cutText (AccessibleEditableText *obj,
168                                 long int startPos,
169                                 long int endPos)
170 {
171   cspi_return_val_if_fail (obj != NULL, FALSE);
172
173   Accessibility_EditableText_cutText (
174     CSPI_OBJREF (obj),
175     (CORBA_long) startPos, (CORBA_long) endPos, cspi_ev ());
176
177   cspi_return_val_if_ev ("cutText", FALSE);
178
179   return TRUE;
180 }
181
182 /**
183  * AccessibleEditableText_deleteText:
184  * @obj: a pointer to the #AccessibleEditableText object to modify.
185  * @startPos: an integer indicating the starting character offset
186  *       of the text to delete.
187  * @endPos: an integer indicating the offset of the first character
188  *       past the end of the text section to be deleted.
189  *
190  * Delete text from an #AccessibleEditableText object, without copying the
191  *       excised portion into the clipboard.
192  *
193  * @see: AccessibleEditableText_cutText
194  *
195  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
196  **/
197 SPIBoolean
198 AccessibleEditableText_deleteText (AccessibleEditableText *obj,
199                                    long startPos,
200                                    long endPos)
201 {
202   cspi_return_val_if_fail (obj != NULL, FALSE);
203
204   Accessibility_EditableText_deleteText (
205     CSPI_OBJREF (obj),
206     (CORBA_long) startPos, (CORBA_long) endPos, cspi_ev ());
207
208   cspi_return_val_if_ev ("deleteText", FALSE);
209
210   return TRUE;
211 }
212
213 /**
214  * AccessibleEditableText_pasteText:
215  * @obj: a pointer to the #AccessibleEditableText object to modify.
216  * @position: an integer indicating the character offset at which to insert
217  *       the new text.  
218  *
219  * Insert text from the clipboard into an #AccessibleEditableText object.
220  * As with all character offsets, the specified @position may not be the
221  *       same as the resulting byte offset, since the text is in a
222  *       variable-width encoding.
223  *
224  * Returns: #TRUE if the operation was successful, otherwise #FALSE.
225  **/
226 SPIBoolean
227 AccessibleEditableText_pasteText (AccessibleEditableText *obj,
228                                   long int position)
229 {
230   cspi_return_val_if_fail (obj != NULL, FALSE);
231
232   Accessibility_EditableText_pasteText (
233     CSPI_OBJREF (obj), (CORBA_long) position, cspi_ev ());
234
235   cspi_return_val_if_ev ("pasteText", FALSE);
236
237   return TRUE;
238 }