* Boston, MA 02111-1307, USA.
*/
-/*
- * accessible.c: test for accessibility implementation
- *
- */
-#include <config.h>
-#include <bonobo/Bonobo.h>
+/* accessible.c: the core of the accessibility implementation */
+#include <config.h>
#include <stdio.h>
+#include <libspi/libspi.h>
-/*
- * This pulls the CORBA definitions for the "Accessibility::Accessible" server
- */
-#include <libspi/Accessibility.h>
-
-/*
- * This pulls the definition for the BonoboObject (Gtk Type)
- */
-#include "accessible.h"
-#include "component.h"
-#include "editabletext.h"
-#include "hyperlink.h"
-#include "hypertext.h"
-#include "image.h"
-#include "selection.h"
-#include "table.h"
-#include "text.h"
-#include "value.h"
-#include "action.h"
-
-/*
- * Our parent Gtk object type
- */
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
+/* Our parent Gtk object type */
+#define PARENT_TYPE BONOBO_TYPE_OBJECT
-/*
- * A pointer to our parent object class
- */
+/* A pointer to our parent object class */
static GObjectClass *spi_accessible_parent_class;
/*
CORBA_Environment *ev)
{
Accessibility_RelationSet *retval;
-/* SpiAccessible *accessible = SPI_ACCESSIBLE (bonobo_object_from_servant (servant));
- AtkRelationSet *relation_set = atk_object_ref_relation_set (accessible->atko); */
+ gint n_relations;
+ gint i;
+ SpiAccessible *accessible = SPI_ACCESSIBLE (bonobo_object_from_servant (servant));
+ AtkRelationSet *relation_set = atk_object_ref_relation_set (accessible->atko);
+ n_relations = atk_relation_set_get_n_relations (relation_set);
retval = CORBA_sequence_Accessibility_Relation__alloc ();
- /*
- * TODO: fill the sequence with relation set objects, themselves
- * initialized from the AtkRelation object in the AtkRelationSet.
- */
+ CORBA_sequence_Accessibility_Relation_allocbuf (n_relations);
+
+ for (i=0; i<n_relations; ++i)
+ {
+ retval->_buffer[i] =
+ CORBA_Object_duplicate (bonobo_object_corba_objref (
+ BONOBO_OBJECT (spi_relation_new (atk_relation_set_get_relation (relation_set, i)))),
+ ev);
+ }
+
printf ("SpiAccessible get_relation_set.\n");
return retval;
}
Accessibility_Role retval;
SpiAccessible *accessible = SPI_ACCESSIBLE (bonobo_object_from_servant (servant));
AtkRole role = atk_object_get_role (accessible->atko);
- retval = role;
+ retval = role; /* relies on ability to cast these back and forth */
printf ("SpiAccessible get_role.\n");
return (Accessibility_Role) retval;
}
{
}
-GType
-spi_accessible_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo tinfo = {
- sizeof (SpiAccessibleClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) spi_accessible_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class data */
- sizeof (SpiAccessible),
- 0, /* n preallocs */
- (GInstanceInitFunc) spi_accessible_init,
- NULL /* value table */
- };
- /*
- * Bonobo_type_unique auto-generates a load of
- * CORBA structures for us. All derived types must
- * use bonobo_type_unique.
- */
- type = bonobo_type_unique (
- PARENT_TYPE,
- POA_Accessibility_Accessible__init,
- NULL,
- G_STRUCT_OFFSET (SpiAccessibleClass, epv),
- &tinfo,
- "SpiAccessible");
- }
-
- return type;
-}
+BONOBO_TYPE_FUNC_FULL (SpiAccessible,
+ Accessibility_Accessible,
+ PARENT_TYPE,
+ spi_accessible);
SpiAccessible *
spi_accessible_new (AtkObject *o)
{
- SpiAccessible *retval =
- SPI_ACCESSIBLE (g_object_new (spi_accessible_get_type (), NULL));
+ SpiAccessible *retval = g_object_new (SPI_ACCESSIBLE_TYPE, NULL);
CORBA_Environment ev;
CORBA_exception_init (&ev);
g_object_ref (o);
retval->atko = ATK_OBJECT (o);
- /*
- * TODO: add interface containers/constructors for SPI_EDITABLE_TEXT, SPI_HYPERTEXT,
- * SPI_IMAGE, SPI_SELECTION, SPI_TABLE, SPI_TEXT, SPI_VALUE.
- */
-
- /* add appropriate ATK interfaces */
+ /* aggregate appropriate SPI interfaces based on ATK interfaces */
if (ATK_IS_ACTION (o))
{