[g-a-devel]Re: ATK API additions for 2.2 (patch)



Hi,

I have reworked Bill's patch to do the following:

1) Fix some typos.
2) Update configure.in.
3) Add atk/atkrelationtype.h so that AtkRelationType can be referred to in 
atkobject.h
4) Add atk_action_get_localized_name() to atkaction.c
5) Add atk_role_get_localized_name() to atkobject.c.

Its implementation is not correct as it does not attempt to get a localized 
name.

6) Change return type of atk_object_add_relationship() from void to gboolean.
7) Add implementation for atk_object_add_relationship() and 
atk_object_remove_relationship()
8) Update documentation for new functions and enum values.

I propose to commit these changes tomorrow unless there are objections.

Padraig

> Subject: ATK API additions for 2.2 (patch)
> To: gnome-accessibility-devel gnome org, padraig obriain sun com
> Mime-Version: 1.0
> 
> Hi:
> 
> Attached is a patch that adds some enum values and four new methods to
> ATK; it is based on feedback from AT developers and app developers
> (including the folks working to make OpenOffice.org/StarOffice
> accessible).  It also adds one new signal to AtkText, which is sent when
> attributes in a text object change.
> 
> I won't be very available to discuss this until Monday or so... Padraig
> has agreed to work on some simple implementations for GAIL.
> 
> I hope these are the last 2.2 ATK API changes, I realize the freeze is
> RealSoonNow. :-)
> 
> best regards,
> 
> Bill
> 
> 
? atk-1.1.0
? atk-1.1.0.tar.gz
? configure.in.NEW
cvs server: Diffing .
Index: configure.in
===================================================================
RCS file: /cvs/gnome/atk/configure.in,v
retrieving revision 1.36
diff -u -p -r1.36 configure.in
--- configure.in	18 Sep 2002 12:15:21 -0000	1.36
+++ configure.in	29 Oct 2002 13:44:59 -0000
@@ -27,7 +27,7 @@ dnl set ATK_BINARY_AGE _and_ ATK_INTERFA
 dnl The triplet 
 ATK_MAJOR_VERSION=1
 ATK_MINOR_VERSION=1
-ATK_MICRO_VERSION=0
+ATK_MICRO_VERSION=1
 ATK_VERSION=$ATK_MAJOR_VERSION.$ATK_MINOR_VERSION.$ATK_MICRO_VERSION
 
 dnl The X.Y in -latk-X.Y line. This is expected to stay 1.0 until Atk 2.
cvs server: Diffing atk
Index: atk/Makefile.am
===================================================================
RCS file: /cvs/gnome/atk/atk/Makefile.am,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile.am
--- atk/Makefile.am	14 Mar 2002 20:46:44 -0000	1.27
+++ atk/Makefile.am	29 Oct 2002 13:44:59 -0000
@@ -98,6 +98,7 @@ atk_headers = \
         atkimage.h		\
         atkregistry.h		\
         atkrelation.h		\
+        atkrelationtype.h	\
         atkrelationset.h	\
         atkselection.h		\
         atkstate.h		\
Index: atk/atk.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atk.h,v
retrieving revision 1.9
diff -u -p -r1.9 atk.h
--- atk/atk.h	16 Aug 2002 15:36:54 -0000	1.9
+++ atk/atk.h	29 Oct 2002 13:44:59 -0000
@@ -35,6 +35,7 @@
 #include <atk/atkregistry.h>
 #include <atk/atkrelation.h>
 #include <atk/atkrelationset.h>
+#include <atk/atkrelationtype.h>
 #include <atk/atkselection.h>
 #include <atk/atkstate.h>
 #include <atk/atkstateset.h>
