1 /* ATK - The Accessibility Toolkit for GTK+
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.
22 struct _AtkTextIfaceClass
27 typedef struct _AtkTextIfaceClass AtkTextIfaceClass;
33 static GType type = 0;
36 static const GTypeInfo tinfo =
38 sizeof (AtkTextIface),
44 type = g_type_register_static (G_TYPE_INTERFACE, "AtkText", &tinfo, 0);
51 atk_text_get_text (AtkText *text,
57 g_return_val_if_fail (text != NULL, NULL);
58 g_return_val_if_fail (ATK_IS_TEXT (text), NULL);
60 iface = ATK_TEXT_GET_IFACE (text);
63 return (*(iface->get_text)) (text, start_offset, end_offset);
69 atk_text_get_character_at_offset (AtkText *text,
74 g_return_val_if_fail (text != NULL, (gunichar) 0);
75 g_return_val_if_fail (ATK_IS_TEXT (text), (gunichar) 0);
77 iface = ATK_TEXT_GET_IFACE (text);
79 if (iface->get_character_at_offset)
80 return (*(iface->get_character_at_offset)) (text, offset);
86 atk_text_get_text_after_offset (AtkText *text,
88 AtkTextBoundary boundary_type)
92 g_return_val_if_fail (text != NULL, NULL);
93 g_return_val_if_fail (ATK_IS_TEXT (text), NULL);
95 iface = ATK_TEXT_GET_IFACE (text);
97 if (iface->get_text_after_offset)
98 return (*(iface->get_text_after_offset)) (text, offset, boundary_type);
104 atk_text_get_text_at_offset (AtkText *text,
106 AtkTextBoundary boundary_type)
110 g_return_val_if_fail (text != NULL, NULL);
111 g_return_val_if_fail (ATK_IS_TEXT (text), NULL);
113 iface = ATK_TEXT_GET_IFACE (text);
115 if (iface->get_text_at_offset)
116 return (*(iface->get_text_at_offset)) (text, offset, boundary_type);
122 atk_text_get_text_before_offset (AtkText *text,
124 AtkTextBoundary boundary_type)
128 g_return_val_if_fail (text != NULL, NULL);
129 g_return_val_if_fail (ATK_IS_TEXT (text), NULL);
131 iface = ATK_TEXT_GET_IFACE (text);
133 if (iface->get_text_before_offset)
134 return (*(iface->get_text_before_offset)) (text, offset, boundary_type);
140 atk_text_get_caret_offset (AtkText *text)
144 g_return_val_if_fail (text != NULL, -1);
145 g_return_val_if_fail (ATK_IS_TEXT (text), -1);
147 iface = ATK_TEXT_GET_IFACE (text);
149 if (iface->get_caret_offset)
150 return (*(iface->get_caret_offset)) (text);
156 atk_text_get_row_col_at_offset (AtkText *text,
163 g_return_if_fail (text != NULL);
164 g_return_if_fail (ATK_IS_TEXT (text));
166 iface = ATK_TEXT_GET_IFACE (text);
168 if (iface->get_row_col_at_offset)
169 (*(iface->get_row_col_at_offset)) (text, offset, row, col);
178 atk_text_get_range_attributes (AtkText *text,
184 g_return_val_if_fail (text != NULL, NULL);
185 g_return_val_if_fail (ATK_IS_TEXT (text), NULL);
187 iface = ATK_TEXT_GET_IFACE (text);
189 if (iface->get_range_attributes)
190 return (*(iface->get_range_attributes)) (text, start_offset, end_offset);
196 atk_text_get_character_extents (AtkText *text,
205 g_return_if_fail (text != NULL);
206 g_return_if_fail (ATK_IS_TEXT (text));
208 iface = ATK_TEXT_GET_IFACE (text);
210 if (iface->get_character_extents)
211 (*(iface->get_character_extents)) (text, offset, x, y, length, width);
222 atk_text_get_character_count (AtkText *text)
226 g_return_val_if_fail (text != NULL, -1);
227 g_return_val_if_fail (ATK_IS_TEXT (text), -1);
229 iface = ATK_TEXT_GET_IFACE (text);
231 if (iface->get_character_count)
232 return (*(iface->get_character_count)) (text);
238 atk_text_get_offset_at_point (AtkText *text,
244 g_return_val_if_fail (text != NULL, -1);
245 g_return_val_if_fail (ATK_IS_TEXT (text), -1);
247 iface = ATK_TEXT_GET_IFACE (text);
249 if (iface->get_offset_at_point)
250 return (*(iface->get_offset_at_point)) (text, x, y);
256 atk_text_get_selected_text (AtkText *text)
260 g_return_val_if_fail (text != NULL, NULL);
261 g_return_val_if_fail (ATK_IS_TEXT (text), NULL);
263 iface = ATK_TEXT_GET_IFACE (text);
265 if (iface->get_selected_text)
266 return (*(iface->get_selected_text)) (text);
272 atk_text_get_selection_bounds (AtkText *text,
278 g_return_if_fail (text != NULL);
279 g_return_if_fail (ATK_IS_TEXT (text));
281 iface = ATK_TEXT_GET_IFACE (text);
283 if (iface->get_selection_bounds)
284 (*(iface->get_selection_bounds)) (text, start_offset, end_offset);
293 atk_text_set_selection_bounds (AtkText *text,
299 g_return_val_if_fail (text != NULL, FALSE);
300 g_return_val_if_fail (ATK_IS_TEXT (text), FALSE);
302 iface = ATK_TEXT_GET_IFACE (text);
304 if (iface->set_selection_bounds)
306 return (*(iface->set_selection_bounds)) (text, start_offset, end_offset);