Latest rev (previous commit was out of date). Added README and NEWS.
[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
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 /*
30  * The AtkComponent interface should be supported by any object that is 
31  * rendered on the screen. The interface provides the standard mechanism 
32  * for an assistive technology to determine and set the graphical
33  * representation of an object.
34  */
35
36 #define ATK_TYPE_COMPONENT                    (atk_component_get_type ())
37 #define ATK_IS_COMPONENT(obj)                 G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_COMPONENT)
38 #define ATK_COMPONENT(obj)                    G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_COMPONENT, AtkComponent)
39 #define ATK_COMPONENT_GET_IFACE(obj)          (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_COMPONENT, AtkComponentIface))
40
41 #ifndef _TYPEDEF_ATK_COMPONENT_
42 #define _TYPEDEF_ATK_COMPONENT_
43 typedef struct _AtkComponent AtkComponent;
44 #endif
45 typedef struct _AtkComponentIface  AtkComponentIface;
46
47 typedef void (*AtkFocusHandler) (AtkObject*, gboolean);
48
49
50 struct _AtkComponentIface
51 {
52   GTypeInterface parent;
53
54   /*
55    * Add the specified handler to the set of functions to be called 
56    * when this object receives focus (in or out) events.
57    */
58   guint          (* add_focus_handler)  (AtkComponent    *component,
59                                          AtkFocusHandler handler);
60   /*
61    * Checks whether the specified point is within the extent of the object,
62    * the points x and y coordinates are defined to be relative to the 
63    * coordinate system of the object.
64    */
65   gboolean       (* contains)           (AtkComponent           *component,
66                                          gint                   x,
67                                          gint                   y);
68
69   /*
70    * Gets the accessible child, if one exists, contained at the local
71    * coordinate point specified by x and y.
72    */
73   AtkObject*    (* get_accessible_at_point)  (AtkComponent     *component,
74                                          gint                   x,
75                                          gint                   y);
76   /*
77    * Gets the rectangle which gives the extent of the object.
78    */
79   void          (* get_extents)         (AtkComponent          *component,
80                                          gint                  *x,
81                                          gint                  *y,
82                                          gint                  *width,
83                                          gint                  *height);
84   /*
85    * Gets the position of the object relative to the parent in the form of 
86    * a point specifying the object's top-left corner in the screen's
87    * coordinate space.
88    */
89   void                     (* get_position)     (AtkComponent   *component,
90                                                  gint           *x,
91                                                  gint           *y);
92   /*
93    *  Returns the position of the object on the screen
94    */
95   void                     (* get_position_on_screen)   (AtkComponent   *component,
96                                                          gint           *root_x,
97                                                          gint           *root_y);
98   /*
99    *  Returns the size of the object
100    */
101   void                     (* get_size)                 (AtkComponent   *component,
102                                                          gint           *width,
103                                                          gint           *height);
104   /*
105    * Grabs focus for this object
106    */
107   void                     (* grab_focus)               (AtkComponent   *component);
108   /*
109    * Remove the handler specified by the handler_id from the list of
110    * functions to be executed when this object receives focus (in or out)
111    */
112   void                     (* remove_focus_handler)      (AtkComponent  *component,
113                                                           guint         handler_id);
114   /*
115    * Sets the extents of the object
116    */
117   void                     (* set_extents)      (AtkComponent   *component,
118                                                  gint           x,
119                                                  gint           y,
120                                                  gint           width,
121                                                  gint           height);
122   /*
123    * Set the position of the object
124    */
125   void                     (* set_position)     (AtkComponent   *component,
126                                                  gint           x,
127                                                  gint           y);
128   /*
129    * Set the size of the object
130    */
131   void                     (* set_size)         (AtkComponent   *component,
132                                                  gint           width,
133                                                  gint           height);
134 };
135
136 GType atk_component_get_type ();
137
138 /* convenience functions */
139
140 guint                atk_component_add_focus_handler      (AtkComponent    *component,
141                                                            AtkFocusHandler handler);
142 gboolean              atk_component_contains               (AtkComponent    *component,
143                                                             gint            x,
144                                                             gint            y);
145 AtkObject*            atk_component_get_accessible_at_point(AtkComponent    *component,
146                                                             gint            x,
147                                                             gint            y);
148 void                  atk_component_get_extents            (AtkComponent    *component,
149                                                             gint            *x,
150                                                             gint            *y,
151                                                             gint            *width,
152                                                             gint            *height);
153 void                  atk_component_get_position           (AtkComponent    *component,
154                                                             gint            *x,
155                                                             gint            *y);
156 void                  atk_component_get_position_on_screen (AtkComponent    *component,
157                                                             gint            *x,
158                                                             gint            *y);
159 void                  atk_component_get_size               (AtkComponent    *component,
160                                                             gint            *width,
161                                                             gint            *height);
162 void                  atk_component_grab_focus             (AtkComponent    *component);
163 void                  atk_component_remove_focus_handler   (AtkComponent    *component,
164                                                             guint           handler_id);
165 void                  atk_component_set_extents            (AtkComponent    *component,
166                                                             gint            x,
167                                                             gint            y,
168                                                             gint            width,
169                                                             gint            height);
170 void                  atk_component_set_position           (AtkComponent    *component,
171                                                             gint            x,
172                                                             gint            y);
173 void                  atk_component_set_size               (AtkComponent    *component,
174                                                             gint            width,
175                                                             gint            height);
176
177 #ifdef __cplusplus
178 }
179 #endif /* __cplusplus */
180
181
182 #endif /* __ATK_COMPONENT_H__ */