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 * SECTION:atkeditabletext
24 * @Short_description: The ATK interface implemented by components
25 * containing user-editable text content.
26 * @Title:AtkEditableText
28 * #AtkEditableText should be implemented by UI components which
29 * contain text which the user can edit, via the #AtkObject
30 * corresponding to that component (see #AtkObject).
32 * #AtkEditableText is a subclass of #AtkText, and as such, an object
33 * which implements #AtkEditableText is by definition an #AtkText
34 * implementor as well.
40 atk_editable_text_get_type (void)
42 static GType type
= 0;
45 static const GTypeInfo tinfo
=
47 sizeof (AtkEditableTextIface
),
49 (GBaseFinalizeFunc
) NULL
,
53 type
= g_type_register_static (G_TYPE_INTERFACE
, "AtkEditableText", &tinfo
, 0);
60 *atk_editable_text_set_run_attributes:
61 *@text: an #AtkEditableText
62 *@attrib_set: an #AtkAttributeSet
63 *@start_offset: start of range in which to set attributes
64 *@end_offset: end of range in which to set attributes
66 *Sets the attributes for a specified range. See the ATK_ATTRIBUTE
67 *macros (such as #ATK_ATTRIBUTE_LEFT_MARGIN) for examples of attributes
68 *that can be set. Note that other attributes that do not have corresponding
69 *ATK_ATTRIBUTE macros may also be set for certain text widgets.
71 *Returns: %TRUE if attributes successfully set for the specified
72 *range, otherwise %FALSE
75 atk_editable_text_set_run_attributes (AtkEditableText
*text
,
76 AtkAttributeSet
*attrib_set
,
80 AtkEditableTextIface
*iface
;
82 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (text
), FALSE
);
84 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
86 if (iface
->set_run_attributes
)
88 return (*(iface
->set_run_attributes
)) (text
, attrib_set
, start_offset
, end_offset
);
98 * atk_editable_text_set_text_contents:
99 * @text: an #AtkEditableText
100 * @string: string to set for text contents of @text
102 * Set text contents of @text.
105 atk_editable_text_set_text_contents (AtkEditableText
*text
,
108 AtkEditableTextIface
*iface
;
110 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
112 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
114 if (iface
->set_text_contents
)
115 (*(iface
->set_text_contents
)) (text
, string
);
119 * atk_editable_text_insert_text:
120 * @text: an #AtkEditableText
121 * @string: the text to insert
122 * @length: the length of text to insert, in bytes
123 * @position: The caller initializes this to
124 * the position at which to insert the text. After the call it
125 * points at the position after the newly inserted text.
127 * Insert text at a given position.
130 atk_editable_text_insert_text (AtkEditableText
*text
,
135 AtkEditableTextIface
*iface
;
137 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
139 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
141 if (iface
->insert_text
)
142 (*(iface
->insert_text
)) (text
, string
, length
, position
);
146 * atk_editable_text_copy_text:
147 * @text: an #AtkEditableText
148 * @start_pos: start position
149 * @end_pos: end position
151 * Copy text from @start_pos up to, but not including @end_pos
155 atk_editable_text_copy_text (AtkEditableText
*text
,
159 AtkEditableTextIface
*iface
;
161 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
163 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
165 if (iface
->copy_text
)
166 (*(iface
->copy_text
)) (text
, start_pos
, end_pos
);
170 * atk_editable_text_cut_text:
171 * @text: an #AtkEditableText
172 * @start_pos: start position
173 * @end_pos: end position
175 * Copy text from @start_pos up to, but not including @end_pos
176 * to the clipboard and then delete from the widget.
179 atk_editable_text_cut_text (AtkEditableText
*text
,
183 AtkEditableTextIface
*iface
;
185 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
187 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
190 (*(iface
->cut_text
)) (text
, start_pos
, end_pos
);
194 * atk_editable_text_delete_text:
195 * @text: an #AtkEditableText
196 * @start_pos: start position
197 * @end_pos: end position
199 * Delete text @start_pos up to, but not including @end_pos.
202 atk_editable_text_delete_text (AtkEditableText
*text
,
206 AtkEditableTextIface
*iface
;
208 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
210 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
212 if (iface
->delete_text
)
213 (*(iface
->delete_text
)) (text
, start_pos
, end_pos
);
217 * atk_editable_text_paste_text:
218 * @text: an #AtkEditableText
219 * @position: position to paste
221 * Paste text from clipboard to specified @position.
224 atk_editable_text_paste_text (AtkEditableText
*text
,
227 AtkEditableTextIface
*iface
;
229 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
231 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
233 if (iface
->paste_text
)
234 (*(iface
->paste_text
)) (text
, position
);