Add role ATK_ROLE_TREE_TABLE
[platform/upstream/atk.git] / atk / atkrelation.h
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 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26
27 #include <glib-object.h>
28
29 /*
30  * An AtkRelation describes a relation between the object and one or more 
31  * other objects. The actual relations that an object has with other objects
32  * are defined as an AtkRelationSet, which is a set of AtkRelations. 
33  */
34
35 /**
36  *AtkRelationType:
37  *@ATK_RELATION_NULL:
38  *@ATK_RELATION_CONTROLLED_BY: Indicates an object controlled by one or more target objects.
39  *@ATK_RELATION_CONTROLLER_FOR: Indicates an object is an controller for one or more target objects.
40  *@ATK_RELATION_LABEL_FOR: Indicates an object is a label for one or more target objects.
41  *@ATK_RELATION_LABELLED_BY: Indicates an object is labelled by one or more target objects.
42  *@ATK_RELATION_MEMBER_OF: Indicates an object is a member of a group of one or more target objects.
43  *@ATK_RELATION_NODE_CHILD_OF: Indicates an object is a cell in a treetable which is displayed because a cell in the same column is expanded and identifies that cell.
44  *@ATK_RELATION_LAST_DEFINED:
45  * 
46  *Describes the type of the relation
47  **/
48 typedef enum
49 {
50   ATK_RELATION_NULL = 0,
51   ATK_RELATION_CONTROLLED_BY,
52   ATK_RELATION_CONTROLLER_FOR,
53   ATK_RELATION_LABEL_FOR,
54   ATK_RELATION_LABELLED_BY,
55   ATK_RELATION_MEMBER_OF,
56   ATK_RELATION_NODE_CHILD_OF,
57   ATK_RELATION_LAST_DEFINED
58 } AtkRelationType;
59
60 #define ATK_TYPE_RELATION                         (atk_relation_get_type ())
61 #define ATK_RELATION(obj)                         (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_RELATION, AtkRelation))
62 #define ATK_RELATION_CLASS(klass)                 (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_RELATION, AtkRelationClass))
63 #define ATK_IS_RELATION(obj)                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_RELATION))
64 #define ATK_IS_RELATION_CLASS(klass)              (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_RELATION))
65 #define ATK_RELATION_GET_CLASS(obj)               (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_RELATION, AtkRelationClass))
66
67 typedef struct _AtkRelation            AtkRelation;
68 typedef struct _AtkRelationClass       AtkRelationClass;
69
70
71 struct _AtkRelation
72 {
73   GObject parent;
74
75   GPtrArray       *target;
76   AtkRelationType relationship;
77 };
78
79 struct _AtkRelationClass
80 {
81   GObjectClass parent;
82 };
83
84 GType atk_relation_get_type (void);
85
86 AtkRelationType atk_relation_type_register            (const gchar *name);
87
88 AtkRelationType atk_relation_type_from_string         (const gchar *name);
89
90 /*
91  * Create a new relation for the specified key and the specified list
92  * of targets.
93  */
94 AtkRelation*    atk_relation_new                      (AtkObject       **targets,
95                                                        gint            n_targets,
96                                                        AtkRelationType relationship);
97 /*
98  * Returns the type of a relation.
99  */
100 AtkRelationType atk_relation_get_relation_type        (AtkRelation     *relation);
101 /*
102  * Returns the target list of a relation.
103  */
104 GPtrArray*      atk_relation_get_target               (AtkRelation     *relation);
105
106 #ifdef __cplusplus
107 }
108 #endif /* __cplusplus */
109
110 #endif /* __ATK_RELATION_H__ */