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 Lesser 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser 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.
21 #include "atkcomponent.h"
24 atk_component_get_type ()
26 static GType type = 0;
29 static const GTypeInfo tinfo =
31 sizeof (AtkComponentIface),
37 type = g_type_register_static (G_TYPE_INTERFACE, "AtkComponent", &tinfo, 0);
47 atk_component_add_focus_handler (AtkComponent *component,
48 AtkFocusHandler handler)
50 AtkComponentIface *iface = NULL;
51 g_return_val_if_fail (component != NULL, 0);
52 g_return_val_if_fail (ATK_IS_COMPONENT (component), 0);
54 iface = ATK_COMPONENT_GET_IFACE (component);
56 if (iface->add_focus_handler)
57 return (iface->add_focus_handler) (component, handler);
66 atk_component_remove_focus_handler (AtkComponent *component,
69 AtkComponentIface *iface = NULL;
70 g_return_if_fail (component != NULL);
71 g_return_if_fail (ATK_IS_COMPONENT (component));
73 iface = ATK_COMPONENT_GET_IFACE (component);
75 if (iface->remove_focus_handler)
76 (iface->remove_focus_handler) (component, handler_id);
80 atk_component_contains (AtkComponent *component,
84 AtkComponentIface *iface = NULL;
85 g_return_val_if_fail (component != NULL, FALSE);
86 g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);
88 iface = ATK_COMPONENT_GET_IFACE (component);
91 return (iface->contains) (component, x, y);
97 atk_component_get_accessible_at_point (AtkComponent *component,
101 AtkComponentIface *iface = NULL;
102 g_return_val_if_fail (component != NULL, FALSE);
103 g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);
105 iface = ATK_COMPONENT_GET_IFACE (component);
107 if (iface->get_accessible_at_point)
108 return (iface->get_accessible_at_point) (component, x, y);
114 atk_component_get_extents (AtkComponent *component,
120 AtkComponentIface *iface = NULL;
121 g_return_if_fail (component != NULL);
122 g_return_if_fail (ATK_IS_COMPONENT (component));
124 iface = ATK_COMPONENT_GET_IFACE (component);
126 if (iface->get_extents)
127 (iface->get_extents) (component, x, y, width, height);
131 atk_component_get_position (AtkComponent *component,
135 AtkComponentIface *iface = NULL;
136 g_return_if_fail (component != NULL);
137 g_return_if_fail (ATK_IS_COMPONENT (component));
139 iface = ATK_COMPONENT_GET_IFACE (component);
141 if (iface->get_position)
142 (iface->get_position) (component, x, y);
146 atk_component_get_position_on_screen (AtkComponent *component,
150 AtkComponentIface *iface = NULL;
151 g_return_if_fail (component != NULL);
152 g_return_if_fail (ATK_IS_COMPONENT (component));
154 iface = ATK_COMPONENT_GET_IFACE (component);
156 if (iface->get_position_on_screen)
157 return (iface->get_position_on_screen) (component, x, y);
161 atk_component_get_size (AtkComponent *component,
165 AtkComponentIface *iface = NULL;
166 g_return_if_fail (component != NULL);
167 g_return_if_fail (ATK_IS_COMPONENT (component));
169 iface = ATK_COMPONENT_GET_IFACE (component);
172 (iface->get_size) (component, x, y);
176 atk_component_grab_focus (AtkComponent *component)
178 AtkComponentIface *iface = NULL;
179 g_return_if_fail (component != NULL);
180 g_return_if_fail (ATK_IS_COMPONENT (component));
182 iface = ATK_COMPONENT_GET_IFACE (component);
184 if (iface->grab_focus)
185 (iface->grab_focus) (component);
189 atk_component_set_extents (AtkComponent *component,
195 AtkComponentIface *iface = NULL;
196 g_return_if_fail (component != NULL);
197 g_return_if_fail (ATK_IS_COMPONENT (component));
199 iface = ATK_COMPONENT_GET_IFACE (component);
201 if (iface->set_extents)
202 (iface->set_extents) (component, x, y, width, height);
206 atk_component_set_position (AtkComponent *component,
210 AtkComponentIface *iface = NULL;
211 g_return_if_fail (component != NULL);
212 g_return_if_fail (ATK_IS_COMPONENT (component));
214 iface = ATK_COMPONENT_GET_IFACE (component);
216 if (iface->set_position)
217 (iface->set_position) (component, x, y);
221 atk_component_set_size (AtkComponent *component,
225 AtkComponentIface *iface = NULL;
226 g_return_if_fail (component != NULL);
227 g_return_if_fail (ATK_IS_COMPONENT (component));
229 iface = ATK_COMPONENT_GET_IFACE (component);
232 (iface->set_size) (component, x, y);