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_run_attributes:
52 *@text: an #AtkEditableText
53 *@attrib_set: an #AtkAttributeSet
54 *@start_offset: start of range in which to set attributes
55 *@end_offset: end of range in which to set attributes
57 *Sets the attributes for a specified range. See the ATK_ATTRIBUTE
58 *macros (such as #ATK_ATTRIBUTE_LEFT_MARGIN) for examples of attributes
59 *that can be set. Note that other attributes that do not have corresponding
60 *ATK_ATTRIBUTE macros may also be set for certain text widgets.
62 *Returns: %TRUE if attributes successfully set for the specified
63 *range, otherwise %FALSE
66 atk_editable_text_set_run_attributes (AtkEditableText *text,
67 AtkAttributeSet *attrib_set,
71 AtkEditableTextIface *iface;
73 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (text), FALSE);
75 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
77 if (iface->set_run_attributes)
79 return (*(iface->set_run_attributes)) (text, attrib_set, start_offset, end_offset);
89 * atk_editable_text_set_text_contents:
90 * @text: an #AtkEditableText
91 * @string: string to set for text contents of @text
93 * Set text contents of @text.
96 atk_editable_text_set_text_contents (AtkEditableText *text,
99 AtkEditableTextIface *iface;
101 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
103 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
105 if (iface->set_text_contents)
106 (*(iface->set_text_contents)) (text, string);
110 * atk_editable_text_insert_text:
111 * @text: an #AtkEditableText
112 * @string: the text to insert
113 * @length: the length of text to insert, in bytes
114 * @position: The caller initializes this to
115 * the position at which to insert the text. After the call it
116 * points at the position after the newly inserted text.
118 * Insert text at a given position.
121 atk_editable_text_insert_text (AtkEditableText *text,
126 AtkEditableTextIface *iface;
128 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
130 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
132 if (iface->insert_text)
133 (*(iface->insert_text)) (text, string, length, position);
137 * atk_editable_text_copy_text:
138 * @text: an #AtkEditableText
139 * @start_pos: start position
140 * @end_pos: end position
142 * Copy text from @start_pos up to, but not including @end_pos
146 atk_editable_text_copy_text (AtkEditableText *text,
150 AtkEditableTextIface *iface;
152 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
154 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
156 if (iface->copy_text)
157 (*(iface->copy_text)) (text, start_pos, end_pos);
161 * atk_editable_text_cut_text:
162 * @text: an #AtkEditableText
163 * @start_pos: start position
164 * @end_pos: end position
166 * Copy text from @start_pos up to, but not including @end_pos
167 * to the clipboard and then delete from the widget.
170 atk_editable_text_cut_text (AtkEditableText *text,
174 AtkEditableTextIface *iface;
176 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
178 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
181 (*(iface->cut_text)) (text, start_pos, end_pos);
185 * atk_editable_text_delete_text:
186 * @text: an #AtkEditableText
187 * @start_pos: start position
188 * @end_pos: end position
190 * Delete text @start_pos up to, but not including @end_pos.
193 atk_editable_text_delete_text (AtkEditableText *text,
197 AtkEditableTextIface *iface;
199 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
201 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
203 if (iface->delete_text)
204 (*(iface->delete_text)) (text, start_pos, end_pos);
208 * atk_editable_text_paste_text:
209 * @text: an #AtkEditableText
210 * @position: position to paste
212 * Paste text from clipboard to specified @position.
215 atk_editable_text_paste_text (AtkEditableText *text,
218 AtkEditableTextIface *iface;
220 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
222 iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
224 if (iface->paste_text)
225 (*(iface->paste_text)) (text, position);