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

source code of include/atk-1.0/atk/atkcomponent.h