diff options
author | Brian Cameron <bcameron@src.gnome.org> | 2001-06-06 13:42:10 +0000 |
---|---|---|
committer | Brian Cameron <bcameron@src.gnome.org> | 2001-06-06 13:42:10 +0000 |
commit | a594d5e6506398740d5b5f5fabca648ef95ca213 (patch) | |
tree | ce38d98231f123d7d33a7937f2ce6fce1f851c9f /atk | |
parent | ca1ced1f82e664dd60ccd6ca29789b77c872ced7 (diff) | |
download | atk-a594d5e6506398740d5b5f5fabca648ef95ca213.tar.gz |
Added atk_text_ref_run_attributes() and atk_text_set_run_attributes().
Removed atk_text_get_range_attributes()
Diffstat (limited to 'atk')
-rwxr-xr-x | atk/atktext.c | 97 | ||||
-rwxr-xr-x | atk/atktext.h | 29 |
2 files changed, 91 insertions, 35 deletions
diff --git a/atk/atktext.c b/atk/atktext.c index 78d2961..ef762bd 100755 --- a/atk/atktext.c +++ b/atk/atktext.c @@ -280,35 +280,6 @@ atk_text_get_caret_offset (AtkText *text) } /** - * atk_text_get_range_attributes - * @text: an #AtkText - * @start_offset: start position - * @end_offset: end position - * - * Gets attributes over the specified range. - * - * Returns: a #PangoAttrList with the text attributes between the - * @start_offset and the @end_offset. - **/ -PangoAttrList* -atk_text_get_range_attributes (AtkText *text, - gint start_offset, - gint end_offset) -{ - AtkTextIface *iface; - - g_return_val_if_fail (text != NULL, NULL); - g_return_val_if_fail (ATK_IS_TEXT (text), NULL); - - iface = ATK_TEXT_GET_IFACE (text); - - if (iface->get_range_attributes) - return (*(iface->get_range_attributes)) (text, start_offset, end_offset); - else - return NULL; -} - -/** * atk_text_get_character_extents * @text: an #AtkText * @offset: position @@ -347,6 +318,39 @@ atk_text_get_character_extents (AtkText *text, } /** + *atk_text_ref_run_attributes: + *@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 + * + *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. + * + *Returns: an #AtkAttributeSet which contains the attributes explicitly set + *at @offset + **/ +AtkAttributeSet* atk_text_ref_run_attributes (AtkText *text, + gint offset, + gint *start_offset, + gint *end_offset) +{ + AtkTextIface *iface; + + g_return_val_if_fail (text != NULL, NULL); + g_return_val_if_fail (ATK_IS_TEXT (text), NULL); + + iface = ATK_TEXT_GET_IFACE (text); + + if (iface->ref_run_attributes) + return (*(iface->ref_run_attributes)) (text, offset, start_offset, end_offset); + else + return NULL; +} + +/** * atk_text_get_character_count * @text: an #AtkText * @@ -551,6 +555,41 @@ atk_text_set_selection (AtkText *text, gint selection_num, } /** + *atk_text_set_run_attributes: + *@text: an #AtkText + *@attrib: an #AtkAttributeSet + *@start_offset: start of range in which to set attributes + *@end_offset: end of range in which to set attributes + * + *Sets the attributes for a specified range + * + *Returns: %TRUE if attributes successfully set for the specified + *range, otherwise %FALSE + **/ +gboolean +atk_text_set_run_attributes (AtkText *text, + AtkAttributeSet *attrib, + gint start_offset, + gint end_offset) +{ + AtkTextIface *iface; + + g_return_val_if_fail (text != NULL, FALSE); + g_return_val_if_fail (ATK_IS_TEXT (text), FALSE); + + iface = ATK_TEXT_GET_IFACE (text); + + if (iface->set_run_attributes) + { + return (*(iface->set_run_attributes)) (text, attrib, start_offset, end_offset); + } + else + { + return FALSE; + } +} + +/** * atk_text_set_caret_offset * @text: an #AtkText * @offset: position diff --git a/atk/atktext.h b/atk/atktext.h index bc63ce0..9f55658 100755 --- a/atk/atktext.h +++ b/atk/atktext.h @@ -40,6 +40,13 @@ typedef struct _AtkText AtkText; #endif typedef struct _AtkTextIface AtkTextIface; +typedef GList AtkAttributeSet; + +typedef struct _AtkAttribute { + gchar* name; + gchar* value; +}AtkAttribute; + /** *AtkTextBoundary: *@ATK_TEXT_BOUNDARY_CHAR: @@ -83,9 +90,10 @@ struct _AtkTextIface gint offset, AtkTextBoundary boundary_type); gint (* get_caret_offset) (AtkText *text); - PangoAttrList* (* get_range_attributes) (AtkText *text, - gint start_offset, - gint end_offset); + AtkAttributeSet* (* ref_run_attributes) (AtkText *text, + gint offset, + gint *start_offset, + gint *end_offset); void (* get_character_extents) (AtkText *text, gint offset, gint *x, @@ -112,6 +120,10 @@ struct _AtkTextIface 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); @@ -141,15 +153,16 @@ gchar* atk_text_get_text_before_offset (AtkText *tex gint offset, AtkTextBoundary boundary_type); gint atk_text_get_caret_offset (AtkText *text); -PangoAttrList* atk_text_get_range_attributes (AtkText *text, - gint start_offset, - gint end_offset); void atk_text_get_character_extents (AtkText *text, gint offset, gint *x, gint *y, gint *length, gint *width); +AtkAttributeSet* atk_text_ref_run_attributes (AtkText *text, + gint offset, + gint *start_offset, + gint *end_offset); gint atk_text_get_character_count (AtkText *text); gint atk_text_get_offset_at_point (AtkText *text, gint x, @@ -170,6 +183,10 @@ gboolean atk_text_set_selection (AtkText *tex gint end_offset); gboolean atk_text_set_caret_offset (AtkText *text, gint offset); +gboolean atk_text_set_run_attributes (AtkText *text, + AtkAttributeSet *attrib, + gint start_offset, + gint end_offset); #ifdef __cplusplus } |