atkcomponent: Add ScrollTo and ScrollToPoint component interfaces
[atk.git] / atk / atkcomponent.h
blob22155c1df8b2d536d87f4c497ba911e91101a42b
1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
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.
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.
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.
20 #ifndef __ATK_COMPONENT_H__
21 #define __ATK_COMPONENT_H__
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
27 #include <atk/atkobject.h>
28 #include <atk/atkutil.h>
30 G_BEGIN_DECLS
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.
50 * Specifies where an object should be placed on the screen when using scroll_to.
51 **/
52 typedef enum {
53 ATK_SCROLL_TOP_LEFT,
54 ATK_SCROLL_BOTTOM_RIGHT,
55 ATK_SCROLL_TOP_EDGE,
56 ATK_SCROLL_BOTTOM_EDGE,
57 ATK_SCROLL_LEFT_EDGE,
58 ATK_SCROLL_RIGHT_EDGE,
59 ATK_SCROLL_ANYWHERE
60 } AtkScrollType;
63 * The AtkComponent interface should be supported by any object that is
64 * rendered on the screen. The interface provides the standard mechanism
65 * for an assistive technology to determine and set the graphical
66 * representation of an object.
69 #define ATK_TYPE_COMPONENT (atk_component_get_type ())
70 #define ATK_IS_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_COMPONENT)
71 #define ATK_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_COMPONENT, AtkComponent)
72 #define ATK_COMPONENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_COMPONENT, AtkComponentIface))
74 #ifndef _TYPEDEF_ATK_COMPONENT_
75 #define _TYPEDEF_ATK_COMPONENT_
76 typedef struct _AtkComponent AtkComponent;
77 #endif
78 typedef struct _AtkComponentIface AtkComponentIface;
80 /**
81 * AtkFocusHandler:
82 * @object: the #AtkObject that receives/lose the focus
83 * @focus_in: TRUE if the object receives the focus
85 * The type of callback function used for
86 * atk_component_add_focus_handler() and
87 * atk_component_remove_focus_handler()
89 * Deprecated: 2.9.4: Deprecated with atk_component_add_focus_handler()
90 * and atk_component_remove_focus_handler(). See those
91 * methods for more information.
93 typedef void (*AtkFocusHandler) (AtkObject* object, gboolean focus_in);
95 typedef struct _AtkRectangle AtkRectangle;
97 /**
98 * AtkRectangle:
99 * @x: X coordinate of the left side of the rectangle.
100 * @y: Y coordinate of the top side of the rectangle.
101 * @width: width of the rectangle.
102 * @height: height of the rectangle.
104 * A data structure for holding a rectangle. Those coordinates are
105 * relative to the component top-level parent.
107 struct _AtkRectangle
109 gint x;
110 gint y;
111 gint width;
112 gint height;
115 ATK_AVAILABLE_IN_ALL
116 GType atk_rectangle_get_type (void);
118 #define ATK_TYPE_RECTANGLE (atk_rectangle_get_type ())
121 * AtkComponentIface:
122 * @add_focus_handler: This virtual function is deprecated since 2.9.4
123 * and it should not be overriden. See
124 * atk_component_add_focus_handler() for more information.
125 * @get_position: This virtual function is deprecated since 2.12 and
126 * it should not be overriden. Use @get_extents instead.
127 * @get_size: This virtual function is deprecated since 2.12 and it
128 * should not be overriden. Use @get_extents instead.
129 * @remove_focus_handler: This virtual function is deprecated since
130 * 2.9.4 and it should not be overriden. See
131 * atk_component_remove_focus_handler() for more information.
134 struct _AtkComponentIface
136 GTypeInterface parent;
138 guint (* add_focus_handler) (AtkComponent *component,
139 AtkFocusHandler handler);
141 gboolean (* contains) (AtkComponent *component,
142 gint x,
143 gint y,
144 AtkCoordType coord_type);
146 AtkObject* (* ref_accessible_at_point) (AtkComponent *component,
147 gint x,
148 gint y,
149 AtkCoordType coord_type);
150 void (* get_extents) (AtkComponent *component,
151 gint *x,
152 gint *y,
153 gint *width,
154 gint *height,
155 AtkCoordType coord_type);
156 void (* get_position) (AtkComponent *component,
157 gint *x,
158 gint *y,
159 AtkCoordType coord_type);
160 void (* get_size) (AtkComponent *component,
161 gint *width,
162 gint *height);
163 gboolean (* grab_focus) (AtkComponent *component);
164 void (* remove_focus_handler) (AtkComponent *component,
165 guint handler_id);
166 gboolean (* set_extents) (AtkComponent *component,
167 gint x,
168 gint y,
169 gint width,
170 gint height,
171 AtkCoordType coord_type);
172 gboolean (* set_position) (AtkComponent *component,
173 gint x,
174 gint y,
175 AtkCoordType coord_type);
176 gboolean (* set_size) (AtkComponent *component,
177 gint width,
178 gint height);
180 AtkLayer (* get_layer) (AtkComponent *component);
181 gint (* get_mdi_zorder) (AtkComponent *component);
184 * signal handlers
186 void (* bounds_changed) (AtkComponent *component,
187 AtkRectangle *bounds);
188 gdouble (* get_alpha) (AtkComponent *component);
191 * Scrolls this object so it becomes visible on the screen.
192 * Since ATK 2.30
194 gboolean (*scroll_to) (AtkComponent *component,
195 AtkScrollType type);
197 gboolean (*scroll_to_point) (AtkComponent *component,
198 AtkCoordType coords,
199 gint x,
200 gint y);
203 ATK_AVAILABLE_IN_ALL
204 GType atk_component_get_type (void);
206 /* convenience functions */
207 ATK_DEPRECATED_IN_2_10
208 guint atk_component_add_focus_handler (AtkComponent *component,
209 AtkFocusHandler handler);
210 ATK_AVAILABLE_IN_ALL
211 gboolean atk_component_contains (AtkComponent *component,
212 gint x,
213 gint y,
214 AtkCoordType coord_type);
215 ATK_AVAILABLE_IN_ALL
216 AtkObject* atk_component_ref_accessible_at_point(AtkComponent *component,
217 gint x,
218 gint y,
219 AtkCoordType coord_type);
220 ATK_AVAILABLE_IN_ALL
221 void atk_component_get_extents (AtkComponent *component,
222 gint *x,
223 gint *y,
224 gint *width,
225 gint *height,
226 AtkCoordType coord_type);
227 ATK_DEPRECATED_IN_2_12_FOR(atk_component_get_extents)
228 void atk_component_get_position (AtkComponent *component,
229 gint *x,
230 gint *y,
231 AtkCoordType coord_type);
232 ATK_DEPRECATED_IN_2_12_FOR(atk_component_get_extents)
233 void atk_component_get_size (AtkComponent *component,
234 gint *width,
235 gint *height);
236 ATK_AVAILABLE_IN_ALL
237 AtkLayer atk_component_get_layer (AtkComponent *component);
238 ATK_AVAILABLE_IN_ALL
239 gint atk_component_get_mdi_zorder (AtkComponent *component);
240 ATK_AVAILABLE_IN_ALL
241 gboolean atk_component_grab_focus (AtkComponent *component);
242 ATK_DEPRECATED_IN_2_10
243 void atk_component_remove_focus_handler (AtkComponent *component,
244 guint handler_id);
245 ATK_AVAILABLE_IN_ALL
246 gboolean atk_component_set_extents (AtkComponent *component,
247 gint x,
248 gint y,
249 gint width,
250 gint height,
251 AtkCoordType coord_type);
252 ATK_AVAILABLE_IN_ALL
253 gboolean atk_component_set_position (AtkComponent *component,
254 gint x,
255 gint y,
256 AtkCoordType coord_type);
257 ATK_AVAILABLE_IN_ALL
258 gboolean atk_component_set_size (AtkComponent *component,
259 gint width,
260 gint height);
261 ATK_AVAILABLE_IN_ALL
262 gdouble atk_component_get_alpha (AtkComponent *component);
264 ATK_AVAILABLE_IN_2_30
265 gboolean atk_component_scroll_to (AtkComponent *component,
266 AtkScrollType type);
268 ATK_AVAILABLE_IN_2_30
269 gboolean atk_component_scroll_to_point (AtkComponent *component,
270 AtkCoordType coords,
271 gint x,
272 gint y);
274 G_END_DECLS
276 #endif /* __ATK_COMPONENT_H__ */