2001-12-22 Marc Mulcahy <marc.mulcahy@sun.com>
authormarcm <marcm@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 2 Jan 2002 19:53:20 +0000 (19:53 +0000)
committermarcm <marcm@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 2 Jan 2002 19:53:20 +0000 (19:53 +0000)
* at-bridge/bridge.c: Added registration for separate
"Atktext:text-changed::insert" and "AtkText:text-changed::delete"
signals.  If either of the first two parameters to the generic
bridge signal handler are ints, they are passed on as event
details.  This allows an AT to determine what text was inserted.

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@195 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
cspi/spi.h
cspi/spi_accessible.c
idl/Accessibility_Relation.idl
libspi/relation.c

index d4d2407..689ced6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2002-01-02 Marc Mulcahy  <marc.mulcahy@sun.com>
+
+       * cspi/spi.h: synched relation types with ATK
+
+       * cspi/spi_accessible.c: Added implementations of
+       AcccessibleRelation_* methods
+
+       * idl/Accessibility_Relation.idl: added getRelationTypeName
+       method.  Synched known relation types with ATK.  Allowed for
+       relation type extension with the RELATION_EXTENDED type.
+       
+       * libspi/relation.c: Provided implementations for
+       AccessibleRelation methods.
+
 2002-01-01  Bill Haneman <bill.haneman@sun.com>
 
        API tweaks for today's API 'freeze'.
index eb5db12..7ebe098 100644 (file)
@@ -43,11 +43,15 @@ typedef enum
 
 typedef enum
 {
+  SPI_RELATION_NULL,
   SPI_RELATION_LABEL_FOR,
   SPI_RELATION_LABELED_BY,
   SPI_RELATION_CONTROLLER_FOR,
   SPI_RELATION_CONTROLLED_BY,
-  SPI_RELATION_MEMBER_OF
+  SPI_RELATION_MEMBER_OF,
+  SPI_RELATION_NODE_CHILD_OF,
+  SPI_RELATION_EXTENDED,
+  SPI_RELATION_LAST_DEFINED
 } AccessibleRelationType;
 
 
index deb496a..ead5870 100644 (file)
@@ -924,8 +924,13 @@ AccessibleRelation_unref (AccessibleRelation *obj)
 AccessibleRelationType
 AccessibleRelation_getRelationType (AccessibleRelation *obj)
 {
-  cspi_return_val_if_fail (obj != NULL, -1);
-  return 0;
+  AccessibleRelationType retval;
+  
+  cspi_return_val_if_fail (obj, SPI_RELATION_NULL);
+  retval =
+    Accessibility_Relation_getRelationType (CSPI_OBJREF (obj), cspi_ev());
+  cspi_return_val_if_ev ("getRelationType", SPI_RELATION_NULL);
+  return retval;
 }
 
 /**
@@ -943,8 +948,13 @@ AccessibleRelation_getRelationType (AccessibleRelation *obj)
 int
 AccessibleRelation_getNTargets (AccessibleRelation *obj)
 {
-  cspi_return_val_if_fail (obj != NULL, -1);
-  return 0;
+  int retval;
+  
+  cspi_return_val_if_fail (obj, -1);
+  retval = (int)
+    Accessibility_Relation_getNTargets (CSPI_OBJREF (obj), cspi_ev());
+  cspi_return_val_if_ev ("getNTargets", -1);
+  return retval;
 }
 
 /**
@@ -962,8 +972,15 @@ AccessibleRelation_getNTargets (AccessibleRelation *obj)
 Accessible *
 AccessibleRelation_getTarget (AccessibleRelation *obj, int i)
 {
-  cspi_return_val_if_fail (obj != NULL, NULL);
-  return NULL;
+  Accessible *retval;
+
+  cspi_return_val_if_fail (obj, NULL);
+
+  retval = cspi_object_add (
+                        Accessibility_Relation_getTarget (CSPI_OBJREF(obj),
+                                                          (CORBA_short) i, cspi_ev()));
+  cspi_return_val_if_ev ("getTarget", NULL);
+  return retval;
 }
 
 /**
index 9a8931a..ac4503c 100644 (file)
 module Accessibility {
 
   enum RelationType {
+    RELATION_NULL,
     RELATION_LABEL_FOR,
     RELATION_LABELLED_BY,
     RELATION_CONTROLLER_FOR,
     RELATION_CONTROLLED_BY,
     RELATION_MEMBER_OF,
     RELATION_TOOLTIP_FOR,
-    RELATION_LEAFNODE_OF
+    RELATION_NODE_CHILD_OF,
+    RELATION_EXTENDED,
+    RELATION_LAST_DEFINED
   };
 
   /*
@@ -41,6 +44,7 @@ module Accessibility {
 
   interface Relation : Bonobo::Unknown {
     RelationType        getRelationType ();
+    string getRelationTypeName ();
     short               getNTargets ();
     Object             getTarget (in short index);
     /* placeholders for future expansion */
