* Boston, MA 02111-1307, USA.
*/
+#include "config.h"
+
#include <glib-object.h>
#include "atk.h"
+/**
+ * SECTION:atkrelationset
+ * @Short_description: A set of AtkRelations, normally the set of
+ * AtkRelations which an AtkObject has.
+ * @Title:AtkRelationSet
+ *
+ * The AtkRelationSet held by an object establishes its relationships
+ * with objects beyond the normal "parent/child" hierarchical
+ * relationships that all user interface objects have.
+ * AtkRelationSets establish whether objects are labelled or
+ * controlled by other components, share group membership with other
+ * components (for instance within a radio-button group), or share
+ * content which "flows" between them, among other types of possible
+ * relationships.
+ */
+
static gpointer parent_class = NULL;
static void atk_relation_set_class_init (AtkRelationSetClass *klass);
}
}
+/**
+ * atk_relation_set_contains_target:
+ * @set: an #AtkRelationSet
+ * @relationship: an #AtkRelationType
+ * @target: an #AtkObject
+ *
+ * Determines whether the relation set contains a relation that
+ * matches the specified pair formed by type @relationship and object
+ * @target.
+ *
+ * Returns: %TRUE if @set contains a relation with the relationship
+ * type @relationship with an object @target, %FALSE otherwise
+ **/
+
+gboolean
+atk_relation_set_contains_target (AtkRelationSet *set,
+ AtkRelationType relationship,
+ AtkObject *target)
+{
+ GPtrArray *array_relations;
+ GPtrArray *array_target;
+ AtkObject *current_target;
+ AtkRelation *relation;
+ gint i;
+ gint c;
+
+ g_return_val_if_fail (ATK_IS_RELATION_SET (set), FALSE);
+ g_return_val_if_fail (ATK_IS_OBJECT (target), FALSE);
+
+ array_relations = set->relations;
+ if (array_relations == NULL)
+ return FALSE;
+
+ for (i = 0; i < array_relations->len; i++)
+ {
+ relation = g_ptr_array_index (array_relations, i);
+ if (relation->relationship == relationship)
+ {
+ array_target = atk_relation_get_target (relation);
+ for (c = 0; c < array_target->len; c++)
+ {
+ current_target = g_ptr_array_index (array_target, c);
+ if (target == current_target)
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}