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 | #if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION) |
24 | #error "Only <atk/atk.h> can be included directly." |
25 | #endif |
26 | |
27 | #include <atk/atkobject.h> |
28 | #include <atk/atkutil.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | /** |
33 | * AtkScrollType: |
34 | * @ATK_SCROLL_TOP_LEFT: Scroll the object vertically and horizontally to bring |
35 | * its top left corner to the top left corner of the window. |
36 | * @ATK_SCROLL_BOTTOM_RIGHT: Scroll the object vertically and horizontally to |
37 | * bring its bottom right corner to the bottom right corner of the window. |
38 | * @ATK_SCROLL_TOP_EDGE: Scroll the object vertically to bring its top edge to |
39 | * the top edge of the window. |
40 | * @ATK_SCROLL_BOTTOM_EDGE: Scroll the object vertically to bring its bottom |
41 | * edge to the bottom edge of the window. |
42 | * @ATK_SCROLL_LEFT_EDGE: Scroll the object vertically and horizontally to bring |
43 | * its left edge to the left edge of the window. |
44 | * @ATK_SCROLL_RIGHT_EDGE: Scroll the object vertically and horizontally to |
45 | * bring its right edge to the right edge of the window. |
46 | * @ATK_SCROLL_ANYWHERE: Scroll the object vertically and horizontally so that |
47 | * as much as possible of the object becomes visible. The exact placement is |
48 | * determined by the application. |
49 | * |
50 | * Specifies where an object should be placed on the screen when using scroll_to. |
51 | * |
52 | * Since: 2.30 |
53 | */ |
54 | typedef enum { |
55 | ATK_SCROLL_TOP_LEFT, |
56 | ATK_SCROLL_BOTTOM_RIGHT, |
57 | ATK_SCROLL_TOP_EDGE, |
58 | ATK_SCROLL_BOTTOM_EDGE, |
59 | ATK_SCROLL_LEFT_EDGE, |
60 | ATK_SCROLL_RIGHT_EDGE, |
61 | ATK_SCROLL_ANYWHERE |
62 | } AtkScrollType; |
63 | |
64 | #define ATK_TYPE_COMPONENT (atk_component_get_type ()) |
65 | #define ATK_IS_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_COMPONENT) |
66 | #define ATK_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_COMPONENT, AtkComponent) |
67 | #define ATK_COMPONENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_COMPONENT, AtkComponentIface)) |
68 | |
69 | #ifndef _TYPEDEF_ATK_COMPONENT_ |
70 | #define _TYPEDEF_ATK_COMPONENT_ |
71 | typedef struct _AtkComponent AtkComponent; |
72 | #endif |
73 | typedef struct _AtkComponentIface AtkComponentIface; |
74 | |
75 | /** |
76 | * AtkFocusHandler: |
77 | * @object: the #AtkObject that receives/lose the focus |
78 | * @focus_in: TRUE if the object receives the focus |
79 | * |
80 | * The type of callback function used for |
81 | * atk_component_add_focus_handler() and |
82 | * atk_component_remove_focus_handler() |
83 | * |
84 | * Deprecated: 2.9.4: Deprecated with atk_component_add_focus_handler() |
85 | * and atk_component_remove_focus_handler(). See those |
86 | * methods for more information. |
87 | */ |
88 | typedef void (*AtkFocusHandler) (AtkObject* object, gboolean focus_in); |
89 | |
90 | typedef struct _AtkRectangle AtkRectangle; |
91 | |
92 | /** |
93 | * AtkRectangle: |
94 | * @x: X coordinate of the left side of the rectangle. |
95 | * @y: Y coordinate of the top side of the rectangle. |
96 | * @width: width of the rectangle. |
97 | * @height: height of the rectangle. |
98 | * |
99 | * A data structure for holding a rectangle. Those coordinates are |
100 | * relative to the component top-level parent. |
101 | */ |
102 | struct _AtkRectangle |
103 | { |
104 | gint x; |
105 | gint y; |
106 | gint width; |
107 | gint height; |
108 | }; |
109 | |
110 | ATK_AVAILABLE_IN_ALL |
111 | GType atk_rectangle_get_type (void); |
112 | |
113 | #define ATK_TYPE_RECTANGLE (atk_rectangle_get_type ()) |
114 | |
115 | /** |
116 | * AtkComponentIface: |
117 | * @add_focus_handler: This virtual function is deprecated since 2.9.4 |
118 | * and it should not be overriden. See atk_component_add_focus_handler() |
119 | * for more information. |
120 | * @get_position: This virtual function is deprecated since 2.12 and |
121 | * it should not be overriden. Use @AtkComponentIface.get_extents instead. |
122 | * @get_size: This virtual function is deprecated since 2.12 and it |
123 | * should not be overriden. Use @AtkComponentIface.get_extents instead. |
124 | * @remove_focus_handler: This virtual function is deprecated since |
125 | * 2.9.4 and it should not be overriden. See atk_component_remove_focus_handler() |
126 | * for more information. |
127 | * @contains: |
128 | * @ref_accessible_at_point: |
129 | * @get_extents: |
130 | * @grab_focus: |
131 | * @set_extents: |
132 | * @set_position: |
133 | * @set_size: |
134 | * @get_layer: |
135 | * @get_mdi_zorder: |
136 | * @bounds_changed: |
137 | * @get_alpha: |
138 | * @scroll_to: |
139 | * @scroll_to_point: |
140 | * |
141 | * The AtkComponent interface should be supported by any object that is |
142 | * rendered on the screen. The interface provides the standard mechanism |
143 | * for an assistive technology to determine and set the graphical |
144 | * representation of an object. |
145 | */ |
146 | struct _AtkComponentIface |
147 | { |
148 | /*< private >*/ |
149 | GTypeInterface parent; |
150 | |
151 | /*< public >*/ |
152 | guint (* add_focus_handler) (AtkComponent *component, |
153 | AtkFocusHandler handler); |
154 | |
155 | gboolean (* contains) (AtkComponent *component, |
156 | gint x, |
157 | gint y, |
158 | AtkCoordType coord_type); |
159 | |
160 | AtkObject* (* ref_accessible_at_point) (AtkComponent *component, |
161 | gint x, |
162 | gint y, |
163 | AtkCoordType coord_type); |
164 | void (* get_extents) (AtkComponent *component, |
165 | gint *x, |
166 | gint *y, |
167 | gint *width, |
168 | gint *height, |
169 | AtkCoordType coord_type); |
170 | void (* get_position) (AtkComponent *component, |
171 | gint *x, |
172 | gint *y, |
173 | AtkCoordType coord_type); |
174 | void (* get_size) (AtkComponent *component, |
175 | gint *width, |
176 | gint *height); |
177 | gboolean (* grab_focus) (AtkComponent *component); |
178 | void (* remove_focus_handler) (AtkComponent *component, |
179 | guint handler_id); |
180 | gboolean (* set_extents) (AtkComponent *component, |
181 | gint x, |
182 | gint y, |
183 | gint width, |
184 | gint height, |
185 | AtkCoordType coord_type); |
186 | gboolean (* set_position) (AtkComponent *component, |
187 | gint x, |
188 | gint y, |
189 | AtkCoordType coord_type); |
190 | gboolean (* set_size) (AtkComponent *component, |
191 | gint width, |
192 | gint height); |
193 | |
194 | AtkLayer (* get_layer) (AtkComponent *component); |
195 | gint (* get_mdi_zorder) (AtkComponent *component); |
196 | |
197 | /* |
198 | * signal handlers |
199 | */ |
200 | void (* bounds_changed) (AtkComponent *component, |
201 | AtkRectangle *bounds); |
202 | gdouble (* get_alpha) (AtkComponent *component); |
203 | |
204 | /* |
205 | * Scrolls this object so it becomes visible on the screen. |
206 | * |
207 | * scroll_to lets the implementation compute an appropriate target |
208 | * position on the screen, with type used as a positioning hint. |
209 | * |
210 | * scroll_to_point lets the client specify a precise target position |
211 | * on the screen for the top-left of the object. |
212 | * |
213 | * Since ATK 2.30 |
214 | */ |
215 | gboolean (*scroll_to) (AtkComponent *component, |
216 | AtkScrollType type); |
217 | |
218 | gboolean (*scroll_to_point) (AtkComponent *component, |
219 | AtkCoordType coords, |
220 | gint x, |
221 | gint y); |
222 | }; |
223 | |
224 | ATK_AVAILABLE_IN_ALL |
225 | GType atk_component_get_type (void); |
226 | |
227 | /* convenience functions */ |
228 | ATK_DEPRECATED_IN_2_10 |
229 | guint atk_component_add_focus_handler (AtkComponent *component, |
230 | AtkFocusHandler handler); |
231 | ATK_AVAILABLE_IN_ALL |
232 | gboolean atk_component_contains (AtkComponent *component, |
233 | gint x, |
234 | gint y, |
235 | AtkCoordType coord_type); |
236 | ATK_AVAILABLE_IN_ALL |
237 | AtkObject* atk_component_ref_accessible_at_point(AtkComponent *component, |
238 | gint x, |
239 | gint y, |
240 | AtkCoordType coord_type); |
241 | ATK_AVAILABLE_IN_ALL |
242 | void atk_component_get_extents (AtkComponent *component, |
243 | gint *x, |
244 | gint *y, |
245 | gint *width, |
246 | gint *height, |
247 | AtkCoordType coord_type); |
248 | ATK_DEPRECATED_IN_2_12_FOR(atk_component_get_extents) |
249 | void atk_component_get_position (AtkComponent *component, |
250 | gint *x, |
251 | gint *y, |
252 | AtkCoordType coord_type); |
253 | ATK_DEPRECATED_IN_2_12_FOR(atk_component_get_extents) |
254 | void atk_component_get_size (AtkComponent *component, |
255 | gint *width, |
256 | gint *height); |
257 | ATK_AVAILABLE_IN_ALL |
258 | AtkLayer atk_component_get_layer (AtkComponent *component); |
259 | ATK_AVAILABLE_IN_ALL |
260 | gint atk_component_get_mdi_zorder (AtkComponent *component); |
261 | ATK_AVAILABLE_IN_ALL |
262 | gboolean atk_component_grab_focus (AtkComponent *component); |
263 | ATK_DEPRECATED_IN_2_10 |
264 | void atk_component_remove_focus_handler (AtkComponent *component, |
265 | guint handler_id); |
266 | ATK_AVAILABLE_IN_ALL |
267 | gboolean atk_component_set_extents (AtkComponent *component, |
268 | gint x, |
269 | gint y, |
270 | gint width, |
271 | gint height, |
272 | AtkCoordType coord_type); |
273 | ATK_AVAILABLE_IN_ALL |
274 | gboolean atk_component_set_position (AtkComponent *component, |
275 | gint x, |
276 | gint y, |
277 | AtkCoordType coord_type); |
278 | ATK_AVAILABLE_IN_ALL |
279 | gboolean atk_component_set_size (AtkComponent *component, |
280 | gint width, |
281 | gint height); |
282 | ATK_AVAILABLE_IN_ALL |
283 | gdouble atk_component_get_alpha (AtkComponent *component); |
284 | |
285 | ATK_AVAILABLE_IN_2_30 |
286 | gboolean atk_component_scroll_to (AtkComponent *component, |
287 | AtkScrollType type); |
288 | |
289 | ATK_AVAILABLE_IN_2_30 |
290 | gboolean atk_component_scroll_to_point (AtkComponent *component, |
291 | AtkCoordType coords, |
292 | gint x, |
293 | gint y); |
294 | |
295 | G_END_DECLS |
296 | |
297 | #endif /* __ATK_COMPONENT_H__ */ |
298 | |