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