1/* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __ATK_RELATION_H__
21#define __ATK_RELATION_H__
22
23#if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
24#error "Only <atk/atk.h> can be included directly."
25#endif
26
27G_BEGIN_DECLS
28
29#include <glib-object.h>
30#include <atk/atkrelationtype.h>
31#include <atk/atkversion.h>
32
33/*
34 * An AtkRelation describes a relation between the object and one or more
35 * other objects. The actual relations that an object has with other objects
36 * are defined as an AtkRelationSet, which is a set of AtkRelations.
37 */
38
39#define ATK_TYPE_RELATION (atk_relation_get_type ())
40#define ATK_RELATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_RELATION, AtkRelation))
41#define ATK_RELATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_RELATION, AtkRelationClass))
42#define ATK_IS_RELATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_RELATION))
43#define ATK_IS_RELATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_RELATION))
44#define ATK_RELATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_RELATION, AtkRelationClass))
45
46typedef struct _AtkRelation AtkRelation;
47typedef struct _AtkRelationClass AtkRelationClass;
48
49struct _AtkRelation
50{
51 GObject parent;
52
53 GPtrArray *target;
54 AtkRelationType relationship;
55};
56
57struct _AtkRelationClass
58{
59 GObjectClass parent;
60};
61
62ATK_AVAILABLE_IN_ALL
63GType atk_relation_get_type (void);
64
65ATK_AVAILABLE_IN_ALL
66AtkRelationType atk_relation_type_register (const gchar *name);
67ATK_AVAILABLE_IN_ALL
68const gchar* atk_relation_type_get_name (AtkRelationType type);
69ATK_AVAILABLE_IN_ALL
70AtkRelationType atk_relation_type_for_name (const gchar *name);
71
72/*
73 * Create a new relation for the specified key and the specified list
74 * of targets.
75 */
76ATK_AVAILABLE_IN_ALL
77AtkRelation* atk_relation_new (AtkObject **targets,
78 gint n_targets,
79 AtkRelationType relationship);
80/*
81 * Returns the type of a relation.
82 */
83ATK_AVAILABLE_IN_ALL
84AtkRelationType atk_relation_get_relation_type (AtkRelation *relation);
85/*
86 * Returns the target list of a relation.
87 */
88ATK_AVAILABLE_IN_ALL
89GPtrArray* atk_relation_get_target (AtkRelation *relation);
90ATK_AVAILABLE_IN_ALL
91void atk_relation_add_target (AtkRelation *relation,
92 AtkObject *target);
93ATK_AVAILABLE_IN_ALL
94gboolean atk_relation_remove_target (AtkRelation *relation,
95 AtkObject *target);
96
97G_END_DECLS
98
99#endif /* __ATK_RELATION_H__ */
100