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),
40 (GBaseFinalizeFunc) NULL,
44 type = g_type_register_static (G_TYPE_INTERFACE, "AtkEditableText", &tinfo, 0);
51 * atk_editable_text_set_attributes:
52 * @text: an #AtkEditableText
53 * @start_pos: start position
54 * @end_pos: end position
55 * @attributes: a #PangoAttrList to set for text between @start_pos and @end_pos
57 * Set attributes for text between @start_pos and @end_pos. The characters
58 * whose attributes are set are those characters at positions from @start_pos
59 * up to, but not including @end_pos. If @end_pos is negative, then the
60 * characters selected will be those characters from start_pos to
61 * the end of the text.
64 atk_editable_text_set_attributes (AtkEditableText *text,
67 PangoAttrList *attributes)
69 AtkEditableTextIface *iface;
71 g_return_if_fail (text != NULL);
72 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
74 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
76 if (iface->set_attributes)
77 (*(iface->set_attributes)) (text, start_pos, end_pos, attributes);
81 * atk_editable_text_set_text_contents:
82 * @text: an #AtkEditableText
83 * @string: string to set for text contents of @text
85 * Set text contents of @text
88 atk_editable_text_set_text_contents (AtkEditableText *text,
91 AtkEditableTextIface *iface;
93 g_return_if_fail (text != NULL);
94 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
96 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
98 if (iface->set_text_contents)
99 (*(iface->set_text_contents)) (text, string);
103 * atk_editable_text_insert_text:
104 * @text: an #AtkEditableText
105 * @string: the text to insert
106 * @length: the length of text to insert, in bytes
107 * @position: The caller initializes this to
108 * the position at which to insert the text. After the call it
109 * points at the position after the newly inserted text.
111 * Insert text at a given position
114 atk_editable_text_insert_text (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->insert_text)
127 (*(iface->insert_text)) (text, string, length, position);
131 * atk_editable_text_copy_text:
132 * @text: an #AtkEditableText
133 * @start_pos: start position
134 * @end_pos: end position
136 * Copy text from @start_pos up to, but not including @end_pos
140 atk_editable_text_copy_text (AtkEditableText *text,
144 AtkEditableTextIface *iface;
146 g_return_if_fail (text != NULL);
147 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
149 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
151 if (iface->copy_text)
152 (*(iface->copy_text)) (text, start_pos, end_pos);
156 * atk_editable_text_cut_text:
157 * @text: an #AtkEditableText
158 * @start_pos: start position
159 * @end_pos: end position
161 * Copy text from @start_pos up to, but not including @end_pos
162 * to the clipboard and then delete from the widget.
165 atk_editable_text_cut_text (AtkEditableText *text,
169 AtkEditableTextIface *iface;
171 g_return_if_fail (text != NULL);
172 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
174 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
177 (*(iface->cut_text)) (text, start_pos, end_pos);
181 * atk_editable_text_delete_text:
182 * @text: an #AtkEditableText
183 * @start_pos: start position
184 * @end_pos: end position
186 * Delete text @start_pos up to, but not including @end_pos
189 atk_editable_text_delete_text (AtkEditableText *text,
193 AtkEditableTextIface *iface;
195 g_return_if_fail (text != NULL);
196 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
198 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
200 if (iface->delete_text)
201 (*(iface->delete_text)) (text, start_pos, end_pos);
205 * atk_editable_text_paste_text:
206 * @text: an #AtkEditableText
207 * @position: position to paste
209 * Paste text from clipboard to specified @position
212 atk_editable_text_paste_text (AtkEditableText *text,
215 AtkEditableTextIface *iface;
217 g_return_if_fail (text != NULL);
218 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
220 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
222 if (iface->paste_text)
223 (*(iface->paste_text)) (text, position);