Index: atk/atkaction.c
===================================================================
RCS file: /cvs/gnome/atk/atk/atkaction.c,v
retrieving revision 1.11
diff -u -p -r1.11 atkaction.c
--- atk/atkaction.c	11 Feb 2002 16:38:45 -0000	1.11
+++ atk/atkaction.c	29 Oct 2002 13:44:59 -0000
@@ -144,6 +144,32 @@ atk_action_get_name (AtkAction *obj,
 }
 
 /**
+ * atk_action_get_localized_name:
+ * @action: a #GObject instance that implements AtkActionIface
+ * @i: the action index corresponding to the action to be performed 
+ *
+ * Returns the localized name of the specified action of the object.
+ *
+ * Returns a name string, or %NULL
+ * if @action does not implement this interface.
+ **/
+G_CONST_RETURN gchar*
+atk_action_get_localized_name (AtkAction *obj,
+                               gint      i)
+{
+  AtkActionIface *iface;
+
+  g_return_val_if_fail (ATK_IS_ACTION (obj), NULL);
+
+  iface = ATK_ACTION_GET_IFACE (obj);
+
+  if (iface->get_localized_name)
+    return (iface->get_localized_name) (obj, i);
+  else
+    return NULL;
+}
+
+/**
  * atk_action_get_keybinding:
  * @action: a #GObject instance that implements AtkActionIface
  * @i: the action index corresponding to the action to be performed 
Index: atk/atkaction.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atkaction.h,v
retrieving revision 1.8
diff -u -p -r1.8 atkaction.h
--- atk/atkaction.h	13 Feb 2002 14:15:05 -0000	1.8
+++ atk/atkaction.h	29 Oct 2002 13:44:59 -0000
@@ -63,7 +63,8 @@ struct _AtkActionIface
                                                 gint              i,
                                                 const gchar       *desc);
 
-  AtkFunction             pad1;
+  AtkFunction             (*get_localized_name)(AtkAction         *action,
+						gint              i);
   AtkFunction             pad2;
 };
 
@@ -93,6 +94,10 @@ gboolean              atk_action_set_des
                                                    gint              i,
                                                    const gchar       *desc);
 
+/* NEW in ATK 1.1: */
+
+G_CONST_RETURN gchar* atk_action_get_localized_name (AtkAction       *action,
+						     gint            i);
 
 /*
  * Additional GObject properties exported by AtkAction:
Index: atk/atkobject.c
===================================================================
RCS file: /cvs/gnome/atk/atk/atkobject.c,v
retrieving revision 1.50
diff -u -p -r1.50 atkobject.c
--- atk/atkobject.c	1 Oct 2002 10:07:12 -0000	1.50
+++ atk/atkobject.c	29 Oct 2002 13:45:00 -0000
@@ -1142,6 +1142,22 @@ atk_role_get_name (AtkRole role)
 }
 
 /**
+ * atk_role_get_localized_name:
+ * @role: The #AtkRole whose localized name is required
+ *
+ * Gets the localized description string describing the #Roleype @role.
+ *
+ * Returns: the localized string describing the AtkRole
+ **/
+G_CONST_RETURN gchar*
+atk_role_get_localized_name (AtkRole role)
+{
+  /* TODO */
+
+  return atk_role_get_name (role);
+}
+
+/**
  * atk_role_for_name:
  * @name: a string which is the (non-localized) name of an ATK role.
  *
@@ -1192,4 +1208,78 @@ atk_role_for_name (const gchar *name)
   g_type_class_unref (type_class);
   
   return role;
+}
+
+/**
+ * atk_object_add_relationship:
+ * @object: The #AtkObject to which an AtkRelation is to be added. 
+ * @relationship: The #AtkRelationType of the relation
+ * @target: The #AtkObject which is to be the target of the relation.
+ *
+ * Adds a relationship of the specified type with the specified target.
+ *
+ * Returns TRUE if the relationship is added.
+ **/
+gboolean
+atk_object_add_relationship (AtkObject       *object,
+                             AtkRelationType relationship,
+                             AtkObject       *target)
+{
+  AtkObject *array[1];
+  AtkRelation *relation;
+
+  g_return_val_if_fail (ATK_IS_OBJECT (object), FALSE);
+  g_return_val_if_fail (ATK_IS_OBJECT (target), FALSE);
+
+  array[0] = target;
+  relation = atk_relation_new (array, 1, relationship);
+  atk_relation_set_add (object->relation_set, relation);
+  g_object_unref (relation);
+
+  return TRUE;
+}
+
+/**
+ * atk_object_remove_relationship:
+ * @object: The #AtkObject from which an AtkRelation is to be removed. 
+ * @relationship: The #AtkRelationType of the relation
+ * @target: The #AtkObject which is the target of the relation to be removed.
+ *
+ * Removes a relationship of the specified type with the specified target.
+ *
+ * Returns TRUE if the relationship is removed.
+ **/
+gboolean
+atk_object_remove_relationship (AtkObject       *object,
+                                AtkRelationType relationship,
+                                AtkObject       *target)
+{
+  gint n_relations, i;
+  gboolean ret = FALSE;
+  AtkRelation *relation;
+
+  g_return_val_if_fail (ATK_IS_OBJECT (object), FALSE);
+  g_return_val_if_fail (ATK_IS_OBJECT (target), FALSE);
+
+  n_relations = atk_relation_set_get_n_relations (object->relation_set);
+  for (i = 0; i < n_relations; i++)
+    {
+      relation = atk_relation_set_get_relation (object->relation_set, i);
+      if (atk_relation_get_relation_type (relation) == relationship)
+        {
+          GPtrArray *array;
+          gint j;
+
+          array = atk_relation_get_target (relation);
+        
+          if (g_ptr_array_index (array, 0) == target)
+            {
+              atk_relation_set_remove (object->relation_set, relation); 
+              ret = TRUE;
+              break;
+            }
+        }
+    }
+
+  return ret;
 }
