Added new API for ATK 1.11/1.12. Minor docs cleanup.
[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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __ATK_COMPONENT_H__
21 #define __ATK_COMPONENT_H__
22
23 #include <atk/atkobject.h>
24 #include <atk/atkutil.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
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 typedef void (*AtkFocusHandler) (AtkObject*, gboolean);
49
50 typedef struct _AtkRectangle       AtkRectangle;
51
52 struct _AtkRectangle
53 {
54   gint x;
55   gint y;
56   gint width;
57   gint height;
58 };
59
60 GType atk_rectangle_get_type (void);
61
62 #define ATK_TYPE_RECTANGLE (atk_rectangle_get_type ())
63 struct _AtkComponentIface
64 {
65   GTypeInterface parent;
66
67   guint          (* add_focus_handler)  (AtkComponent          *component,
68                                          AtkFocusHandler        handler);
69
70   gboolean       (* contains)           (AtkComponent          *component,
71                                          gint                   x,
72                                          gint                   y,
73                                          AtkCoordType           coord_type);
74
75   AtkObject*    (* ref_accessible_at_point)  (AtkComponent     *component,
76                                          gint                   x,
77                                          gint                   y,
78                                          AtkCoordType           coord_type);
79   void          (* get_extents)         (AtkComponent          *component,
80                                          gint                  *x,
81                                          gint                  *y,
82                                          gint                  *width,
83                                          gint                  *height,
84                                          AtkCoordType          coord_type);
85   void                     (* get_position)     (AtkComponent   *component,
86                                                  gint           *x,
87                                                  gint           *y,
88                                                  AtkCoordType   coord_type);
89   void                     (* get_size)                 (AtkComponent   *component,
90                                                          gint           *width,
91                                                          gint           *height);
92   gboolean                 (* grab_focus)               (AtkComponent   *component);
93   void                     (* remove_focus_handler)      (AtkComponent  *component,
94                                                           guint         handler_id);
95   gboolean                 (* set_extents)      (AtkComponent   *component,
96                                                  gint           x,
97                                                  gint           y,
98                                                  gint           width,
99                                                  gint           height,
100                                                  AtkCoordType   coord_type);
101   gboolean                 (* set_position)     (AtkComponent   *component,
102                                                  gint           x,
103                                                  gint           y,
104                                                  AtkCoordType   coord_type);
105   gboolean                 (* set_size)         (AtkComponent   *component,
106                                                  gint           width,
107                                                  gint           height);
108         
109   AtkLayer                 (* get_layer)        (AtkComponent   *component);
110   gint                     (* get_mdi_zorder)   (AtkComponent   *component);
111
112   /*
113    * signal handlers
114    */
115   void                     (* bounds_changed)   (AtkComponent   *component,
116                                                  AtkRectangle   *bounds);
117   gdouble                  (* get_alpha)        (AtkComponent   *component);
118 };
119
120 GType atk_component_get_type (void);
121
122 /* convenience functions */
123
124 guint                atk_component_add_focus_handler      (AtkComponent    *component,
125                                                            AtkFocusHandler handler);
126 gboolean              atk_component_contains               (AtkComponent    *component,
127                                                             gint            x,
128                                                             gint            y,
129                                                             AtkCoordType    coord_type);
130 AtkObject*            atk_component_ref_accessible_at_point(AtkComponent    *component,
131                                                             gint            x,
132                                                             gint            y,
133                                                             AtkCoordType    coord_type);
134 void                  atk_component_get_extents            (AtkComponent    *component,
135                                                             gint            *x,
136                                                             gint            *y,
137                                                             gint            *width,
138                                                             gint            *height,
139                                                             AtkCoordType    coord_type);
140 void                  atk_component_get_position           (AtkComponent    *component,
141                                                             gint            *x,
142                                                             gint            *y,
143                                                             AtkCoordType    coord_type);
144 void                  atk_component_get_size               (AtkComponent    *component,
145                                                             gint            *width,
146                                                             gint            *height);
147 AtkLayer              atk_component_get_layer              (AtkComponent    *component);
148 gint                  atk_component_get_mdi_zorder         (AtkComponent    *component);
149 gboolean              atk_component_grab_focus             (AtkComponent    *component);
150 void                  atk_component_remove_focus_handler   (AtkComponent    *component,
151                                                             guint           handler_id);
152 gboolean              atk_component_set_extents            (AtkComponent    *component,
153                                                             gint            x,
154                                                             gint            y,
155                                                             gint            width,
156                                                             gint            height,
157                                                             AtkCoordType    coord_type);
158 gboolean              atk_component_set_position           (AtkComponent    *component,
159                                                             gint            x,
160                                                             gint            y,
161                                                             AtkCoordType    coord_type);
162 gboolean              atk_component_set_size               (AtkComponent    *component,
163                                                             gint            width,
164                                                             gint            height);
165 gdouble               atk_component_get_alpha              (AtkComponent    *component);
166 #ifdef __cplusplus
167 }
168 #endif /* __cplusplus */
169
170
171 #endif /* __ATK_COMPONENT_H__ */