Added atk_text_ref_run_attributes() and atk_text_set_run_attributes().
authorBrian Cameron <bcameron@src.gnome.org>
Wed, 6 Jun 2001 13:42:10 +0000 (13:42 +0000)
committerBrian Cameron <bcameron@src.gnome.org>
Wed, 6 Jun 2001 13:42:10 +0000 (13:42 +0000)
Removed atk_text_get_range_attributes()

ChangeLog
atk/atktext.c
atk/atktext.h

index 8cf89ef..d94f64b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-06-06  Brian Cameron <brian.cameron@sun.com>
+       * atk/atktext.h atk/atktext.h
+       Updated to new atktext functions for getting attributes.
+
 2001-06-06  Padraig O'Briain  <padraig.obriain@sun.com>
 
        * New files atk/atkstreamablecontent.[ch]
index 78d2961..ef762bd 100755 (executable)
@@ -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
index bc63ce0..9f55658 100755 (executable)
@@ -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
 }