Index: atk/atkobject.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atkobject.h,v
retrieving revision 1.32
diff -u -p -r1.32 atkobject.h
--- atk/atkobject.h	9 Sep 2002 11:08:34 -0000	1.32
+++ atk/atkobject.h	29 Oct 2002 13:45:00 -0000
@@ -26,6 +26,7 @@ extern "C" {
 
 #include <glib-object.h>
 #include <atk/atkstate.h>
+#include <atk/atkrelationtype.h>
 
 /*
  * AtkObject represents the minimum information all accessible objects
@@ -107,7 +108,11 @@ extern "C" {
  * ATK_ROLE_TREE_TABLE: An object capable of expanding and collapsing rows as well as showing multiple columns of data
  * ATK_ROLE_UNKNOWN: The object contains some Accessible information, but its role is not known
  * ATK_ROLE_VIEWPORT: An object usually used in a scroll pane
- * ATK_ROLE_WINDOW: A top level window with no title or border
+ * ATK_ROLE_WINDOW: A top level window with no title or border.
+ * ATK_ROLE_HEADER: An object that serves as a document header.
+ * ATK_ROLE_FOOTER: An object that serves as a document footer.
+ * ATK_ROLE_PARAGRAPH: An object which is contains a paragraph of text content.
+ * ATK_ROLE_RULER: An object which describes margins and tab stops, etc. for text objects which it controls (should have CONTROLLER_FOR relation to such).
  * ATK_ROLE_LAST_DEFINED: not a valid role, used for finding end of enumeration
  * 
  *Describes the role of an object
@@ -183,6 +188,10 @@ typedef enum
   ATK_ROLE_UNKNOWN,
   ATK_ROLE_VIEWPORT,
   ATK_ROLE_WINDOW,
+  ATK_ROLE_HEADER,
+  ATK_ROLE_FOOTER,
+  ATK_ROLE_PARAGRAPH,
+  ATK_ROLE_RULER,
   ATK_ROLE_LAST_DEFINED
 } AtkRole;
 
@@ -456,6 +465,16 @@ void                 atk_object_initiali
                                     
 G_CONST_RETURN gchar* atk_role_get_name      (AtkRole         role);
 AtkRole               atk_role_for_name      (const gchar     *name);
+
+
+/* NEW in 1.1: convenience API */
+gboolean              atk_object_add_relationship              (AtkObject      *object,
+								AtkRelationType relationship,
+								AtkObject      *target);
+gboolean              atk_object_remove_relationship           (AtkObject      *object,
+								AtkRelationType relationship,
+								AtkObject      *target);
+G_CONST_RETURN gchar* atk_role_get_localized_name              (AtkRole     role);
 
 
 /*
Index: atk/atkrelation.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atkrelation.h,v
retrieving revision 1.7
diff -u -p -r1.7 atkrelation.h
--- atk/atkrelation.h	22 Nov 2001 15:58:56 -0000	1.7
+++ atk/atkrelation.h	29 Oct 2002 13:45:00 -0000
@@ -25,6 +25,7 @@ extern "C" {
 #endif /* __cplusplus */
 
 #include <glib-object.h>
+#include <atk/atkrelationtype.h>
 
 /*
  * An AtkRelation describes a relation between the object and one or more 
@@ -32,31 +33,6 @@ extern "C" {
  * are defined as an AtkRelationSet, which is a set of AtkRelations. 
  */
 
-/**
- *AtkRelationType:
- * ATK_RELATION_NULL:
- * ATK_RELATION_CONTROLLED_BY: Indicates an object controlled by one or more target objects.
- * ATK_RELATION_CONTROLLER_FOR: Indicates an object is an controller for one or more target objects.
- * ATK_RELATION_LABEL_FOR: Indicates an object is a label for one or more target objects.
- * ATK_RELATION_LABELLED_BY: Indicates an object is labelled by one or more target objects.
- * ATK_RELATION_MEMBER_OF: Indicates an object is a member of a group of one or more target objects.
- * ATK_RELATION_NODE_CHILD_OF: Indicates an object is a cell in a treetable which is displayed because a cell in the same column is expanded and identifies that cell.
- * ATK_RELATION_LAST_DEFINED:
- * 
- *Describes the type of the relation
- **/
-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_NODE_CHILD_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))
@@ -66,7 +42,6 @@ typedef enum
 
 typedef struct _AtkRelation            AtkRelation;
 typedef struct _AtkRelationClass       AtkRelationClass;
