2001-16-11 Bill Haneman <bill.haneman@sun.com>
+ * libspi/relation.h:
+ * libspi/relation.c:
+ * cspi/spi_accessible.c:
+ Initial implementations of AccessibleRelation methods, and docs.
+
* libspi/accessible.c:
Fixed a bug that caused SEGV if an accessible
object's description is NULL, and a client
* cspi/spi_image.c:
* cspi/spi_hyperlink.c:
* cspi/spi_table.c:
- Added docs. Doc coverage now 92%.
+ Added docs.
+
+ Doc coverage now 95%.
2001-16-11 Bill Haneman <bill.haneman@sun.com>
atk_add_focus_tracker (bridge_focus_tracker);
atk_add_global_event_listener (bridge_property_event_listener, "Gtk:AtkObject:property-change");
atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:children-changed");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:model-changed");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:selection-changed");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:visible-data-changed");
atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkText:text-changed");
atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkText:text-caret-moved");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:row-inserted");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:row-reordered");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:row-deleted");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:column-inserted");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:column-reordered");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:column-deleted");
atk_add_key_event_listener (bridge_key_listener, NULL);
}
atk_add_focus_tracker (bridge_focus_tracker);
atk_add_global_event_listener (bridge_property_event_listener, "Gtk:AtkObject:property-change");
atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:children-changed");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:model-changed");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:selection-changed");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkObject:visible-data-changed");
atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkText:text-changed");
atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkText:text-caret-moved");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:row-inserted");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:row-reordered");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:row-deleted");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:column-inserted");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:column-reordered");
+ atk_add_global_event_listener (bridge_signal_listener, "Gtk:AtkTable:column-deleted");
atk_add_key_event_listener (bridge_key_listener, NULL);
}
AccessibleRelationType
AccessibleRelation_getRelationType (AccessibleRelation *obj);
+int
+AccessibleRelation_getNTargets (AccessibleRelation *obj);
+
Accessible *
-AccessibleRelation_getTarget (AccessibleRelation *obj);
+AccessibleRelation_getTarget (AccessibleRelation *obj, int i);
/*
* Accessible_getRelationSet:
* @obj: a pointer to the #Accessible object on which to operate.
*
- * Not Yet Implemented.
+ * Get the set of #AccessibleRelation objects which describe this #Accessible object's
+ * relationships with other #Accessible objects.
*
- * Returns: a pointer to an array of #AccessibleRelations.
+ * Returns: an array of #AccessibleRelation pointers.
*
**/
AccessibleRelation **
Accessible_getRelationSet (Accessible *obj)
{
- return NULL;
+ AccessibleRelation **relations;
+ int n_relations;
+ int i;
+ Accessibility_RelationSet *relation_set =
+ Accessibility_Accessible_getRelationSet (*obj, &ev);
+
+ /* this looks hack-ish, but it's based on the CORBA C bindings spec */
+ n_relations = relation_set->_length;
+ relations = malloc (sizeof (AccessibleRelation *) * n_relations);
+
+ for (i=0; i<n_relations; ++i)
+ {
+ relations[i] = Obj_Add (relation_set->_buffer[i]);
+ }
+ relations[i] = CORBA_OBJECT_NIL;
+
+ return relations;
}
/**
return (iface != NULL) ? Obj_Add (iface) : NULL;
}
+
+/**
+ * AccessibleRelation_ref:
+ * @obj: a pointer to the #AccessibleRelation object on which to operate.
+ *
+ * Increment the reference count for an #AccessibleRelation object.
+ *
+ * Returns: (no return code implemented yet).
+ *
+ **/
+int
+AccessibleRelation_ref (AccessibleRelation *obj)
+{
+ Accessibility_Relation_ref (*obj, &ev);
+ spi_check_ev (&ev, "ref");
+ return 0;
+}
+
+/**
+ * AccessibleRelation_unref:
+ * @obj: a pointer to the #AccessibleRelation object on which to operate.
+ *
+ * Decrement the reference count for an #AccessibleRelation object.
+ *
+ * Returns: (no return code implemented yet).
+ *
+ **/
+int
+AccessibleRelation_unref (AccessibleRelation *obj)
+{
+ Accessibility_Relation_unref (*obj, &ev);
+ spi_check_ev (&ev, "unref");
+ return 0;
+}
+
+/**
+ * AccessibleRelation_getRelationType:
+ * @obj: a pointer to the #AccessibleRelation object to query.
+ *
+ * Get the type of relationship represented by an #AccessibleRelation.
+ *
+ * Returns: an #AccessibleRelationType indicating the type of relation
+ * encapsulated in this #AccessibleRelation object.
+ *
+ **/
+AccessibleRelationType
+AccessibleRelation_getRelationType (AccessibleRelation *obj)
+{
+ return 0;
+}
+
+/**
+ * AccessibleRelation_getNTargets:
+ * @obj: a pointer to the #AccessibleRelation object to query.
+ *
+ * Get the number of objects which this relationship has as its
+ * target objects (the subject is the #Accessible from which this
+ * #AccessibleRelation originated).
+ *
+ * Returns: a short integer indicating how many target objects which the
+ * originating #Accessible object has the #AccessibleRelation
+ * relationship with.
+ **/
+int
+AccessibleRelation_getNTargets (AccessibleRelation *obj)
+{
+ return 0;
+}
+
+/**
+ * AccessibleRelation_getTarget:
+ * @obj: a pointer to the #AccessibleRelation object to query.
+ * @i: a (zero-index) integer indicating which (of possibly several) target is requested.
+ *
+ * Get the @i-th target of a specified #AccessibleRelation relationship.
+ *
+ * Returns: an #Accessible which is the @i-th object with which the
+ * originating #Accessible has relationship specified in the
+ * #AccessibleRelation object.
+ *
+ **/
+Accessible *
+AccessibleRelation_getTarget (AccessibleRelation *obj, int i)
+{
+ return NULL;
+}
AccessibleStateSet_equals
AccessibleStateSet_isEmpty
AccessibleStateSet_remove
-
</SECTION>
<SECTION>
* This interface inherits from a base class implementing ref counts.
*/
- interface Relation {
+ interface Relation : Bonobo::Unknown {
RelationType getRelationType ();
- Object getTarget ();
+ short getNTargets ();
+ Object getTarget (in short index);
};
};
* This interface inherits from a base class implementing ref counts.
*/
- interface Relation {
+ interface Relation : Bonobo::Unknown {
RelationType getRelationType ();
- Object getTarget ();
+ short getNTargets ();
+ Object getTarget (in short index);
};
};
hyperlink.h\
hypertext.h\
image.h\
+ relation.h\
selection.h\
table.h\
text.h\
image.h\
keystrokelistener.c\
keystrokelistener.h\
+ relation.c\
+ relation.h\
selection.c\
selection.h\
table.c\
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 (
+ 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;
}
spi_hyperlink_finalize (GObject *obj)
{
SpiHyperlink *hyperlink = SPI_HYPERLINK(obj);
- g_object_unref (hyperlink->atko);
- hyperlink->atko = NULL;
+ g_object_unref (hyperlink->hyperlink);
+ hyperlink->hyperlink = NULL;
parent_class->finalize (obj);
}
SpiHyperlink *
-spi_hyperlink_interface_new (AtkObject *obj)
+spi_hyperlink_new (AtkHyperlink *hyperlink)
{
SpiHyperlink *new_hyperlink =
SPI_HYPERLINK(g_object_new (SPI_HYPERLINK_TYPE, NULL));
- new_hyperlink->atko = obj;
- g_object_ref (obj);
+ g_object_ref (hyperlink);
+ new_hyperlink->hyperlink = hyperlink;
return new_hyperlink;
}
CORBA_Environment * ev)
{
SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
- return (CORBA_short) atk_hyperlink_get_n_anchors (ATK_HYPERLINK(link->atko));
+ return (CORBA_short) atk_hyperlink_get_n_anchors (ATK_HYPERLINK(link->hyperlink));
}
CORBA_Environment * ev)
{
SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
- return (CORBA_long) atk_hyperlink_get_start_index (ATK_HYPERLINK(link->atko));
+ return (CORBA_long) atk_hyperlink_get_start_index (ATK_HYPERLINK(link->hyperlink));
}
CORBA_Environment * ev)
{
SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
- return (CORBA_long) atk_hyperlink_get_end_index (ATK_HYPERLINK(link->atko));
+ return (CORBA_long) atk_hyperlink_get_end_index (ATK_HYPERLINK(link->hyperlink));
}
SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
gchar *uri;
CORBA_char *rv;
- uri = atk_hyperlink_get_uri (ATK_HYPERLINK(link->atko), (gint) i);
+ uri = atk_hyperlink_get_uri (ATK_HYPERLINK(link->hyperlink), (gint) i);
if (uri)
{
rv = CORBA_string_dup (uri);
SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
AtkObject *atk_object;
Accessibility_Accessible rv;
- atk_object = atk_hyperlink_get_object (ATK_HYPERLINK(link->atko), (gint) i);
+ atk_object = atk_hyperlink_get_object (ATK_HYPERLINK(link->hyperlink), (gint) i);
rv = bonobo_object_corba_objref (BONOBO_OBJECT(spi_accessible_new(atk_object)));
return rv;
}
CORBA_Environment * ev)
{
SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
- return (CORBA_boolean) atk_hyperlink_is_valid (ATK_HYPERLINK(link->atko));
+ return (CORBA_boolean) atk_hyperlink_is_valid (ATK_HYPERLINK(link->hyperlink));
}
struct _Hyperlink {
BonoboObject parent;
- AtkObject *atko;
+ AtkHyperlink *hyperlink;
};
struct _HyperlinkClass {
spi_hyperlink_get_type (void);
SpiHyperlink *
-spi_hyperlink_interface_new (AtkObject *obj);
+spi_hyperlink_new ();
#ifdef __cplusplus
}
link = atk_hypertext_get_link (ATK_HYPERTEXT(hypertext->atko),
(gint) linkIndex);
- rv = bonobo_object_corba_objref (BONOBO_OBJECT(spi_hyperlink_interface_new(ATK_OBJECT(link))));
+ rv = bonobo_object_corba_objref (BONOBO_OBJECT(spi_hyperlink_new(ATK_OBJECT(link))));
return rv;
}
--- /dev/null
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * 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.
+ */
+
+/*
+ * relation.c : bonobo wrapper for accessible relation implementation
+ *
+ */
+#include <config.h>
+#include <bonobo/Bonobo.h>
+
+#include <stdio.h>
+
+/*
+ * This pulls the CORBA definitions for the "Accessibility::Accessible" server
+ */
+#include <libspi/Accessibility.h>
+
+/*
+ * This pulls the definition of the relation bonobo object
+ */
+#include "relation.h"
+
+/*
+ * Static function declarations
+ */
+
+static void
+spi_relation_class_init (SpiRelationClass *klass);
+static void
+spi_relation_init (SpiRelation *relation);
+static void
+spi_relation_finalize (GObject *obj);
+static CORBA_string
+impl_getURI (PortableServer_Servant _servant,
+ const CORBA_long i, CORBA_Environment * ev);
+static CORBA_short
+impl__get_n_anchors (PortableServer_Servant _servant,
+ CORBA_Environment * ev);
+static CORBA_long
+impl__get_startIndex (PortableServer_Servant _servant,
+ CORBA_Environment * ev);
+static CORBA_long
+impl__get_endIndex (PortableServer_Servant _servant,
+ CORBA_Environment * ev);
+static Accessibility_Accessible
+impl_getObject (PortableServer_Servant _servant,
+ const CORBA_long i,
+ CORBA_Environment * ev);
+static CORBA_boolean
+impl_isValid (PortableServer_Servant _servant,
+ CORBA_Environment * ev);
+
+static GObjectClass *parent_class;
+
+GType
+spi_relation_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo tinfo = {
+ sizeof (SpiRelationClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) spi_relation_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class data */
+ sizeof (SpiRelation),
+ 0, /* n preallocs */
+ (GInstanceInitFunc) spi_relation_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 (
+ BONOBO_OBJECT_TYPE,
+ POA_Accessibility_Relation__init,
+ NULL,
+ G_STRUCT_OFFSET (SpiRelationClass, epv),
+ &tinfo,
+ "SpiAccessibleRelation");
+ }
+
+ return type;
+}
+
+static void
+spi_relation_class_init (SpiRelationClass *klass)
+{
+ GObjectClass * object_class = (GObjectClass *) klass;
+ POA_Accessibility_Relation__epv *epv = &klass->epv;
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = spi_relation_finalize;
+
+ epv->getRelationType = NULL; /* TODO: finish me! */
+ epv->getNTargets = NULL;
+ epv->getTarget = NULL;
+}
+
+static void
+spi_relation_init (SpiRelation *relation)
+{
+}
+
+static void
+spi_relation_finalize (GObject *obj)
+{
+ SpiRelation *relation = SPI_RELATION(obj);
+ g_object_unref (relation->relation);
+ relation->relation = NULL;
+ parent_class->finalize (obj);
+}
+
+SpiRelation *
+spi_relation_new (AtkRelation *obj)
+{
+ SpiRelation *new_relation =
+ SPI_RELATION (g_object_new (SPI_RELATION_TYPE, NULL));
+ new_relation->relation = obj;
+ g_object_ref (obj);
+ return new_relation;
+}
+
--- /dev/null
+/* AT-SPI - Assistive Technology Service Provider Interface
+ *
+ * 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 SPI_RELATION_H_
+#define SPI_RELATION_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <bonobo/bonobo-object.h>
+#include <atk/atk.h>
+#include <libspi/Accessibility.h>
+
+#define SPI_RELATION_TYPE (spi_relation_get_type ())
+#define SPI_RELATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_RELATION_TYPE, SpiRelation))
+#define SPI_RELATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_RELATION_TYPE, SpiRelationClass))
+#define IS_SPI_RELATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPI_RELATION_TYPE))
+#define IS_SPI_RELATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPI_RELATION_TYPE))
+
+typedef struct _SpiRelation SpiRelation;
+typedef struct _SpiRelationClass SpiRelationClass;
+
+struct _SpiRelation {
+ BonoboObject parent;
+ AtkRelation *relation;
+};
+
+struct _SpiRelationClass {
+ BonoboObjectClass parent_class;
+ POA_Accessibility_Relation__epv epv;
+};
+
+GType
+spi_relation_get_type (void);
+
+SpiRelation *
+spi_relation_new (AtkRelation *relation);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SPI_RELATION_H_ */