Added atk_text_set_caret_offset(...) so that "virtual caret" can be supported
authorBill Haneman <billh@src.gnome.org>
Fri, 27 Apr 2001 16:05:07 +0000 (16:05 +0000)
committerBill Haneman <billh@src.gnome.org>
Fri, 27 Apr 2001 16:05:07 +0000 (16:05 +0000)
if there is no text caret for an AtkText implementor.  Also switched return
types on get/set_selection_bounds() to follow convention where "set" methods
return a boolean to indicate success.

atk/atktext.c
atk/atktext.h

index dcc865bbc402be54cac5b8654b82fd3e24986eb6..a2734361f498a1b5fe548a61ff467d11b6849046 100755 (executable)
@@ -268,25 +268,24 @@ atk_text_get_selected_text (AtkText *text)
     return NULL;
 }
 
-gboolean
+void
 atk_text_get_selection_bounds (AtkText *text,
                                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);
+  g_return_if_fail (text != NULL);
+  g_return_if_fail (ATK_IS_TEXT (text));
 
   iface = ATK_TEXT_GET_IFACE (text);
 
   if (iface->get_selection_bounds)
-    return (*(iface->get_selection_bounds)) (text, start_offset, end_offset);
+    (*(iface->get_selection_bounds)) (text, start_offset, end_offset);
   else
   {
     *start_offset = 0;
     *end_offset = 0;
-    return FALSE;
   }
 }
 
@@ -297,11 +296,17 @@ atk_text_set_selection_bounds (AtkText *text,
 {
   AtkTextIface *iface;
 
-  g_return_if_fail (text != NULL);
-  g_return_if_fail (ATK_IS_TEXT (text));
+  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_selection_bounds)
-    (*(iface->set_selection_bounds)) (text, start_offset, end_offset);
+    {
+      return (*(iface->set_selection_bounds)) (text, start_offset, end_offset);
+    }
+  else
+    {
+      return FALSE;
+    }
 }
index 601b76a9ef8ffa24ca544ca3d935c251a70456af..51d27c1f1ccfea5243b5cc824e2c5b2a5756b238 100755 (executable)
@@ -55,46 +55,47 @@ 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);
-  void   (* get_row_col_at_offset)        (AtkText          *text,
-                                           gint             offset,
-                                           gint             *row,
-                                           gint             *col);
-  PangoAttrList* (* get_range_attributes) (AtkText          *text,
-                                           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);
-  gchar* (* get_selected_text)            (AtkText          *text);
-  gboolean (* get_selection_bounds)       (AtkText          *text,
-                                           gint             *start_offset,
-                                           gint             *end_offset);
-  void     (*  set_selection_bounds)      (AtkText         *text,
-                                           gint            start_offset,
-                                           gint            end_offset);
-
+  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);
+  void           (* get_row_col_at_offset)        (AtkText          *text,
+                                                   gint             offset,
+                                                   gint             *row,
+                                                   gint             *col);
+  PangoAttrList* (* get_range_attributes)         (AtkText          *text,
+                                                   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);
+  gchar*         (* get_selected_text)            (AtkText          *text);
+  void           (* get_selection_bounds)         (AtkText          *text,
+                                                   gint             *start_offset,
+                                                   gint             *end_offset);
+  void           (* set_selection_bounds)         (AtkText          *text,
+                                                   gint             start_offset,
+                                                   gint             end_offset);
+  gboolean       (* set_caret_offset)             (AtkText          *text,
+                                                   gint             offset);
 };
 GType            atk_text_get_type (void);
 
@@ -109,10 +110,8 @@ GType            atk_text_get_type (void);
 gchar*        atk_text_get_text                           (AtkText          *text,
                                                            gint             start_offset,
                                                            gint             end_offset);
-
 gunichar      atk_text_get_character_at_offset            (AtkText          *text,
                                                            gint             offset);
-
 gchar*        atk_text_get_text_after_offset              (AtkText          *text,
                                                            gint             offset,
                                                            AtkTextBoundary  boundary_type);
@@ -141,13 +140,14 @@ gint          atk_text_get_offset_at_point                (AtkText          *tex
                                                            gint             x,
                                                            gint             y);
 gchar*        atk_text_get_selected_text                  (AtkText          *text);
-gboolean      atk_text_get_selection_bounds               (AtkText          *text,
+void          atk_text_get_selection_bounds               (AtkText          *text,
                                                            gint             *start_offset,
                                                            gint             *end_offset);
 void          atk_text_set_selection_bounds               (AtkText          *text,
                                                            gint             start_offset,
                                                            gint             end_offset);
-
+gboolean      atk_text_set_caret_offset                   (AtkText          *text,
+                                                           gint             offset);
 
 #ifdef __cplusplus
 }