Make AtkRelation and AtkRelationSet into GObjects.
authorErwin Ireland <eire@src.gnome.org>
Mon, 30 Apr 2001 11:51:44 +0000 (11:51 +0000)
committerErwin Ireland <eire@src.gnome.org>
Mon, 30 Apr 2001 11:51:44 +0000 (11:51 +0000)
Corrected typo in atk_text_set_caret_offset() name

atk/Makefile.am
atk/atk.h
atk/atkobject.c
atk/atkobject.h
atk/atkrelation.c [new file with mode: 0755]
atk/atkrelation.h [new file with mode: 0755]
atk/atkrelationset.c [new file with mode: 0755]
atk/atkrelationset.h [new file with mode: 0755]
atk/atktext.c

index df17806..60475c8 100644 (file)
@@ -15,6 +15,8 @@ libatk_la_SOURCES =           \
        atkobject.c             \
        atkobjectfactory.c      \
        atkregistry.c           \
+       atkrelation.c           \
+       atkrelationset.c        \
        atkselection.c          \
        atktable.c              \
        atktext.c               \
@@ -42,6 +44,8 @@ libatkinclude_HEADERS =       \
        atkobjectfactory.h      \
         atkimage.h             \
         atkregistry.h          \
+        atkrelation.h          \
+        atkrelationset.h       \
         atkselection.h         \
         atktable.h             \
         atktext.h              \
index a9bf7e2..a501c3e 100755 (executable)
--- a/atk/atk.h
+++ b/atk/atk.h
@@ -26,6 +26,8 @@
 #include <atk/atkimage.h>
 #include <atk/atkobjectfactory.h>
 #include <atk/atkregistry.h>
+#include <atk/atkrelation.h>
+#include <atk/atkrelationset.h>
 #include <atk/atkselection.h>
 #include <atk/atktable.h>
 #include <atk/atktext.h>
index 00b44ed..5bb63bd 100755 (executable)
@@ -44,18 +44,6 @@ enum {
   LAST_SIGNAL
 };
 
-struct _AtkRelationSet
-{
-  GArray     *relations;
-};
-
-struct _AtkRelation
-{
-  GArray              *target;
-  AtkRelationType     relationship;
-};
-
-
 static void            atk_object_class_init       (AtkObjectClass  *klass);
 static void            atk_object_init             (AtkObject       *accessible,
                                                     AtkObjectClass  *klass);
@@ -222,9 +210,6 @@ static void
 atk_object_init  (AtkObject        *accessible,
                   AtkObjectClass   *klass)
 {
-    accessible->relation_set = g_malloc (sizeof (AtkRelationSet));
-    g_return_if_fail (accessible->relation_set != NULL);
-    accessible->relation_set->relations = NULL;
 }
 
 GType
@@ -495,159 +480,6 @@ atk_object_remove_property_change_handler  (AtkObject *accessible,
     (klass->remove_property_change_handler) (accessible, handler_id);
 }
 
