ATK Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
struct AtkTextIface { GTypeInterface parent; gchar* (* get_text) (AtkText *text, gint start_offset, gint end_offset); gchar* (* get_text_after_offset) (AtkText *text, gint offset, AtkTextBoundary boundary_type); gchar* (* get_text_at_offset) (AtkText *text, gint offset, AtkTextBoundary boundary_type); gunichar (* get_character_at_offset) (AtkText *text, gint offset); gchar* (* get_text_before_offset) (AtkText *text, gint offset, AtkTextBoundary boundary_type); gint (* get_caret_offset) (AtkText *text); AtkAttributeSet* (* ref_run_attributes) (AtkText *text, gint offset, gint *start_offset, gint *end_offset); void (* get_character_extents) (AtkText *text, gint offset, gint *x, gint *y, gint *length, gint *width); gint (* get_character_count) (AtkText *text); gint (* get_offset_at_point) (AtkText *text, gint x, gint y); gint (* get_n_selections) (AtkText *text); gchar* (* get_selection) (AtkText *text, gint selection_num, gint *start_offset, gint *end_offset); gboolean (* add_selection) (AtkText *text, gint start_offset, gint end_offset); gboolean (* remove_selection) (AtkText *text, gint selection_num); gboolean (* set_selection) (AtkText *text, gint selection_num, gint start_offset, gint end_offset); gboolean (* set_caret_offset) (AtkText *text, gint offset); gboolean (* set_run_attributes) (AtkText *text, AtkAttributeSet *attrib, gint start_offset, gint end_offset); void (* text_changed) (AtkText *text); void (* caret_changed) (AtkText *text, gint location); }; |
typedef enum { ATK_TEXT_BOUNDARY_CHAR, ATK_TEXT_BOUNDARY_CURSOR_POS, ATK_TEXT_BOUNDARY_WORD_START, ATK_TEXT_BOUNDARY_WORD_END, ATK_TEXT_BOUNDARY_SENTENCE_START, ATK_TEXT_BOUNDARY_SENTENCE_END, ATK_TEXT_BOUNDARY_LINE_START, ATK_TEXT_BOUNDARY_LINE_END } AtkTextBoundary; |
Text boundary types used for specifying boundaries for regions of text
gchar* atk_text_get_text (AtkText *text, gint start_offset, gint end_offset); |
Gets the specified text.
text : | an AtkText |
start_offset : | start position |
end_offset : | end position |
Returns : | the text from start_offset up to, but not including end_offset. |
gunichar atk_text_get_character_at_offset (AtkText *text, gint offset); |
Gets the specified text.
text : | an AtkText |
offset : | position |
Returns : | the character at offset. |
gchar* atk_text_get_text_after_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type); |
Gets the specified text. If the boundary type is ATK_TEXT_BOUNDARY_WORD_START or ATK_TEXT_BOUNDARY_WORD_END part of a word may be returned. If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the start point will be the offset and will continue to the start of the next sentence. The first word may not be a complete word. Similarly for ATK_TEXT_BOUNDARY_SENTENCE_END, ATK_TEXT_BOUNDARY_LINE_START and ATK_TEXT_BOUNDARY_LINE_END
text : | an AtkText |
offset : | position |
boundary_type : | An AtkTextBoundary |
Returns : | the text after offset up to the specified boundary_type. |
gchar* atk_text_get_text_at_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type); |
Gets the specified text. If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START or ATK_TEXT_BOUNDARY_WORD_END a complete word is returned; if the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START or ATK_TEXT_BOUNDARY_SENTENCE_END a complete sentence is returned; if the boundary type is ATK_TEXT_BOUNDARY_LINE_START or ATK_TEXT_BOUNDARY_LINE_END a complete line is returned.
text : | an AtkText |
offset : | position |
boundary_type : | An AtkTextBoundary |
Returns : | the text at offset up to the specified boundary_type. |
gchar* atk_text_get_text_before_offset (AtkText *text, gint offset, AtkTextBoundary boundary_type); |
Gets the specified text. If the boundary type is ATK_TEXT_BOUNDARY_WORD_START or ATK_TEXT_BOUNDARY_WORD_END part of a word may be returned. If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the start point will be at the start of the sentence, and will continue to the offset. The last word may not be a complete word. Similarly for ATK_TEXT_BOUNDARY_SENTENCE_END, ATK_TEXT_BOUNDARY_LINE_START and ATK_TEXT_BOUNDARY_LINE_END
text : | an AtkText |
offset : | position |
boundary_type : | An AtkTextBoundary |
Returns : | the text before offset starting from the specified boundary_type. |
gint atk_text_get_caret_offset (AtkText *text); |
Gets the offset position of the caret (cursor).
text : | an AtkText |
Returns : | the offset position of the caret (cursor). |
void atk_text_get_character_extents (AtkText *text, gint offset, gint *x, gint *y, gint *length, gint *width); |
Given an offset, the x, y, length, and width values are filled appropriately.
text : | an AtkText |
offset : | position |
x : | x-position of character |
y : | y-position of character |
length : | length of character |
width : | width of character |
AtkAttributeSet* atk_text_ref_run_attributes (AtkText *text, gint offset, gint *start_offset, gint *end_offset); |
Creates an AtkAttributeSet which consists of the attributes explicitly set at the position offset in the text. start_offset and end_offset are set to the start and end of the range around offset where the attributes are invariant.
text : | an AtkText |
offset : | the offset at which to get the attributes |
start_offset : | the address to put the start offset of the range |
end_offset : | the address to put the end offset of the range |
Returns : | an AtkAttributeSet which contains the attributes explicitly set at offset |
gint atk_text_get_character_count (AtkText *text); |
Gets the character count.
text : | an AtkText |
Returns : | the number of characters. |
gint atk_text_get_offset_at_point (AtkText *text, gint x, gint y); |
Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to the screen or this widget's window depending on coords.
text : | an AtkText |
x : | screen x-position of character |
y : | screen y-position of character |
Returns : | the offset to the character which is located at the specified x and y coordinates. |
gint atk_text_get_n_selections (AtkText *text); |
Gets the number of selected regions.
text : | an AtkText |
Returns : | The number of selected regions, or -1 if a failure occurred. |
gchar* atk_text_get_selection (AtkText *text, gint selection_num, gint *start_offset, gint *end_offset); |
Gets the text from the specified selection.
text : | an AtkText |
selection_num : | The selection number. The selected regions are assigned numbers that corrispond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering. |
start_offset : | passes back the start position of the selected region |
end_offset : | passes back the end position of the selected region |
Returns : | the selected text. |
gboolean atk_text_add_selection (AtkText *text, gint start_offset, gint end_offset); |
Adds a selection bounded by the specified offsets.
text : | an AtkText |
start_offset : | the start position of the selected region |
end_offset : | the end position of the selected region |
Returns : | TRUE if success, FALSE otherwise |
gboolean atk_text_remove_selection (AtkText *text, gint selection_num); |
Removes the specified selection
text : | an AtkText |
selection_num : | The selection number. The selected regions are assigned numbers that corrispond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering. |
Returns : | TRUE if success, FALSE otherwise |
gboolean atk_text_set_selection (AtkText *text, gint selection_num, gint start_offset, gint end_offset); |
Changes the start and end offset of the specified selection
text : | an AtkText |
selection_num : | The selection number. The selected regions are assigned numbers that corrispond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering. |
start_offset : | the new start position of the selection |
end_offset : | the new end position of the selection |
Returns : | TRUE if success, FALSE otherwise |