-
 
 struct _AtkRelation
 {
cvs server: atk/atkrelationtype.h is a new entry, no comparison available
Index: atk/atkstate.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atkstate.h,v
retrieving revision 1.6
diff -u -p -r1.6 atkstate.h
--- atk/atkstate.h	20 Nov 2001 11:38:38 -0000	1.6
+++ atk/atkstate.h	29 Oct 2002 13:45:00 -0000
@@ -57,6 +57,9 @@ extern "C" {
  * ATK_STATE_TRANSIENT: Indicates this object is transient
  * ATK_STATE_VERTICAL: Indicates the orientation of this object is vertical
  * ATK_STATE_VISIBLE: Indicates this object is visible
+ * ATK_STATE_MANAGES_DESCENDANTS: Indicates that "active-descendant-changed" event
+ * is sent when children become 'active' (i.e. are selected or navigated to onscreen).
+ * Used to prevent need to enumerate all children in very large containers, like tables.
  * ATK_STATE_LAST_DEFINED: Not a valid role, used for finding end of enumeration
  *
  *The possible types of states of an object
@@ -92,6 +95,7 @@ typedef enum
   ATK_STATE_TRANSIENT,
   ATK_STATE_VERTICAL,
   ATK_STATE_VISIBLE,
+  ATK_STATE_MANAGES_DESCENDANTS,
   ATK_STATE_LAST_DEFINED
 } AtkStateType;
 
Index: atk/atktext.c
===================================================================
RCS file: /cvs/gnome/atk/atk/atktext.c,v
retrieving revision 1.52
diff -u -p -r1.52 atktext.c
--- atk/atktext.c	5 Mar 2002 12:25:15 -0000	1.52
+++ atk/atktext.c	29 Oct 2002 13:45:00 -0000
@@ -29,6 +29,7 @@ enum {
   TEXT_CHANGED,
   TEXT_CARET_MOVED,
   TEXT_SELECTION_CHANGED,
+  TEXT_ATTRIBUTES_CHANGED,
   LAST_SIGNAL
 };
 
@@ -126,6 +127,14 @@ atk_text_base_init (gpointer *g_class)
                       ATK_TYPE_TEXT,
                       G_SIGNAL_RUN_LAST,
                       G_STRUCT_OFFSET (AtkTextIface, text_selection_changed),
+                      (GSignalAccumulator) NULL, NULL,
+                      g_cclosure_marshal_VOID__VOID,
+                      G_TYPE_NONE, 0);
+      atk_text_signals[TEXT_ATTRIBUTES_CHANGED] =
+        g_signal_new ("text_attributes_changed",
+                      ATK_TYPE_TEXT,
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (AtkTextIface, text_attributes_changed),
                       (GSignalAccumulator) NULL, NULL,
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
Index: atk/atktext.h
===================================================================
RCS file: /cvs/gnome/atk/atk/atktext.h,v
retrieving revision 1.28
diff -u -p -r1.28 atktext.h
--- atk/atktext.h	13 Feb 2002 14:15:05 -0000	1.28
+++ atk/atktext.h	29 Oct 2002 13:45:00 -0000
@@ -227,7 +227,8 @@ struct _AtkTextIface
                                                    gint             location);
   void           (* text_selection_changed)       (AtkText          *text);
 
