+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'.
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;
}
/**
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;
}
/**
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;
}
/**
#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;
}
{
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;
}