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
30G_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 */
54typedef 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_
71typedef struct _AtkComponent AtkComponent;
72#endif
73typedef 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 */
88typedef void (*AtkFocusHandler) (AtkObject* object, gboolean focus_in);
89
90typedef 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 */
102struct _AtkRectangle
103{
104 gint x;
105 gint y;
106 gint width;
107 gint height;
108};
109
110ATK_AVAILABLE_IN_ALL
111GType 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 */
146struct _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 * Since ATK 2.30
207 */
208 gboolean (*scroll_to) (AtkComponent *component,
209 AtkScrollType type);
210
211 gboolean (*scroll_to_point) (AtkComponent *component,
212 AtkCoordType coords,
213 gint x,
214 gint y);
215};
216
217ATK_AVAILABLE_IN_ALL
218GType atk_component_get_type (void);
219
220/* convenience functions */
221ATK_DEPRECATED_IN_2_10
222guint atk_component_add_focus_handler (AtkComponent *component,
223 AtkFocusHandler handler);
224ATK_AVAILABLE_IN_ALL
225gboolean atk_component_contains (AtkComponent *component,
226 gint x,
227 gint y,
228 AtkCoordType coord_type);
229ATK_AVAILABLE_IN_ALL
230AtkObject* atk_component_ref_accessible_at_point(AtkComponent *component,
231 gint x,
232 gint y,
233 AtkCoordType coord_type);
234ATK_AVAILABLE_IN_ALL
235void atk_component_get_extents (AtkComponent *component,
236 gint *x,
237 gint *y,
238 gint *width,
239 gint *height,
240 AtkCoordType coord_type);
241ATK_DEPRECATED_IN_2_12_FOR(atk_component_get_extents)
242void atk_component_get_position (AtkComponent *component,
243 gint *x,
244 gint *y,
245 AtkCoordType coord_type);
246ATK_DEPRECATED_IN_2_12_FOR(atk_component_get_extents)
247void atk_component_get_size (AtkComponent *component,
248 gint *width,
249 gint *height);
250ATK_AVAILABLE_IN_ALL
251AtkLayer atk_component_get_layer (AtkComponent *component);
252ATK_AVAILABLE_IN_ALL
253gint atk_component_get_mdi_zorder (AtkComponent *component);
254ATK_AVAILABLE_IN_ALL
255gboolean atk_component_grab_focus (AtkComponent *component);
256ATK_DEPRECATED_IN_2_10
257void atk_component_remove_focus_handler (AtkComponent *component,
258 guint handler_id);
259ATK_AVAILABLE_IN_ALL
260gboolean atk_component_set_extents (AtkComponent *component,
261 gint x,
262 gint y,
263 gint width,
264 gint height,
265 AtkCoordType coord_type);
266ATK_AVAILABLE_IN_ALL
267gboolean atk_component_set_position (AtkComponent *component,
268 gint x,
269 gint y,
270 AtkCoordType coord_type);
271ATK_AVAILABLE_IN_ALL
272gboolean atk_component_set_size (AtkComponent *component,
273 gint width,
274 gint height);
275ATK_AVAILABLE_IN_ALL
276gdouble atk_component_get_alpha (AtkComponent *component);
277
278ATK_AVAILABLE_IN_2_30
279gboolean atk_component_scroll_to (AtkComponent *component,
280 AtkScrollType type);
281
282ATK_AVAILABLE_IN_2_30
283gboolean atk_component_scroll_to_point (AtkComponent *component,
284 AtkCoordType coords,
285 gint x,
286 gint y);
287
288G_END_DECLS
289
290#endif /* __ATK_COMPONENT_H__ */
291