X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=cspi%2Fspi_text.c;h=974c850de82f6c31e3dc2274a49c216cb983d677;hb=2b8f4365c549962de1f20418ca00dd503d6e28bc;hp=f1f083f6ddb69ac3b4e6dc14222afdda05c021cb;hpb=66c4375c7cd9a0a01e79f562e1bb0326fc4dcd21;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/cspi/spi_text.c b/cspi/spi_text.c index f1f083f..974c850 100644 --- a/cspi/spi_text.c +++ b/cspi/spi_text.c @@ -1,73 +1,137 @@ +#include + +/** + * AccessibleText_ref: + * @obj: a pointer to the #AccessibleText object on which to operate. + * + * Increment the reference count for an #AccessibleText object. + * + * Returns: (no return code implemented yet). + * + **/ int -SpiAccessibleText_ref (SpiAccessibleText *obj) +AccessibleText_ref (AccessibleText *obj) { - Accessibility_Text_ref (*obj, &ev); + cspi_object_ref (obj); return 0; } +/** + * AccessibleText_unref: + * @obj: a pointer to the #Accessible object on which to operate. + * + * Decrement the reference count for an #AccessibleText object. + * + * Returns: (no return code implemented yet). + * + **/ int -SpiAccessibleText_unref (SpiAccessibleText *obj) +AccessibleText_unref (AccessibleText *obj) { - Accessibility_Text_unref (*obj, &ev); + cspi_object_unref (obj); return 0; } - +/** + * AccessibleText_getCharacterCount: + * @obj: a pointer to the #AccessibleText object to query. + * + * Get the character count of an #AccessibleText object. + * + * Returns: a long integer indicating the total number of + * characters in the #AccessibleText object. + * + **/ long -SpiAccessibleText_getCharacterCount (SpiAccessibleText *obj) +AccessibleText_getCharacterCount (AccessibleText *obj) { long retval; - CORBA_exception_init (&ev); + CORBA_exception_init (cspi_ev ()); retval = (long) - Accessibility_Text__get_characterCount (*obj, &ev); + Accessibility_Text__get_characterCount (CSPI_OBJREF (obj), cspi_ev ()); - spi_check_ev (&ev, "SpiAccessibleText_getCharacterCount"); + cspi_check_ev (cspi_ev (), "SpiAccessibleText_getCharacterCount"); return retval; } +/** + * AccessibleText_getText: + * @obj: a pointer to the #AccessibleText object to query. + * @startOffset: a #long indicating the start of the desired text range. + * @endOffset: a #long indicating the first character past the desired range. + * + * Get a range of text from an #AccessibleText object. The number of bytes + * in the returned string may exceed endOffset-startOffset, since + * UTF-8 is a variable-width encoding. + * + * Returns: a text string containing characters from @startOffset + * to @endOffset-1, inclusive, encoded as UTF-8. + * + **/ char * -SpiAccessibleText_getText (SpiAccessibleText *obj, - long startOffset, - long endOffset) +AccessibleText_getText (AccessibleText *obj, + long int startOffset, + long int endOffset) { return (char *) - Accessibility_Text_getText (*obj, - (CORBA_long) startOffset, (CORBA_long) endOffset, &ev); + Accessibility_Text_getText (CSPI_OBJREF (obj), + (CORBA_long) startOffset, (CORBA_long) endOffset, cspi_ev ()); } - - - +/** + * AccessibleText_getCaretOffset: + * @obj: a pointer to the #AccessibleText object to query. + * + * Get the current offset of the text caret in an #AccessibleText object. + * + * Returns: a long integer indicating the current position of the text caret. + * + **/ long -SpiAccessibleText_getCaretOffset (SpiAccessibleText *obj) +AccessibleText_getCaretOffset (AccessibleText *obj) { return (long) - Accessibility_Text__get_caretOffset (*obj, &ev); + Accessibility_Text__get_caretOffset (CSPI_OBJREF (obj), cspi_ev ()); } - +/** + * AccessibleText_getAttributes: + * @obj: a pointer to the #AccessibleText object to query. + * @offset: a long integer indicating the offset from which the attribute + * search is based. + * @startOffset: a #long indicating the start of the desired text range. + * @endOffset: a #long indicating the first character past the desired range. + * + * Get the attributes applied to a range of text from an #AccessibleText + * object, and the bounds of the range. + * + * Returns: a text string describing the attributes occurring within the + * attribute run containing @offset, encoded as UTF-8 and + * delimited by ':' + * + **/ char * -SpiAccessibleText_getAttributes (SpiAccessibleText *obj, - long offset, - long *startOffset, - long *endOffset) +AccessibleText_getAttributes (AccessibleText *obj, + long int offset, + long int *startOffset, + long int *endOffset) { CORBA_long retStartOffset, retEndOffset; char *retval; retval = (char *) - Accessibility_Text_getAttributes (*obj, + Accessibility_Text_getAttributes (CSPI_OBJREF (obj), (CORBA_long) offset, &retStartOffset, &retEndOffset, - &ev); + cspi_ev ()); *startOffset = (long) retStartOffset; *endOffset = (long) retEndOffset; return retval; @@ -75,75 +139,147 @@ SpiAccessibleText_getAttributes (SpiAccessibleText *obj, -boolean -SpiAccessibleText_setCaretOffset (SpiAccessibleText *obj, - long newOffset) +/** + * AccessibleText_setCaretOffset: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @newOffset: the offset to which the text caret is to be moved. + * + * Set the text caret position for an #AccessibleText object. + * + * Returns: #TRUE if successful, #FALSE otherwise. + * + **/ +SPIBoolean +AccessibleText_setCaretOffset (AccessibleText *obj, + long int newOffset) { - return (boolean) - Accessibility_Text_setCaretOffset (*obj, - (CORBA_long) newOffset, &ev); + return (SPIBoolean) + Accessibility_Text_setCaretOffset (CSPI_OBJREF (obj), + (CORBA_long) newOffset, cspi_ev ()); } - - +/** + * AccessibleText_getTextBeforeOffset: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @offset: a long integer indicating the offset from which the delimiter + * search is based. + * @type: an #AccessibleTextBoundaryType indicating whether the desired + * text string is a word, sentence, line, or attribute run. + * @startOffset: a pointer to a long integer which is assigned the + * starting offset of the returned string, relative to the + * original #AccessibleText. + * @endOffset: a pointer to a long integer which is assigned the + * ending offset of the returned string, relative to the original + * #AccessibleText. + * + * Get delimited text from an #AccessibleText object which precedes a given + * text offset. + * + * Returns: a UTF-8 string representing the delimited text, both of whose + * delimiting boundaries are before the current offset, or + * an empty string if no such text exists. + * + **/ char * -SpiAccessibleText_getTextBeforeOffset (SpiAccessibleText *obj, - long offset, - SPI_TEXT_BOUNDARY_TYPE type, - long *startOffset, long *endOffset) +AccessibleText_getTextBeforeOffset (AccessibleText *obj, + long int offset, + AccessibleTextBoundaryType type, + long int *startOffset, + long int *endOffset) { char *retval; CORBA_long retStartOffset, retEndOffset; retval = (char *) - Accessibility_Text_getTextBeforeOffset (*obj, + Accessibility_Text_getTextBeforeOffset (CSPI_OBJREF (obj), (CORBA_long) offset, (Accessibility_TEXT_BOUNDARY_TYPE) type, &retStartOffset, &retEndOffset, - &ev); + cspi_ev ()); *startOffset = (long) retStartOffset; *endOffset = (long) retEndOffset; return retval; } - - +/** + * AccessibleText_getTextAtOffset: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @offset: a long integer indicating the offset from which the delimiter + * search is based. + * @type: an #AccessibleTextBoundaryType indicating whether the desired + * text string is a word, sentence, line, or attribute run. + * @startOffset: a pointer to a long integer which is assigned the + * starting offset of the returned string, relative to the + * original #AccessibleText. + * @endOffset: a pointer to a long integer which is assigned the + * ending offset of the returned string, relative to the original + * #AccessibleText. + * + * Get delimited text from an #AccessibleText object which includes a given + * text offset. + * + * Returns: a UTF-8 string representing the delimited text, whose + * delimiting boundaries bracket the current offset, or + * an empty string if no such text exists. + * + **/ char * -SpiAccessibleText_getTextAtOffset (SpiAccessibleText *obj, - long offset, - SPI_TEXT_BOUNDARY_TYPE type, - long *startOffset, long *endOffset) +AccessibleText_getTextAtOffset (AccessibleText *obj, + long int offset, + AccessibleTextBoundaryType type, + long int *startOffset, long int *endOffset) { CORBA_long corbaStartOffset; CORBA_long corbaEndOffset; char *retval = ""; - retval = Accessibility_Text_getTextAtOffset (*obj, + retval = Accessibility_Text_getTextAtOffset (CSPI_OBJREF (obj), (CORBA_long) offset, (Accessibility_TEXT_BOUNDARY_TYPE) type, &corbaStartOffset, &corbaEndOffset, - &ev); + cspi_ev ()); *startOffset = (long) corbaStartOffset; *endOffset = (long) corbaEndOffset; -#ifdef SPI_DEBUG +#ifdef CSPI_DEBUG fprintf (stderr, "text offsets %ld to %ld\n", *startOffset, *endOffset); #endif return retval; } - +/** + * AccessibleText_getTextAfterOffset: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @offset: a long integer indicating the offset from which the delimiter + * search is based. + * @type: an #AccessibleTextBoundaryType indicating whether the desired + * text string is a word, sentence, line, or attribute run. + * @startOffset: a pointer to a long integer which is assigned the + * starting offset of the returned string, relative to the + * original #AccessibleText. + * @endOffset: a pointer to a long integer which is assigned the + * ending offset of the returned string, relative to the original + * #AccessibleText. + * + * Get delimited text from an #AccessibleText object which follows a given + * text offset. + * + * Returns: a UTF-8 string representing the delimited text, both of whose + * delimiting boundaries are after or inclusive of the current + * offset, or an empty string if no such text exists. + * + **/ char * -SpiAccessibleText_getTextAfterOffset (SpiAccessibleText *obj, - long offset, - SPI_TEXT_BOUNDARY_TYPE type, - long *startOffset, long *endOffset) +AccessibleText_getTextAfterOffset (AccessibleText *obj, + long int offset, + AccessibleTextBoundaryType type, + long int *startOffset, long int *endOffset) { char *retval; CORBA_long retStartOffset, retEndOffset; retval = (char *) - Accessibility_Text_getTextAfterOffset (*obj, + Accessibility_Text_getTextAfterOffset (CSPI_OBJREF (obj), (CORBA_long) offset, (Accessibility_TEXT_BOUNDARY_TYPE) type, &retStartOffset, &retEndOffset, - &ev); + cspi_ev ()); *startOffset = (long) retStartOffset; *endOffset = (long) retEndOffset; return retval; @@ -151,34 +287,66 @@ SpiAccessibleText_getTextAfterOffset (SpiAccessibleText *obj, +/** + * AccessibleText_getCharacterAtOffset: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @offset: a long integer indicating the text offset where the desired + * character is located. + * + * Get the character at a given offset for an #AccessibleText object. + * + * Returns: an #unsigned long integer which represents the + * UCS-4 unicode code point of the given character, or + * 0xFFFFFFFF if the character in question cannot be represented + * in the UCS-4 encoding. + * + **/ unsigned long -SpiAccessibleText_getCharacterAtOffset (SpiAccessibleText *obj, - long offset) +AccessibleText_getCharacterAtOffset (AccessibleText *obj, + long int offset) { return (unsigned long) - Accessibility_Text_getCharacterAtOffset (*obj, - (CORBA_long) offset, &ev); + Accessibility_Text_getCharacterAtOffset (CSPI_OBJREF (obj), + (CORBA_long) offset, cspi_ev ()); } - - +/** + * AccessibleText_getCharacterExtents: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @offset: an integer indicating the offset of the text character for + * whom boundary information is requested. + * @x: a pointer to a long integer into which the nominal x coordinate + * of the corresponding glyph will be returned. + * @y:a pointer to a long integer into which the nominal y coordinate + * of the corresponding glyph will be returned. + * @width:a pointer to a long integer into which the width + * of the corresponding glyph will be returned. + * @height: a pointer to a long integer into which the height + * of the corresponding glyph will be returned. + * @type: an #AccessibleCoordType indicating the coordinate system to use + * for the returned values. + * + * Get the bounding box containing the glyph representing + * the character at a particular text offset. + * + **/ void -SpiAccessibleText_getCharacterExtents (SpiAccessibleText *obj, - long offset, - long *x, - long *y, - long *width, - long *height, - SpiAccessibleCoordType type) +AccessibleText_getCharacterExtents (AccessibleText *obj, + long int offset, + long int *x, + long int *y, + long int *width, + long int *height, + AccessibleCoordType type) { CORBA_long retX, retY, retWidth, retHeight; - Accessibility_Text_getCharacterExtents (*obj, + Accessibility_Text_getCharacterExtents (CSPI_OBJREF (obj), (CORBA_long) offset, &retX, &retY, &retWidth, &retHeight, - (CORBA_short) type, &ev); + (CORBA_short) type, cspi_ev ()); *x = (long) retX; *y = (long) retY; *width = (long) retWidth; @@ -186,38 +354,76 @@ SpiAccessibleText_getCharacterExtents (SpiAccessibleText *obj, } - +/** + * AccessibleText_getOffsetAtPoint: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @x: the x coordinate of the point to be queried. + * @y: the y coordinate of the point to be queried. + * @type: an #AccessibleCoordType indicating the coordinate system in which + * the values should be returned. + * + * Get the bounding box for a glyph at a certain #AccessibleText offset. + * + * Returns: the offset (as a long integer) at the point (@x, @y) + * in the specified coordinate system. + * + **/ long -SpiAccessibleText_getOffsetAtPoint (SpiAccessibleText *obj, - long x, - long y, - SpiAccessibleCoordType type) +AccessibleText_getOffsetAtPoint (AccessibleText *obj, + long int x, + long int y, + AccessibleCoordType type) { return (long) - Accessibility_Text_getOffsetAtPoint (*obj, - (CORBA_long) x, (CORBA_long) y, (CORBA_short) type, &ev); + Accessibility_Text_getOffsetAtPoint (CSPI_OBJREF (obj), + (CORBA_long) x, (CORBA_long) y, (CORBA_short) type, cspi_ev ()); } - +/** + * AccessibleText_getNSelections: + * @obj: a pointer to the #AccessibleText object on which to operate. + * + * Get the number of active non-contiguous selections for an + * #AccessibleText object. + * + * Returns: a long integer indicating the current + * number of non-contiguous text selections active + * within an #AccessibleText object. + * + **/ long -SpiAccessibleText_getNSelections (SpiAccessibleText *obj) +AccessibleText_getNSelections (AccessibleText *obj) { return (long) - Accessibility_Text_getNSelections (*obj, &ev); + Accessibility_Text_getNSelections (CSPI_OBJREF (obj), cspi_ev ()); } +/** + * AccessibleText_getSelection: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @selectionNum: an integer indicating which selection to query. + * @startOffset: a pointer to a long integer into which the start offset + * of the selection will be returned. + * @endOffset: a pointer to a long integer into which the start offset + * of the selection will be returned. + * + * Get the bounds of the @selectionNum-th active text selection for an + * #AccessibleText object. + * + **/ void -SpiAccessibleText_getSelection (SpiAccessibleText *obj, - long selectionNum, long *startOffset, - long *endOffset) +AccessibleText_getSelection (AccessibleText *obj, + long int selectionNum, + long int *startOffset, + long int *endOffset) { CORBA_long retStartOffset, retEndOffset; - Accessibility_Text_getSelection (*obj, + Accessibility_Text_getSelection (CSPI_OBJREF (obj), (CORBA_long) selectionNum, - &retStartOffset, &retEndOffset, &ev); + &retStartOffset, &retEndOffset, cspi_ev ()); *startOffset = (long) retStartOffset; *endOffset = (long) retEndOffset; @@ -225,40 +431,72 @@ SpiAccessibleText_getSelection (SpiAccessibleText *obj, -boolean -SpiAccessibleText_addSelection (SpiAccessibleText *obj, - long startOffset, long endOffset) +/** + * AccessibleText_addSelection: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @startOffset: the starting offset of the desired new selection. + * @endOffset: the offset of the first character after the new selection. + * + * Select some text (add a text selection) in an #AccessibleText object. + * + * Returns: #TRUE if successful, #FALSE otherwise. + * + **/ +SPIBoolean +AccessibleText_addSelection (AccessibleText *obj, + long int startOffset, long int endOffset) { - return (boolean) - Accessibility_Text_addSelection (*obj, + return (SPIBoolean) + Accessibility_Text_addSelection (CSPI_OBJREF (obj), (CORBA_long) startOffset, (CORBA_long) endOffset, - &ev); + cspi_ev ()); } - -boolean -SpiAccessibleText_removeSelection (SpiAccessibleText *obj, - long selectionNum) +/** + * AccessibleText_removeSelection: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @selectionNum: an integer indicating which (possibly of several) + * text selection to remove. + * + * De-select a text selection. + * + * Returns: #TRUE if successful, #FALSE otherwise. + * + **/ +SPIBoolean +AccessibleText_removeSelection (AccessibleText *obj, + long int selectionNum) { - return (boolean) - Accessibility_Text_removeSelection (*obj, - (CORBA_long) selectionNum, &ev); + return (SPIBoolean) + Accessibility_Text_removeSelection (CSPI_OBJREF (obj), + (CORBA_long) selectionNum, cspi_ev ()); } - - -boolean -SpiAccessibleText_setSelection (SpiAccessibleText *obj, - long selectionNum, - long startOffset, - long endOffset) +/** + * AccessibleText_setSelection: + * @obj: a pointer to the #AccessibleText object on which to operate. + * @selectionNum: a zero-offset index indicating which text selection to modify. + * @startOffset: a long int, the new starting offset for the selection. + * @endOffset: a long int, the desired new offset of the first character + * after the selection. + * + * Change the bounds of an existing #AccessibleText text selection. + * + * Returns: #TRUE if successful, #FALSE otherwise. + * + **/ +SPIBoolean +AccessibleText_setSelection (AccessibleText *obj, + long int selectionNum, + long int startOffset, + long int endOffset) { - return (boolean) - Accessibility_Text_setSelection (*obj, + return (SPIBoolean) + Accessibility_Text_setSelection (CSPI_OBJREF (obj), (CORBA_long) selectionNum, (CORBA_long) startOffset, - (CORBA_long) endOffset, &ev); + (CORBA_long) endOffset, cspi_ev ()); }