Updated FSF's address
[platform/upstream/atk.git] / atk / atkcomponent.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, see <http://www.gnu.org/licenses/>.
16  */
17
18 #if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
19 #error "Only <atk/atk.h> can be included directly."
20 #endif
21
22 #ifndef __ATK_COMPONENT_H__
23 #define __ATK_COMPONENT_H__
24
25 #include <atk/atkobject.h>
26 #include <atk/atkutil.h>
27
28 G_BEGIN_DECLS
29
30 /*
31  * The AtkComponent interface should be supported by any object that is 
32  * rendered on the screen. The interface provides the standard mechanism 
33  * for an assistive technology to determine and set the graphical
34  * representation of an object.
35  */
36
37 #define ATK_TYPE_COMPONENT                    (atk_component_get_type ())
38 #define ATK_IS_COMPONENT(obj)                 G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_COMPONENT)
39 #define ATK_COMPONENT(obj)                    G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_COMPONENT, AtkComponent)
40 #define ATK_COMPONENT_GET_IFACE(obj)          (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_COMPONENT, AtkComponentIface))
41
42 #ifndef _TYPEDEF_ATK_COMPONENT_
43 #define _TYPEDEF_ATK_COMPONENT_
44 typedef struct _AtkComponent AtkComponent;
45 #endif
46 typedef struct _AtkComponentIface  AtkComponentIface;
47
48 /**
49  * AtkFocusHandler:
50  * @object: the #AtkObject that receives/lose the focus
51  * @focus_in: TRUE if the object receives the focus
52  *
53  * The type of callback function used for
54  * atk_component_add_focus_handler() and
55  * atk_component_remove_focus_handler()
56  *
57  * Deprecated: This type is deprecated since ATK version 2.9.4. as
58  * atk_component_add_focus_handler() and
59  * atk_component_remove_focus_handler() are deprecated. See those
60  * methods for more information.
61  */
62 typedef void (*AtkFocusHandler) (AtkObject* object, gboolean focus_in);
63
64 typedef struct _AtkRectangle       AtkRectangle;
65
66 /**
67  * AtkRectangle:
68  * @x: X coordinate of the left side of the rectangle.
69  * @y: Y coordinate of the top side of the rectangle.
70  * @width: width of the rectangle.
71  * @height: height of the rectangle.
72  *
73  * A data structure for holding a rectangle. Those coordinates are
74  * relative to the component top-level parent.
75  */
76 struct _AtkRectangle
77 {
78   gint x;
79   gint y;
80   gint width;
81   gint height;
82 };
83
84 GType atk_rectangle_get_type (void);
85
86 #define ATK_TYPE_RECTANGLE (atk_rectangle_get_type ())
87
88 /**
89  * AtkComponentIface:
90  * @add_focus_handler: This virtual function is deprecated since 2.9.4
91  * and it should not be overriden. See
92  * atk_component_add_focus_handler() for more information.
93  * @remove_focus_handler: This virtual function is deprecated since
94  * 2.9.4 and it should not be overriden. See
95  * atk_component_remove_focus_handler() for more information.
96  */
97
98 struct _AtkComponentIface
99 {
100   GTypeInterface parent;
101
102   guint          (* add_focus_handler)  (AtkComponent          *component,
103                                          AtkFocusHandler        handler);
104
105   gboolean       (* contains)           (AtkComponent          *component,
106                                          gint                   x,
107                                          gint                   y,
108                                          AtkCoordType           coord_type);
109
110   AtkObject*    (* ref_accessible_at_point)  (AtkComponent     *component,
111                                          gint                   x,
112                                          gint                   y,
113                                          AtkCoordType           coord_type);
114   void          (* get_extents)         (AtkComponent          *component,
115                                          gint                  *x,
116                                          gint                  *y,
117                                          gint                  *width,
118                                          gint                  *height,
119                                          AtkCoordType          coord_type);
120   void                     (* get_position)     (AtkComponent   *component,
121                                                  gint           *x,
122                                                  gint           *y,
123                                                  AtkCoordType   coord_type);
124   void                     (* get_size)                 (AtkComponent   *component,
125                                                          gint           *width,
126                                                          gint           *height);
127   gboolean                 (* grab_focus)               (AtkComponent   *component);
128   void                     (* remove_focus_handler)      (AtkComponent  *component,
129                                                           guint         handler_id);
130   gboolean                 (* set_extents)      (AtkComponent   *component,
131                                                  gint           x,
132                                                  gint           y,
133                                                  gint           width,
134                                                  gint           height,
135                                                  AtkCoordType   coord_type);
136   gboolean                 (* set_position)     (AtkComponent   *component,
137                                                  gint           x,
138                                                  gint           y,
139                                                  AtkCoordType   coord_type);
140   gboolean                 (* set_size)         (AtkComponent   *component,
141                                                  gint           width,
142                                                  gint           height);
143         
144   AtkLayer                 (* get_layer)        (AtkComponent   *component);
145   gint                     (* get_mdi_zorder)   (AtkComponent   *component);
146
147   /*
148    * signal handlers
149    */
150   void                     (* bounds_changed)   (AtkComponent   *component,
151                                                  AtkRectangle   *bounds);
152   gdouble                  (* get_alpha)        (AtkComponent   *component);
153 };
154
155 GType atk_component_get_type (void);
156
157 /* convenience functions */
158 G_DEPRECATED
159 guint                atk_component_add_focus_handler      (AtkComponent    *component,
160                                                            AtkFocusHandler handler);
161 gboolean              atk_component_contains               (AtkComponent    *component,
162                                                             gint            x,
163                                                             gint            y,
164                                                             AtkCoordType    coord_type);
165 AtkObject*            atk_component_ref_accessible_at_point(AtkComponent    *component,
166                                                             gint            x,
167                                                             gint            y,
168                                                             AtkCoordType    coord_type);
169 void                  atk_component_get_extents            (AtkComponent    *component,
170                                                             gint            *x,
171                                                             gint            *y,
172                                                             gint            *width,
173                                                             gint            *height,
174                                                             AtkCoordType    coord_type);
175 void                  atk_component_get_position           (AtkComponent    *component,
176                                                             gint            *x,
177                                                             gint            *y,
178                                                             AtkCoordType    coord_type);
179 void                  atk_component_get_size               (AtkComponent    *component,
180                                                             gint            *width,
181                                                             gint            *height);
182 AtkLayer              atk_component_get_layer              (AtkComponent    *component);
183 gint                  atk_component_get_mdi_zorder         (AtkComponent    *component);
184 gboolean              atk_component_grab_focus             (AtkComponent    *component);
185 G_DEPRECATED
186 void                  atk_component_remove_focus_handler   (AtkComponent    *component,
187                                                             guint           handler_id);
188 gboolean              atk_component_set_extents            (AtkComponent    *component,
189                                                             gint            x,
190                                                             gint            y,
191                                                             gint            width,
192                                                             gint            height,
193                                                             AtkCoordType    coord_type);
194 gboolean              atk_component_set_position           (AtkComponent    *component,
195                                                             gint            x,
196                                                             gint            y,
197                                                             AtkCoordType    coord_type);
198 gboolean              atk_component_set_size               (AtkComponent    *component,
199                                                             gint            width,
200                                                             gint            height);
201 gdouble               atk_component_get_alpha              (AtkComponent    *component);
202
203 G_END_DECLS
204
205 #endif /* __ATK_COMPONENT_H__ */