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