index 260cd84..c955317 100644 (file)
 #include <libspi/relation.h>
 
 
+static gboolean
+spi_init_relation_type_table (Accessibility_RelationType *types)
+{
+  gint i;
+
+  for (i = 0; i < ATK_RELATION_LAST_DEFINED; i++)
+    types[i] = ATK_RELATION_NULL;
+
+  types[ATK_RELATION_CONTROLLED_BY] = Accessibility_RELATION_CONTROLLED_BY;
+  types[ATK_RELATION_CONTROLLER_FOR] = Accessibility_RELATION_CONTROLLER_FOR;
+  types[ATK_RELATION_LABEL_FOR] = Accessibility_RELATION_LABEL_FOR;
+  types[ATK_RELATION_LABELLED_BY] = Accessibility_RELATION_LABELLED_BY;
+  types[ATK_RELATION_MEMBER_OF] = Accessibility_RELATION_MEMBER_OF;
+  types[ATK_RELATION_NODE_CHILD_OF] = Accessibility_RELATION_NODE_CHILD_OF;
+  return TRUE;
+}
+
+
+
+static Accessibility_RelationType
+spi_relation_type_from_atk_relation_type (AtkRelationType type)
+{
+  static gboolean is_initialized = FALSE;
+  static Accessibility_RelationType spi_relation_type_table [ATK_RELATION_LAST_DEFINED];
+  Accessibility_RelationType spi_type;
+
+  if (!is_initialized)
+    is_initialized = spi_init_relation_type_table (spi_relation_type_table);      
+
+  if (type > ATK_RELATION_NULL && type < ATK_RELATION_LAST_DEFINED)
+    spi_type = spi_relation_type_table[type];
+  else
+    spi_type = Accessibility_RELATION_EXTENDED;
+  return spi_type;
+}
+
+
+
+static AtkRelation *
+get_relation_from_servant (PortableServer_Servant servant)
+{
+  SpiBase *base = SPI_BASE (bonobo_object_from_servant(servant));
+
+  g_return_val_if_fail (base, NULL);
+  return  ATK_RELATION(base->gobj);
+}
+
+
+
+static Accessibility_RelationType
+impl_getRelationType (PortableServer_Servant servant,
+                     CORBA_Environment * ev)
+{
+  AtkRelation *relation = get_relation_from_servant (servant);
+  AtkRelationType type;
+
+  g_return_val_if_fail (relation, 0);
+  type = atk_relation_get_relation_type (relation);
+  return spi_relation_type_from_atk_relation_type (type);
+}
+
+
+
+static CORBA_short
+impl_getNTargets (PortableServer_Servant servant,
+                 CORBA_Environment * ev)
+{
+  AtkRelation *relation = get_relation_from_servant(servant);
+  g_return_val_if_fail (relation, 0);
+}
+
+
+
+static CORBA_Object
+impl_getTarget (PortableServer_Servant servant,
+               const CORBA_short index,
+               CORBA_Environment * ev)
+{
+  AtkRelation *relation = get_relation_from_servant (servant);
+  g_return_val_if_fail (relation, NULL);
+}
+
+
+
 SpiRelation *
 spi_relation_new (AtkRelation *obj)
 {
   SpiRelation *new_relation = g_object_new (SPI_RELATION_TYPE, NULL);
-
   spi_base_construct (SPI_BASE (new_relation), G_OBJECT (obj));
-
   return new_relation;
 }
 
@@ -43,9 +125,9 @@ spi_relation_class_init (SpiRelationClass *klass)
 {
   POA_Accessibility_Relation__epv *epv = &klass->epv;
 
-  epv->getRelationType  = NULL; /* TODO: finish me! */
-  epv->getNTargets      = NULL;
-  epv->getTarget        = NULL;
+  epv->getRelationType  = impl_getRelationType;  
+  epv->getNTargets      = impl_getNTargets;
+  epv->getTarget        = impl_getTarget;
 }