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.
20 #include "atkeditabletext.h"
23 struct _AtkEditableTextIfaceClass
28 typedef struct _AtkEditableTextIfaceClass AtkEditableTextIfaceClass;
31 atk_editable_text_get_type ()
33 static GType type = 0;
36 static const GTypeInfo tinfo =
38 sizeof (AtkEditableTextIface),
44 type = g_type_register_static (G_TYPE_INTERFACE, "AtkEditableText", &tinfo, 0);
52 * atk_editable_text_select_text:
53 * @text: an #AtkEditableText
54 * @start_pos: start position
55 * @end_pos: end position
57 * Select text between @start_pos and @end_pos. The characters that are selected
58 * are those characters at positions from @start_pos up to, but not including
59 * @end_pos. If @end_pos is negative, then the characters selected
60 * will be those characters from start_pos to the end of the text.
63 atk_editable_text_select_text (AtkEditableText *text,
67 AtkEditableTextIface *iface;
69 g_return_if_fail (text != NULL);
70 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
72 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
74 if (iface->select_text)
75 (*(iface->select_text)) (text, start_pos, end_pos);
79 * atk_editable_text_set_attributes:
80 * @text: an #AtkEditableText
81 * @start_pos: start position
82 * @end_pos: end position
83 * @attributes: a #PangoAttrList to set for text between @start_pos and @end_pos
85 * Set attributes for text between @start_pos and @end_pos. The characters
86 * whose attributes are set are those characters at positions from @start_pos
87 * up to, but not including @end_pos. If @end_pos is negative, then the
88 * characters selected will be those characters from start_pos to
89 * the end of the text.
92 atk_editable_text_set_attributes (AtkEditableText *text,
95 PangoAttrList *attributes)
97 AtkEditableTextIface *iface;
99 g_return_if_fail (text != NULL);
100 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
102 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
104 if (iface->set_attributes)
105 (*(iface->set_attributes)) (text, start_pos, end_pos, attributes);
109 * atk_editable_text_set_text_contents:
110 * @text: an #AtkEditableText
111 * @string: string to set for text contents of @text
113 * Set text contents of @text
116 atk_editable_text_set_text_contents (AtkEditableText *text,
119 AtkEditableTextIface *iface;
121 g_return_if_fail (text != NULL);
122 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
124 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
126 if (iface->set_text_contents)
127 (*(iface->set_text_contents)) (text, string);
131 * atk_editable_text_insert_text:
132 * @text: an #AtkEditableText
133 * @string: the text to insert
134 * @length: the length of text to insert, in bytes
135 * @position: The caller initializes this to
136 * the position at which to insert the text. After the call it
137 * points at the position after the newly inserted text.
139 * Insert text at a given position
142 atk_editable_text_insert_text (AtkEditableText *text,
147 AtkEditableTextIface *iface;
149 g_return_if_fail (text != NULL);
150 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
152 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
154 if (iface->insert_text)
155 (*(iface->insert_text)) (text, string, length, position);
159 * atk_editable_text_copy_text:
160 * @text: an #AtkEditableText
161 * @start_pos: start position
162 * @end_pos: end position
164 * Copy text from @start_pos up to, but not including @end_pos
168 atk_editable_text_copy_text (AtkEditableText *text,
172 AtkEditableTextIface *iface;
174 g_return_if_fail (text != NULL);
175 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
177 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
179 if (iface->copy_text)
180 (*(iface->copy_text)) (text, start_pos, end_pos);
184 * atk_editable_text_cut_text:
185 * @text: an #AtkEditableText
186 * @start_pos: start position
187 * @end_pos: end position
189 * Copy text from @start_pos up to, but not including @end_pos
190 * to the clipboard and then delete from the widget.
193 atk_editable_text_cut_text (AtkEditableText *text,
197 AtkEditableTextIface *iface;
199 g_return_if_fail (text != NULL);
200 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
202 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
205 (*(iface->cut_text)) (text, start_pos, end_pos);
209 * atk_editable_text_delete_text:
210 * @text: an #AtkEditableText
211 * @start_pos: start position
212 * @end_pos: end position
214 * Delete text @start_pos up to, but not including @end_pos
217 atk_editable_text_delete_text (AtkEditableText *text,
221 AtkEditableTextIface *iface;
223 g_return_if_fail (text != NULL);
224 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
226 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
228 if (iface->delete_text)
229 (*(iface->delete_text)) (text, start_pos, end_pos);
233 * atk_editable_text_paste_text:
234 * @text: an #AtkEditableText
235 * @position: position to paste
237 * Paste text from clipboard to specified @position
240 atk_editable_text_paste_text (AtkEditableText *text,
243 AtkEditableTextIface *iface;
245 g_return_if_fail (text != NULL);
246 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
248 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
250 if (iface->paste_text)
251 (*(iface->paste_text)) (text, position);