-AtkRelationType
-atk_relation_type_register (const gchar *name)
-{
-  /* TODO: associate name with new type */
-  static guint type = ATK_RELATION_LAST_DEFINED;
-  return (++type);
-}
-
-AtkRelation*
-atk_relation_new (GArray          *target,
-                  AtkRelationType relationship)
-{
-  AtkRelation* relation;
-  g_return_val_if_fail (target != NULL, NULL);
-
-  relation = (AtkRelation *) g_malloc (sizeof (AtkRelation));
-
-  g_return_val_if_fail ((relation != NULL), NULL);
-
-  relation->target = target;
-  relation->relationship = relationship;
-
-  return relation;
-}
-
-gboolean
-atk_relation_set_contains (AtkRelationSet   *set,
-                           AtkRelationType  relationship)
-{
-  GArray *array_item;
-  AtkRelation *item;
-  gint  i;
-
-  g_return_val_if_fail (set != NULL, FALSE);
-
-  array_item = set->relations;
-  if (array_item == NULL)
-    return FALSE;
-  for (i = 0; i < array_item->len; i++)
-  {
-    item = g_array_index (array_item, AtkRelation*, i);
-    if (item->relationship == relationship)
-      return TRUE;
-  }
-  return FALSE;
-}
-
-void
-atk_relation_set_remove (AtkRelationSet *set,
-                         AtkRelation    *relation)
-{
-  GArray *array_item;
-  AtkRelation *item;
-  gint  i;
-
-  g_return_if_fail (set != NULL);
-  g_return_if_fail (relation != NULL);
-
-  array_item = set->relations;
-  if (array_item == NULL)
-    return;
-  for (i = 0; i < array_item->len; i++)
-  {
-    item = g_array_index (array_item, AtkRelation*, i);
-    if (item == relation)
-    {
-      g_array_remove_index (array_item, i);
-      return;
-    }
-  }
-}
-
-void
-atk_relation_set_add (AtkRelationSet *set,
-                      AtkRelation    *relation)
-{
-  g_return_if_fail (set != NULL);
-  g_return_if_fail (relation != NULL);
-
-  if (set->relations == NULL)
-  {
-    set->relations = g_array_new (FALSE, TRUE, sizeof (AtkRelation));
-  }
-  set->relations = g_array_append_val (set->relations, relation);
-}
-
-gint
-atk_relation_set_get_n_relations (AtkRelationSet *set)
-{
-  g_return_val_if_fail (set != NULL, 0);
-
-  if (set->relations == NULL)
-    return 0;
-
-  return set->relations->len;
-}
-
-AtkRelation*
-atk_relation_set_get_relation (AtkRelationSet *set,
-                               gint           i)
-{
-  GArray *array_item;
-  AtkRelation* item;
-
-  g_return_val_if_fail (set != NULL, NULL);
-  g_return_val_if_fail (i >= 0, NULL);
-
-  array_item = set->relations;
-  if (array_item == NULL)
-    return NULL;
-  item = g_array_index (array_item, AtkRelation*, i);
-  if (item == NULL)
-    return NULL;
-
-  return item;
-}
-
-AtkRelation*
-atk_relation_set_get_relation_by_type (AtkRelationSet  *set,
-                                       AtkRelationType relationship)
-{
-  GArray *array_item;
-  AtkRelation *item;
-  gint i;
-
-  g_return_val_if_fail (set != NULL, NULL);
-
-  array_item = set->relations;
-  if (array_item == NULL)
-    return NULL;
-  for (i = 0; i < array_item->len; i++)
-  {
-    item = g_array_index (array_item, AtkRelation*, i);
-    if (item->relationship == relationship)
-      return item;
-  }
-  return NULL;
-}
-
-AtkRelationType
-atk_relation_get_type (AtkRelation *relation)
-{
-  g_return_val_if_fail (relation != NULL, 0);
-  return relation->relationship;
-}
-
-GArray*
-atk_relation_get_target (AtkRelation *relation)
-{
-  g_return_val_if_fail (relation != NULL, 0);
-  return relation->target;
-}
-
 G_CONST_RETURN gchar*
 atk_state_mask_get_name (AtkStateMask state)
 {
@@ -765,7 +597,6 @@ static void
 atk_object_finalize (GObject *object)
 {
   AtkObject        *accessible;
-  GArray           *relations;
 
   g_return_if_fail (ATK_IS_OBJECT (object));
 
@@ -775,23 +606,12 @@ atk_object_finalize (GObject *object)
   g_free (accessible->description);
 
   /*
-   * Free memory allocated for relations and relation sets;
+   * Free memory allocated for relation set if it have been allocated.
    */
-  relations = accessible->relation_set->relations;
-  if (relations)
+  if (accessible->relation_set)
   {
-    gint        len = relations->len;
-    gint        i;
-    AtkRelation *relation;
-
-    for (i = 0; i < len; i++)
-    {
-      relation = g_array_index (relations, AtkRelation*, i);
-      g_array_free (relation->target, TRUE);
-    }
-    g_array_free (relations, TRUE);
+    g_object_unref (accessible->relation_set);
   }
-  g_free (accessible->relation_set);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
index 2167049..9f0cefb 100755 (executable)
@@ -324,7 +324,6 @@ typedef struct _AtkImplementorIface       AtkImplementorIface;
 
 typedef struct _AtkObject                 AtkObject;
 typedef struct _AtkObjectClass            AtkObjectClass;
-typedef struct _AtkRelation               AtkRelation;
 typedef struct _AtkRelationSet            AtkRelationSet;
 
 typedef guint64                           AtkStateMask;
@@ -563,67 +562,6 @@ void                 atk_object_remove_property_change_handler  (AtkObject
  *    cpos = atk_text_get_caret_position (ATK_TEXT (accessible));
  */
 
-typedef enum
-{
-  ATK_RELATION_NULL = 0,
-
-  ATK_RELATION_CONTROLLED_BY,
-  ATK_RELATION_CONTROLLER_FOR,
-  ATK_RELATION_LABEL_FOR,
-  ATK_RELATION_LABELLED_BY,
-  ATK_RELATION_MEMBER_OF,
-  ATK_RELATION_LAST_DEFINED
-} AtkRelationType;
-
-AtkRelationType atk_relation_type_register            (const gchar *name);
-
-/*
- * Create a new relation for the specified key and the specified list
- * of targets.
- */
-AtkRelation*    atk_relation_new                      (GArray          *target,
-                                                       AtkRelationType relationship);
-/*
- * Returns whether the relation set contains a relation that matches the
- * specified type.
- */
-gboolean        atk_relation_set_contains             (AtkRelationSet  *set,
-                                                       AtkRelationType relationship);
-/*
- * Remove a relation from the from the relation set.
- */
-void            atk_relation_set_remove               (AtkRelationSet  *set,
-                                                       AtkRelation     *relation);
-/*
- * Add a new relation to the current relation set if it is not already
- * present.
- */
-void            atk_relation_set_add                  (AtkRelationSet  *set,
-                                                       AtkRelation     *relation);
-/*
- * Returns the number of relations in a relation set.
- */
-gint            atk_relation_set_get_n_relations      (AtkRelationSet  *set);
-/*
- * Returns the relation at the specified position in the relation set.
- */
-AtkRelation*    atk_relation_set_get_relation         (AtkRelationSet  *set,
-                                                       gint            i);
-/*
- * Returns a relation that matches the specified type.
- */
-AtkRelation*    atk_relation_set_get_relation_by_type (AtkRelationSet  *set,
-                                                       AtkRelationType relationship);
-
-/*
- * Returns the type of a relation.
- */
-AtkRelationType atk_relation_get_type                 (AtkRelation     *relation);
-/*
- * Returns the target list of a relation.
- */
-GArray*         atk_relation_get_target               (AtkRelation     *relation);
-
 G_CONST_RETURN gchar* atk_state_mask_get_name         (AtkStateMask    state);
 AtkStateMask          atk_state_mask_for_name         (const gchar     *name);
 
diff --git a/atk/atkrelation.c b/atk/atkrelation.c
new file mode 100755 (executable)
index 0000000..e57bf79
--- /dev/null
@@ -0,0 +1,122 @@
+/* ATK -  Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib-object.h>
+#include "atkobject.h"
+#include "atkrelation.h"
+
+static void            atk_relation_class_init       (AtkRelationClass  *klass);
+static void            atk_relation_finalize         (GObject           *object);
+
+GType
+atk_relation_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      static const GTypeInfo typeInfo =
+      {
+        sizeof (AtkObjectClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) atk_relation_class_init,
+        (GClassFinalizeFunc) NULL,
+        NULL,
+        sizeof (AtkObject),
+        0,
+        (GInstanceInitFunc) NULL,
+      } ;
+      type = g_type_register_static (G_TYPE_OBJECT, "AtkRelation", &typeInfo, 0) ;
+    }
+  return type;
+}
+
+static void
+atk_relation_class_init (AtkRelationClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->finalize = atk_relation_finalize;
+}
+
+AtkRelationType
+atk_relation_type_register (const gchar *name)
+{
+  /* TODO: associate name with new type */
+  static guint type = ATK_RELATION_LAST_DEFINED;
+  return (++type);
+}
+
+AtkRelation*
+atk_relation_new (AtkObject       **targets,
+                  gint            n_targets,
+                  AtkRelationType relationship)
+{
+  AtkRelation *relation;
+  int         i;
+  GArray      *array;
+
+  g_return_val_if_fail (targets != NULL, NULL);
+
+  relation = g_object_new (ATK_TYPE_RELATION, NULL);
+  array = g_array_sized_new (FALSE, FALSE, sizeof (AtkObject *), n_targets);
+  for (i = 0; i < n_targets; i++)
+  {
+    g_array_insert_vals (array, i, &targets[i], sizeof (AtkObject *));
+  }
+  
+  relation->target = array;
+  relation->relationship = relationship;
+
+  return relation;
+}
+
+AtkRelationType
+atk_relation_get_relation_type (AtkRelation *relation)
+{
+  g_return_val_if_fail (relation != NULL, 0);
+  g_return_val_if_fail (ATK_IS_RELATION (relation), 0);
+  
+  return relation->relationship;
+}
+
+GArray*
+atk_relation_get_target (AtkRelation *relation)
+{
+  g_return_val_if_fail (relation != NULL, FALSE);
+  g_return_val_if_fail (ATK_IS_RELATION (relation), FALSE);
+
+  return relation->target;
+}
+
+static void
+atk_relation_finalize (GObject *object)
+{
+  AtkRelation        *relation;
+
+  g_return_if_fail (ATK_IS_RELATION (object));
+
+  relation = ATK_RELATION (object);
+
+  if (relation->target)
+  {
+    g_array_free (relation->target, TRUE);
+  } 
+}
diff --git a/atk/atkrelation.h b/atk/atkrelation.h
new file mode 100755 (executable)
index 0000000..ea94817
--- /dev/null
@@ -0,0 +1,89 @@
+/* ATK -  Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __ATK_RELATION_H__
+#define __ATK_RELATION_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <glib-object.h>
+
+typedef enum
+{
+  ATK_RELATION_NULL = 0,
+
+  ATK_RELATION_CONTROLLED_BY,
+  ATK_RELATION_CONTROLLER_FOR,
+  ATK_RELATION_LABEL_FOR,
+  ATK_RELATION_LABELLED_BY,
+  ATK_RELATION_MEMBER_OF,
+  ATK_RELATION_LAST_DEFINED
+} AtkRelationType;
+
+#define ATK_TYPE_RELATION                         (atk_relation_get_type ())
+#define ATK_RELATION(obj)                         (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_RELATION, AtkRelation))
+#define ATK_RELATION_CLASS(klass)                 (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_RELATION, AtkRelationClass))
+#define ATK_IS_RELATION(obj)                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_RELATION))
+#define ATK_IS_RELATION_CLASS(klass)              (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_RELATION))
+#define ATK_RELATION_GET_CLASS(obj)               (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_RELATION, AtkRelationClass))
+
+typedef struct _AtkRelation            AtkRelation;
+typedef struct _AtkRelationClass       AtkRelationClass;
+
+
+struct _AtkRelation
+{
+  GObject parent;
+
+  GArray          *target;
+  AtkRelationType relationship;
+};
+
+struct _AtkRelationClass
+{
+  GObjectClass parent;
+};
+
+GType atk_relation_get_type (void);
+
+AtkRelationType atk_relation_type_register            (const gchar *name);
+
+/*
+ * Create a new relation for the specified key and the specified list
+ * of targets.
+ */
+AtkRelation*    atk_relation_new                      (AtkObject       **targets,
+                                                       gint            n_targets,
+                                                       AtkRelationType relationship);
+/*
+ * Returns the type of a relation.
+ */
+AtkRelationType atk_relation_get_relation_type        (AtkRelation     *relation);
+/*
+ * Returns the target list of a relation.
+ */
+GArray*         atk_relation_get_target               (AtkRelation     *relation);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __ATK_RELATION_H__ */
diff --git a/atk/atkrelationset.c b/atk/atkrelationset.c
new file mode 100755 (executable)
index 0000000..ee4dd54
--- /dev/null
@@ -0,0 +1,208 @@
+/* ATK -  Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib-object.h>
+
+#include "atk.h"
+
+static void            atk_relation_set_class_init       (AtkRelationSetClass  *klass);
+static void            atk_relation_set_finalize         (GObject              *object);
+
+GType
+atk_relation_set_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      static const GTypeInfo typeInfo =
+      {
+        sizeof (AtkObjectClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) atk_relation_set_class_init,
+        (GClassFinalizeFunc) NULL,
+        NULL,
+        sizeof (AtkObject),
+        0,
+        (GInstanceInitFunc) NULL,
+      } ;
+      type = g_type_register_static (G_TYPE_OBJECT, "AtkRelatioSet", &typeInfo, 0) ;
+    }
+  return type;
+}
+
+static void
+atk_relation_set_class_init (AtkRelationSetClass *klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->finalize = atk_relation_set_finalize;
+}
+
+AtkRelationSet*
+atk_relation_set_new (void)
+{
+  AtkRelationSet *relation_set;
+
+  relation_set = g_object_new (ATK_TYPE_RELATION_SET, NULL);
+  return relation_set;
+}
+
+gboolean
+atk_relation_set_contains (AtkRelationSet   *set,
+                           AtkRelationType  relationship)
+{
+  GArray *array_item;
+  AtkRelation *item;
+  gint  i;
+
+  g_return_val_if_fail (set != NULL, FALSE);
+  g_return_val_if_fail (ATK_IS_RELATION_SET (set), FALSE);
+
+  array_item = set->relations;
+  if (array_item == NULL)
+    return FALSE;
+  for (i = 0; i < array_item->len; i++)
+  {
+    item = g_array_index (array_item, AtkRelation*, i);
+    if (item->relationship == relationship)
+      return TRUE;
+  }
+  return FALSE;
+}
+
+void
+atk_relation_set_remove (AtkRelationSet *set,
+                         AtkRelation    *relation)
+{
+  GArray *array_item;
+  AtkRelation *item;
+  gint  i;
+
+  g_return_if_fail (set != NULL);
+  g_return_if_fail (ATK_IS_RELATION_SET (set));
+  g_return_if_fail (relation != NULL);
+
+  array_item = set->relations;
+  if (array_item == NULL)
+    return;
+  for (i = 0; i < array_item->len; i++)
+  {
+    item = g_array_index (array_item, AtkRelation*, i);
+    if (item == relation)
+    {
+      g_array_remove_index (array_item, i);
+      return;
+    }
+  }
+}
+
+void
+atk_relation_set_add (AtkRelationSet *set,
+                      AtkRelation    *relation)
+{
+  g_return_if_fail (set != NULL);
+  g_return_if_fail (ATK_IS_RELATION_SET (set));
+  g_return_if_fail (relation != NULL);
+
+  if (set->relations == NULL)
+  {
+    set->relations = g_array_new (FALSE, TRUE, sizeof (AtkRelation));
+  }
+  set->relations = g_array_append_val (set->relations, relation);
+}
+
+gint
+atk_relation_set_get_n_relations (AtkRelationSet *set)
+{
+  g_return_val_if_fail (set != NULL, 0);
+  g_return_val_if_fail (ATK_IS_RELATION_SET (set), FALSE);
+
+  if (set->relations == NULL)
+    return 0;
+
+  return set->relations->len;
+}
+
+AtkRelation*
+atk_relation_set_get_relation (AtkRelationSet *set,
+                               gint           i)
+{
+  GArray *array_item;
+  AtkRelation* item;
+
+  g_return_val_if_fail (set != NULL, NULL);
+  g_return_val_if_fail (ATK_IS_RELATION_SET (set), FALSE);
+  g_return_val_if_fail (i >= 0, NULL);
+
+  array_item = set->relations;
+  if (array_item == NULL)
+    return NULL;
+  item = g_array_index (array_item, AtkRelation*, i);
+  if (item == NULL)
+    return NULL;
+
+  return item;
+}
+
+AtkRelation*
+atk_relation_set_get_relation_by_type (AtkRelationSet  *set,
+                                       AtkRelationType relationship)
+{
+  GArray *array_item;
+  AtkRelation *item;
+  gint i;
+
+  g_return_val_if_fail (set != NULL, NULL);
+  g_return_val_if_fail (ATK_IS_RELATION_SET (set), FALSE);
+
+  array_item = set->relations;
+  if (array_item == NULL)
+    return NULL;
+  for (i = 0; i < array_item->len; i++)
+  {
+    item = g_array_index (array_item, AtkRelation*, i);
+    if (item->relationship == relationship)
+      return item;
+  }
+  return NULL;
+}
+
+static void
+atk_relation_set_finalize (GObject *object)
+{
+  AtkRelationSet     *relation_set;
+  GArray             *array;
+  gint               i;
+
+  g_return_if_fail (ATK_IS_RELATION_SET (object));
+
+  relation_set = ATK_RELATION_SET (object);
+  array = relation_set->relations;
+
+  if (array)
+  {
+    for (i = 0; i < array->len; i++)
+    {
+      g_object_unref (g_array_index (array, AtkRelation *, i));
+    }
+    g_array_free (array, TRUE);
+  }
+}
diff --git a/atk/atkrelationset.h b/atk/atkrelationset.h
new file mode 100755 (executable)
index 0000000..654598f
--- /dev/null
@@ -0,0 +1,98 @@
+/* ATK -  Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __ATK_RELATION_SET_H__
+#define __ATK_RELATION_SET_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <glib-object.h>
+#include <atk/atkobject.h>
+#include <atk/atkrelation.h>
+
+#define ATK_TYPE_RELATION_SET                     (atk_relation_set_get_type ())
+#define ATK_RELATION_SET(obj)                     (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_RELATION_SET, AtkRelationSet))
+#define ATK_RELATION_SET_CLASS(klass)             (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_RELATION_SET, AtkRelationSetClass))
+#define ATK_IS_RELATION_SET(obj)                  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_RELATION_SET))
+#define ATK_IS_RELATION_SET_CLASS(klass)          (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_RELATION_SET))
+#define ATK_RELATION_SET_GET_CLASS(obj)           (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_RELATION_SET, AtkRelationSetClass))
+
+typedef struct _AtkRelationSetClass       AtkRelationSetClass;
+
+
+struct _AtkRelationSet
+{
+  GObject parent;
+
+  GArray *relations;
+};
+
+struct _AtkRelationSetClass
+{
+  GObjectClass parent;
+};
+
+GType atk_relation_set_get_type (void);
+
+AtkRelationType atk_relation_type_register            (const gchar *name);
+
+/*
+ * Create a new relation set.
+ */
+AtkRelationSet*    atk_relation_set_new               (void);
+/*
+ * Returns whether the relation set contains a relation that matches the
+ * specified type.
+ */
+gboolean        atk_relation_set_contains             (AtkRelationSet  *set,
+                                                       AtkRelationType relationship);
+/*
+ * Remove a relation from the from the relation set.
+ */
+void            atk_relation_set_remove               (AtkRelationSet  *set,
+                                                       AtkRelation     *relation);
+/*
+ * Add a new relation to the current relation set if it is not already
+ * present.
+ */
+void            atk_relation_set_add                  (AtkRelationSet  *set,
+                                                       AtkRelation     *relation);
+/*
+ * Returns the number of relations in a relation set.
+ */
+gint            atk_relation_set_get_n_relations      (AtkRelationSet  *set);
+/*
+ * Returns the relation at the specified position in the relation set.
+ */
+AtkRelation*    atk_relation_set_get_relation         (AtkRelationSet  *set,
+                                                       gint            i);
+/*
+ * Returns a relation that matches the specified type.
+ */
+AtkRelation*    atk_relation_set_get_relation_by_type (AtkRelationSet  *set,
+                                                       AtkRelationType relationship);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __ATK_RELATION_SET_H__ */
index d3959e6..16abdea 100755 (executable)
@@ -312,8 +312,8 @@ atk_text_set_selection_bounds (AtkText *text,
 }
 
 gboolean
-atk_text_set_selection_bounds (AtkText *text,
-                               gint    offset)
+atk_text_set_caret_offset (AtkText *text,
+                           gint    offset)
 {
   AtkTextIface *iface;