atkcomponent.h (11324B)
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 #include <atk/atkobject.h> 24 #include <atk/atkutil.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif /* __cplusplus */ 29 30 /** 31 *AtkScrollType: 32 *@ATK_SCROLL_TOP_LEFT: Scroll the object vertically and horizontally to the top 33 *left corner of the window. 34 *@ATK_SCROLL_BOTTOM_RIGHT: Scroll the object vertically and horizontally to the 35 *bottom right corner of the window. 36 *@ATK_SCROLL_TOP_EDGE: Scroll the object vertically to the top edge of the 37 window. 38 *@ATK_SCROLL_BOTTOM_EDGE: Scroll the object vertically to the bottom edge of 39 *the window. 40 *@ATK_SCROLL_LEFT_EDGE: Scroll the object vertically and horizontally to the 41 *left edge of the window. 42 *@ATK_SCROLL_RIGHT_EDGE: Scroll the object vertically and horizontally to the 43 *right edge of the window. 44 *@ATK_SCROLL_ANYWHERE: Scroll the object vertically and horizontally so that 45 *as much as possible of the object becomes visible. The exact placement is 46 *determined by the application. 47 * 48 * Specifies where an object should be placed on the screen when using scroll_to. 49 **/ 50 typedef enum { 51 ATK_SCROLL_TOP_LEFT, 52 ATK_SCROLL_BOTTOM_RIGHT, 53 ATK_SCROLL_TOP_EDGE, 54 ATK_SCROLL_BOTTOM_EDGE, 55 ATK_SCROLL_LEFT_EDGE, 56 ATK_SCROLL_RIGHT_EDGE, 57 ATK_SCROLL_ANYWHERE 58 } AtkScrollType; 59 60 /* 61 * The AtkComponent interface should be supported by any object that is 62 * rendered on the screen. The interface provides the standard mechanism 63 * for an assistive technology to determine and set the graphical 64 * representation of an object. 65 */ 66 67 #define ATK_TYPE_COMPONENT (atk_component_get_type ()) 68 #define ATK_IS_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_COMPONENT) 69 #define ATK_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_COMPONENT, AtkComponent) 70 #define ATK_COMPONENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_COMPONENT, AtkComponentIface)) 71 72 #ifndef _TYPEDEF_ATK_COMPONENT_ 73 #define _TYPEDEF_ATK_COMPONENT_ 74 typedef struct _AtkComponent AtkComponent; 75 #endif 76 typedef struct _AtkComponentIface AtkComponentIface; 77 78 typedef void (*AtkFocusHandler) (AtkObject*, gboolean); 79 80 typedef struct _AtkRectangle AtkRectangle; 81 82 struct _AtkRectangle 83 { 84 gint x; 85 gint y; 86 gint width; 87 gint height; 88 }; 89 90 GType atk_rectangle_get_type (void); 91 92 #define ATK_TYPE_RECTANGLE (atk_rectangle_get_type ()) 93 struct _AtkComponentIface 94 { 95 GTypeInterface parent; 96 97 guint (* add_focus_handler) (AtkComponent *component, 98 AtkFocusHandler handler); 99 100 gboolean (* contains) (AtkComponent *component, 101 gint x, 102 gint y, 103 AtkCoordType coord_type); 104 105 AtkObject* (* ref_accessible_at_point) (AtkComponent *component, 106 gint x, 107 gint y, 108 AtkCoordType coord_type); 109 void (* get_extents) (AtkComponent *component, 110 gint *x, 111 gint *y, 112 gint *width, 113 gint *height, 114 AtkCoordType coord_type); 115 void (* get_position) (AtkComponent *component, 116 gint *x, 117 gint *y, 118 AtkCoordType coord_type); 119 void (* get_size) (AtkComponent *component, 120 gint *width, 121 gint *height); 122 gboolean (* grab_focus) (AtkComponent *component); 123 void (* remove_focus_handler) (AtkComponent *component, 124 guint handler_id); 125 gboolean (* set_extents) (AtkComponent *component, 126 gint x, 127 gint y, 128 gint width, 129 gint height, 130 AtkCoordType coord_type); 131 gboolean (* set_position) (AtkComponent *component, 132 gint x, 133 gint y, 134 AtkCoordType coord_type); 135 gboolean (* set_size) (AtkComponent *component, 136 gint width, 137 gint height); 138 139 AtkLayer (* get_layer) (AtkComponent *component); 140 gint (* get_mdi_zorder) (AtkComponent *component); 141 142 /* 143 * signal handlers 144 */ 145 void (* bounds_changed) (AtkComponent *component, 146 AtkRectangle *bounds); 147 gdouble (* get_alpha) (AtkComponent *component); 148 149 /* 150 * Scrolls this object so it becomes visible on the screen. 151 * Since ATK 2.30 152 */ 153 gboolean (*scroll_to) (AtkComponent *component, 154 AtkScrollType type); 155 156 gboolean (*scroll_to_point) (AtkComponent *component, 157 AtkCoordType coords, 158 gint x, 159 gint y); 160 }; 161 162 GType atk_component_get_type (void); 163 164 /* convenience functions */ 165 166 guint atk_component_add_focus_handler (AtkComponent *component, 167 AtkFocusHandler handler); 168 gboolean atk_component_contains (AtkComponent *component, 169 gint x, 170 gint y, 171 AtkCoordType coord_type); 172 AtkObject* atk_component_ref_accessible_at_point(AtkComponent *component, 173 gint x, 174 gint y, 175 AtkCoordType coord_type); 176 void atk_component_get_extents (AtkComponent *component, 177 gint *x, 178 gint *y, 179 gint *width, 180 gint *height, 181 AtkCoordType coord_type); 182 void atk_component_get_position (AtkComponent *component, 183 gint *x, 184 gint *y, 185 AtkCoordType coord_type); 186 void atk_component_get_size (AtkComponent *component, 187 gint *width, 188 gint *height); 189 AtkLayer atk_component_get_layer (AtkComponent *component); 190 gint atk_component_get_mdi_zorder (AtkComponent *component); 191 gboolean atk_component_grab_focus (AtkComponent *component); 192 void atk_component_remove_focus_handler (AtkComponent *component, 193 guint handler_id); 194 gboolean atk_component_set_extents (AtkComponent *component, 195 gint x, 196 gint y, 197 gint width, 198 gint height, 199 AtkCoordType coord_type); 200 gboolean atk_component_set_position (AtkComponent *component, 201 gint x, 202 gint y, 203 AtkCoordType coord_type); 204 gboolean atk_component_set_size (AtkComponent *component, 205 gint width, 206 gint height); 207 gdouble atk_component_get_alpha (AtkComponent *component); 208 gboolean atk_component_scroll_to (AtkComponent *component, 209 AtkScrollType type); 210 211 gboolean atk_component_scroll_to_point (AtkComponent *component, 212 AtkCoordType coords, 213 gint x, 214 gint y); 215 216 #ifdef __cplusplus 217 } 218 #endif /* __cplusplus */ 219 220 221 #endif /* __ATK_COMPONENT_H__ */