1 #include <cspi/spi-private.h>
5 * @obj: a pointer to the #AccessibleText object on which to operate.
7 * Increment the reference count for an #AccessibleText object.
10 AccessibleText_ref (AccessibleText *obj)
12 cspi_object_ref (obj);
16 * AccessibleText_unref:
17 * @obj: a pointer to the #Accessible object on which to operate.
19 * Decrement the reference count for an #AccessibleText object.
22 AccessibleText_unref (AccessibleText *obj)
24 cspi_object_unref (obj);
28 * AccessibleText_getCharacterCount:
29 * @obj: a pointer to the #AccessibleText object to query.
31 * Get the character count of an #AccessibleText object.
33 * Returns: a long integer indicating the total number of
34 * characters in the #AccessibleText object.
37 AccessibleText_getCharacterCount (AccessibleText *obj)
41 cspi_return_val_if_fail (obj != NULL, -1);
44 Accessibility_Text__get_characterCount (CSPI_OBJREF (obj), cspi_ev ());
46 cspi_return_val_if_ev ("getCharacterCount", -1);
52 * AccessibleText_getText:
53 * @obj: a pointer to the #AccessibleText object to query.
54 * @startOffset: a #long indicating the start of the desired text range.
55 * @endOffset: a #long indicating the first character past the desired range.
57 * Get a range of text from an #AccessibleText object. The number of bytes
58 * in the returned string may exceed endOffset-startOffset, since
59 * UTF-8 is a variable-width encoding.
61 * Returns: a text string containing characters from @startOffset
62 * to @endOffset-1, inclusive, encoded as UTF-8.
65 AccessibleText_getText (AccessibleText *obj,
71 cspi_return_val_if_fail (obj != NULL, NULL);
74 Accessibility_Text_getText (CSPI_OBJREF (obj),
75 (CORBA_long) startOffset,
76 (CORBA_long) endOffset,
79 cspi_return_val_if_ev ("getText", NULL);
85 * AccessibleText_getCaretOffset:
86 * @obj: a pointer to the #AccessibleText object to query.
88 * Get the current offset of the text caret in an #AccessibleText object.
90 * Returns: a long integer indicating the current position of the text caret.
93 AccessibleText_getCaretOffset (AccessibleText *obj)
97 cspi_return_val_if_fail (obj != NULL, -1);
100 Accessibility_Text__get_caretOffset (CSPI_OBJREF (obj), cspi_ev ());
102 cspi_return_val_if_ev ("getCaretOffset", -1);
108 * AccessibleText_getAttributes:
109 * @obj: a pointer to the #AccessibleText object to query.
110 * @offset: a long integer indicating the offset from which the attribute
112 * @startOffset: a #long indicating the start of the desired text range.
113 * @endOffset: a #long indicating the first character past the desired range.
115 * Get the attributes applied to a range of text from an #AccessibleText
116 * object, and the bounds of the range.
118 * Returns: a text string describing the attributes occurring within the
119 * attribute run containing @offset, encoded as UTF-8 and
123 AccessibleText_getAttributes (AccessibleText *obj,
125 long int *startOffset,
128 CORBA_long retStartOffset, retEndOffset;
133 *startOffset = *endOffset = 0;
138 Accessibility_Text_getAttributes (CSPI_OBJREF (obj),
144 if (!cspi_check_ev ("getAttributes"))
146 *startOffset = *endOffset = 0;
150 *startOffset = retStartOffset;
151 *endOffset = retEndOffset;
158 * AccessibleText_setCaretOffset:
159 * @obj: a pointer to the #AccessibleText object on which to operate.
160 * @newOffset: the offset to which the text caret is to be moved.
162 * Set the text caret position for an #AccessibleText object.
164 * Returns: #TRUE if successful, #FALSE otherwise.
167 AccessibleText_setCaretOffset (AccessibleText *obj,
172 cspi_return_val_if_fail (obj != NULL, FALSE);
175 Accessibility_Text_setCaretOffset (CSPI_OBJREF (obj),
176 (CORBA_long) newOffset, cspi_ev ());
178 cspi_return_val_if_ev ("setCaretOffset", FALSE);
184 * AccessibleText_getTextBeforeOffset:
185 * @obj: a pointer to the #AccessibleText object on which to operate.
186 * @offset: a long integer indicating the offset from which the delimiter
188 * @type: an #AccessibleTextBoundaryType indicating whether the desired
189 * text string is a word, sentence, line, or attribute run.
190 * @startOffset: a pointer to a long integer which is assigned the
191 * starting offset of the returned string, relative to the
192 * original #AccessibleText.
193 * @endOffset: a pointer to a long integer which is assigned the
194 * ending offset of the returned string, relative to the original
197 * Get delimited text from an #AccessibleText object which precedes a given
200 * Returns: a UTF-8 string representing the delimited text, both of whose
201 * delimiting boundaries are before the current offset, or
202 * an empty string if no such text exists.
205 AccessibleText_getTextBeforeOffset (AccessibleText *obj,
207 AccessibleTextBoundaryType type,
208 long int *startOffset,
212 CORBA_long retStartOffset, retEndOffset;
214 Accessibility_Text_getTextBeforeOffset (CSPI_OBJREF (obj),
215 (CORBA_long) offset, (Accessibility_TEXT_BOUNDARY_TYPE) type,
216 &retStartOffset, &retEndOffset,
218 *startOffset = (long) retStartOffset;
219 *endOffset = (long) retEndOffset;
224 * AccessibleText_getTextAtOffset:
225 * @obj: a pointer to the #AccessibleText object on which to operate.
226 * @offset: a long integer indicating the offset from which the delimiter
228 * @type: an #AccessibleTextBoundaryType indicating whether the desired
229 * text string is a word, sentence, line, or attribute run.
230 * @startOffset: a pointer to a long integer which is assigned the
231 * starting offset of the returned string, relative to the
232 * original #AccessibleText.
233 * @endOffset: a pointer to a long integer which is assigned the
234 * ending offset of the returned string, relative to the original
237 * Get delimited text from an #AccessibleText object which includes a given
240 * Returns: a UTF-8 string representing the delimited text, whose
241 * delimiting boundaries bracket the current offset, or
242 * an empty string if no such text exists.
245 AccessibleText_getTextAtOffset (AccessibleText *obj,
247 AccessibleTextBoundaryType type,
248 long int *startOffset, long int *endOffset)
250 CORBA_long corbaStartOffset;
251 CORBA_long corbaEndOffset;
256 *startOffset = *endOffset = 0;
260 retval = Accessibility_Text_getTextAtOffset (CSPI_OBJREF (obj),
262 (Accessibility_TEXT_BOUNDARY_TYPE) type,
267 if (!cspi_check_ev ("getTextAtOffset"))
269 *startOffset = *endOffset = 0;
274 *startOffset = corbaStartOffset;
275 *endOffset = corbaEndOffset;
278 fprintf (stderr, "text offsets %ld to %ld\n", *startOffset, *endOffset);
284 * AccessibleText_getTextAfterOffset:
285 * @obj: a pointer to the #AccessibleText object on which to operate.
286 * @offset: a long integer indicating the offset from which the delimiter
288 * @type: an #AccessibleTextBoundaryType indicating whether the desired
289 * text string is a word, sentence, line, or attribute run.
290 * @startOffset: a pointer to a long integer which is assigned the
291 * starting offset of the returned string, relative to the
292 * original #AccessibleText.
293 * @endOffset: a pointer to a long integer which is assigned the
294 * ending offset of the returned string, relative to the original
297 * Get delimited text from an #AccessibleText object which follows a given
300 * Returns: a UTF-8 string representing the delimited text, both of whose
301 * delimiting boundaries are after or inclusive of the current
302 * offset, or an empty string if no such text exists.
305 AccessibleText_getTextAfterOffset (AccessibleText *obj,
307 AccessibleTextBoundaryType type,
308 long int *startOffset, long int *endOffset)
311 CORBA_long retStartOffset, retEndOffset;
315 *startOffset = *endOffset = 0;
320 Accessibility_Text_getTextAfterOffset (CSPI_OBJREF (obj),
321 (CORBA_long) offset, (Accessibility_TEXT_BOUNDARY_TYPE) type,
322 &retStartOffset, &retEndOffset,
325 if (!cspi_check_ev ("getTextAfterOffset"))
327 *startOffset = *endOffset = 0;
331 *startOffset = retStartOffset;
332 *endOffset = retEndOffset;
339 * AccessibleText_getCharacterAtOffset:
340 * @obj: a pointer to the #AccessibleText object on which to operate.
341 * @offset: a long integer indicating the text offset where the desired
342 * character is located.
344 * Get the character at a given offset for an #AccessibleText object.
346 * Returns: an #unsigned long integer which represents the
347 * UCS-4 unicode code point of the given character, or
348 * 0xFFFFFFFF if the character in question cannot be represented
349 * in the UCS-4 encoding.
352 AccessibleText_getCharacterAtOffset (AccessibleText *obj,
357 cspi_return_val_if_fail (obj != NULL, -1);
360 Accessibility_Text_getCharacterAtOffset (CSPI_OBJREF (obj),
364 cspi_return_val_if_ev ("getCharacterAtOffset", -1);
370 * AccessibleText_getCharacterExtents:
371 * @obj: a pointer to the #AccessibleText object on which to operate.
372 * @offset: an integer indicating the offset of the text character for
373 * whom boundary information is requested.
374 * @x: a pointer to a long integer into which the nominal x coordinate
375 * of the corresponding glyph will be returned.
376 * @y:a pointer to a long integer into which the nominal y coordinate
377 * of the corresponding glyph will be returned.
378 * @width:a pointer to a long integer into which the width
379 * of the corresponding glyph will be returned.
380 * @height: a pointer to a long integer into which the height
381 * of the corresponding glyph will be returned.
382 * @type: an #AccessibleCoordType indicating the coordinate system to use
383 * for the returned values.
385 * Get the bounding box containing the glyph representing
386 * the character at a particular text offset.
389 AccessibleText_getCharacterExtents (AccessibleText *obj,
395 AccessibleCoordType type)
397 CORBA_long retX, retY, retWidth, retHeight;
402 *width = *height = 0;
406 Accessibility_Text_getCharacterExtents (CSPI_OBJREF (obj),
412 (CORBA_short) type, cspi_ev ());
414 if (!cspi_check_ev ("getCharacterExtents"))
417 *width = *height = 0;
429 * AccessibleText_getOffsetAtPoint:
430 * @obj: a pointer to the #AccessibleText object on which to operate.
431 * @x: the x coordinate of the point to be queried.
432 * @y: the y coordinate of the point to be queried.
433 * @type: an #AccessibleCoordType indicating the coordinate system in which
434 * the values should be returned.
436 * Get the bounding box for a glyph at a certain #AccessibleText offset.
438 * Returns: the offset (as a long integer) at the point (@x, @y)
439 * in the specified coordinate system.
443 AccessibleText_getOffsetAtPoint (AccessibleText *obj,
446 AccessibleCoordType type)
450 cspi_return_val_if_fail (obj != NULL, -1);
453 Accessibility_Text_getOffsetAtPoint (CSPI_OBJREF (obj),
456 (CORBA_short) type, cspi_ev ());
458 cspi_return_val_if_ev ("getOffsetAtPoint", -1);
464 * AccessibleText_getNSelections:
465 * @obj: a pointer to the #AccessibleText object on which to operate.
467 * Get the number of active non-contiguous selections for an
468 * #AccessibleText object.
470 * Returns: a long integer indicating the current
471 * number of non-contiguous text selections active
472 * within an #AccessibleText object.
475 AccessibleText_getNSelections (AccessibleText *obj)
479 cspi_return_val_if_fail (obj != NULL, -1);
482 Accessibility_Text_getNSelections (CSPI_OBJREF (obj), cspi_ev ());
484 cspi_return_val_if_ev ("getNSelections", -1);
490 * AccessibleText_getSelection:
491 * @obj: a pointer to the #AccessibleText object on which to operate.
492 * @selectionNum: an integer indicating which selection to query.
493 * @startOffset: a pointer to a long integer into which the start offset
494 * of the selection will be returned.
495 * @endOffset: a pointer to a long integer into which the start offset
496 * of the selection will be returned.
498 * Get the bounds of the @selectionNum-th active text selection for an
499 * #AccessibleText object.
502 AccessibleText_getSelection (AccessibleText *obj,
503 long int selectionNum,
504 long int *startOffset,
507 CORBA_long retStartOffset, retEndOffset;
511 *endOffset = *startOffset = -1;
515 Accessibility_Text_getSelection (CSPI_OBJREF (obj),
516 (CORBA_long) selectionNum,
517 &retStartOffset, &retEndOffset,
520 if (!cspi_check_ev ("getSelection"))
522 *startOffset = *endOffset = 0;
526 *startOffset = retStartOffset;
527 *endOffset = retEndOffset;
532 * AccessibleText_addSelection:
533 * @obj: a pointer to the #AccessibleText object on which to operate.
534 * @startOffset: the starting offset of the desired new selection.
535 * @endOffset: the offset of the first character after the new selection.
537 * Select some text (add a text selection) in an #AccessibleText object.
539 * Returns: #TRUE if successful, #FALSE otherwise.
542 AccessibleText_addSelection (AccessibleText *obj,
543 long int startOffset, long int endOffset)
547 cspi_return_val_if_fail (obj != NULL, FALSE);
550 Accessibility_Text_addSelection (
551 CSPI_OBJREF (obj), (CORBA_long) startOffset,
552 (CORBA_long) endOffset, cspi_ev ());
554 cspi_return_val_if_ev ("addSelection", FALSE);
560 * AccessibleText_removeSelection:
561 * @obj: a pointer to the #AccessibleText object on which to operate.
562 * @selectionNum: an integer indicating which (possibly of several)
563 * text selection to remove.
565 * De-select a text selection.
567 * Returns: #TRUE if successful, #FALSE otherwise.
570 AccessibleText_removeSelection (AccessibleText *obj,
571 long int selectionNum)
575 cspi_return_val_if_fail (obj != NULL, FALSE);
578 Accessibility_Text_removeSelection (
579 CSPI_OBJREF (obj), (CORBA_long) selectionNum, cspi_ev ());
581 cspi_return_val_if_ev ("removeSelection", FALSE);
587 * AccessibleText_setSelection:
588 * @obj: a pointer to the #AccessibleText object on which to operate.
589 * @selectionNum: a zero-offset index indicating which text selection to modify.
590 * @startOffset: a long int, the new starting offset for the selection.
591 * @endOffset: a long int, the desired new offset of the first character
592 * after the selection.
594 * Change the bounds of an existing #AccessibleText text selection.
596 * Returns: #TRUE if successful, #FALSE otherwise.
599 AccessibleText_setSelection (AccessibleText *obj,
600 long int selectionNum,
601 long int startOffset,
604 cspi_return_val_if_fail (obj != NULL, FALSE);
606 Accessibility_Text_setSelection (CSPI_OBJREF (obj),
607 (CORBA_long) selectionNum,
608 (CORBA_long) startOffset,
609 (CORBA_long) endOffset, cspi_ev ());
611 cspi_return_val_if_ev ("setSelection", FALSE);