-  AtkFunction    pad1;
+  void           (* text_attributes_changed)      (AtkText          *text);
+
   AtkFunction    pad2;
   AtkFunction    pad3;
   AtkFunction    pad4;
cvs server: Diffing docs
Index: docs/atk-sections.txt
===================================================================
RCS file: /cvs/gnome/atk/docs/atk-sections.txt,v
retrieving revision 1.31
diff -u -p -r1.31 atk-sections.txt
--- docs/atk-sections.txt	6 Sep 2002 07:01:21 -0000	1.31
+++ docs/atk-sections.txt	29 Oct 2002 13:45:00 -0000
@@ -6,6 +6,7 @@ atk_action_do_action
 atk_action_get_n_actions
 atk_action_get_description
 atk_action_get_name
+atk_action_get_localized_name
 atk_action_get_keybinding
 atk_action_set_description
 <SUBSECTION Standard>
@@ -173,7 +174,10 @@ atk_object_connect_property_change_handl
 atk_object_remove_property_change_handler
 atk_object_notify_state_change
 atk_object_initialize
+atk_object_add_relationship
+atk_object_remove_relationship
 atk_role_get_name
+atk_role_get_localized_name
 atk_role_for_name
 <SUBSECTION Standard>
 AtkImplementorIface
cvs server: Diffing docs/tmpl
Index: docs/tmpl/atkaction.sgml
===================================================================
RCS file: /cvs/gnome/atk/docs/tmpl/atkaction.sgml,v
retrieving revision 1.15
diff -u -p -r1.15 atkaction.sgml
--- docs/tmpl/atkaction.sgml	5 Sep 2002 13:51:09 -0000	1.15
+++ docs/tmpl/atkaction.sgml	29 Oct 2002 13:45:00 -0000
@@ -86,6 +86,16 @@ The AtkAction structure does not contain
 @Returns: 
 
 
+<!-- ##### FUNCTION atk_action_get_localized_name ##### -->
+<para>
+
+</para>
+
+ action: 
+ i: 
+ Returns: 
+
+
 <!-- ##### FUNCTION atk_action_get_keybinding ##### -->
 <para>
 
Index: docs/tmpl/atkobject.sgml
===================================================================
RCS file: /cvs/gnome/atk/docs/tmpl/atkobject.sgml,v
retrieving revision 1.24
diff -u -p -r1.24 atkobject.sgml
--- docs/tmpl/atkobject.sgml	18 Sep 2002 12:15:21 -0000	1.24
+++ docs/tmpl/atkobject.sgml	29 Oct 2002 13:45:00 -0000
@@ -114,6 +114,10 @@ ATK_ROLE_LAST_DEFINED is not necessarily
 @ATK_ROLE_UNKNOWN: 
 @ATK_ROLE_VIEWPORT: 
 @ATK_ROLE_WINDOW: 
+ ATK_ROLE_HEADER: 
+ ATK_ROLE_FOOTER: 
+ ATK_ROLE_PARAGRAPH: 
+ ATK_ROLE_RULER: 
 @ATK_ROLE_LAST_DEFINED: 
 
 <!-- ##### FUNCTION atk_role_register ##### -->
@@ -369,7 +373,38 @@ atk_object_connect_property_change_handl
 @data: 
 
 
+<!-- ##### FUNCTION atk_object_add_relationship ##### -->
+<para>
+
+</para>
+
+ object: 
+ relationship: 
+ target: 
+ Returns: 
+
+
+<!-- ##### FUNCTION atk_object_remove_relationship ##### -->
+<para>
+
+</para>
+
+ object: 
+ relationship: 
+ target: 
+ Returns: 
+
+
 <!-- ##### FUNCTION atk_role_get_name ##### -->
+<para>
+
+</para>
+
+ role: 
+ Returns: 
+
+
+<!-- ##### FUNCTION atk_role_get_localized_name ##### -->
 <para>
 
 </para>
Index: docs/tmpl/atkrelation.sgml
===================================================================
RCS file: /cvs/gnome/atk/docs/tmpl/atkrelation.sgml,v
retrieving revision 1.10
diff -u -p -r1.10 atkrelation.sgml
--- docs/tmpl/atkrelation.sgml	5 Sep 2002 12:49:21 -0000	1.10
+++ docs/tmpl/atkrelation.sgml	29 Oct 2002 13:45:00 -0000
@@ -38,6 +38,9 @@ The AtkRelation structure should not be 
 @ATK_RELATION_LABELLED_BY: 
 @ATK_RELATION_MEMBER_OF: 
 @ATK_RELATION_NODE_CHILD_OF: 
+ ATK_RELATION_FLOWS_TO: 
+ ATK_RELATION_FLOWS_FROM: 
+ ATK_RELATION_SUBWINDOW_OF: 
 @ATK_RELATION_LAST_DEFINED: 
 
 <!-- ##### FUNCTION atk_relation_type_register ##### -->
Index: docs/tmpl/atkstate.sgml
===================================================================
RCS file: /cvs/gnome/atk/docs/tmpl/atkstate.sgml,v
retrieving revision 1.15
diff -u -p -r1.15 atkstate.sgml
--- docs/tmpl/atkstate.sgml	5 Sep 2002 12:49:21 -0000	1.15
+++ docs/tmpl/atkstate.sgml	29 Oct 2002 13:45:00 -0000
@@ -49,6 +49,7 @@ an component is described by its AtkStat
 @ATK_STATE_TRANSIENT: 
 @ATK_STATE_VERTICAL: 
 @ATK_STATE_VISIBLE: 
+ ATK_STATE_MANAGES_DESCENDANTS: 
 @ATK_STATE_LAST_DEFINED: 
 
 <!-- ##### TYPEDEF AtkState ##### -->
Index: docs/tmpl/atktext.sgml
===================================================================
RCS file: /cvs/gnome/atk/docs/tmpl/atktext.sgml,v
retrieving revision 1.32
diff -u -p -r1.32 atktext.sgml
--- docs/tmpl/atktext.sgml	5 Sep 2002 13:51:09 -0000	1.32
+++ docs/tmpl/atktext.sgml	29 Oct 2002 13:45:00 -0000
@@ -336,6 +336,13 @@ The AtkText structure does not contain a
 @Returns: 
 
 
+<!-- ##### SIGNAL AtkText::text-attributes-changed ##### -->
+<para>
+
+</para>
+
+ atktext: the object which received the signal.
+
 <!-- ##### SIGNAL AtkText::text-caret-moved ##### -->
 <para>
 
cvs server: Diffing tests


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]