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"
24 atk_editable_text_get_type (void)
26 static GType type
= 0;
29 static const GTypeInfo tinfo
=
31 sizeof (AtkEditableTextIface
),
33 (GBaseFinalizeFunc
) NULL
,
37 type
= g_type_register_static (G_TYPE_INTERFACE
, "AtkEditableText", &tinfo
, 0);
44 *atk_editable_text_set_run_attributes:
45 *@text: an #AtkEditableText
46 *@attrib_set: an #AtkAttributeSet
47 *@start_offset: start of range in which to set attributes
48 *@end_offset: end of range in which to set attributes
50 *Sets the attributes for a specified range. See the ATK_ATTRIBUTE
51 *macros (such as #ATK_ATTRIBUTE_LEFT_MARGIN) for examples of attributes
52 *that can be set. Note that other attributes that do not have corresponding
53 *ATK_ATTRIBUTE macros may also be set for certain text widgets.
55 *Returns: %TRUE if attributes successfully set for the specified
56 *range, otherwise %FALSE
59 atk_editable_text_set_run_attributes (AtkEditableText
*text
,
60 AtkAttributeSet
*attrib_set
,
64 AtkEditableTextIface
*iface
;
66 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (text
), FALSE
);
68 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
70 if (iface
->set_run_attributes
)
72 return (*(iface
->set_run_attributes
)) (text
, attrib_set
, start_offset
, end_offset
);
82 * atk_editable_text_set_text_contents:
83 * @text: an #AtkEditableText
84 * @string: string to set for text contents of @text
86 * Set text contents of @text.
89 atk_editable_text_set_text_contents (AtkEditableText
*text
,
92 AtkEditableTextIface
*iface
;
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 (ATK_IS_EDITABLE_TEXT (text
));
123 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
125 if (iface
->insert_text
)
126 (*(iface
->insert_text
)) (text
, string
, length
, position
);
130 * atk_editable_text_copy_text:
131 * @text: an #AtkEditableText
132 * @start_pos: start position
133 * @end_pos: end position
135 * Copy text from @start_pos up to, but not including @end_pos
139 atk_editable_text_copy_text (AtkEditableText
*text
,
143 AtkEditableTextIface
*iface
;
145 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
147 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
149 if (iface
->copy_text
)
150 (*(iface
->copy_text
)) (text
, start_pos
, end_pos
);
154 * atk_editable_text_cut_text:
155 * @text: an #AtkEditableText
156 * @start_pos: start position
157 * @end_pos: end position
159 * Copy text from @start_pos up to, but not including @end_pos
160 * to the clipboard and then delete from the widget.
163 atk_editable_text_cut_text (AtkEditableText
*text
,
167 AtkEditableTextIface
*iface
;
169 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
171 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
174 (*(iface
->cut_text
)) (text
, start_pos
, end_pos
);
178 * atk_editable_text_delete_text:
179 * @text: an #AtkEditableText
180 * @start_pos: start position
181 * @end_pos: end position
183 * Delete text @start_pos up to, but not including @end_pos.
186 atk_editable_text_delete_text (AtkEditableText
*text
,
190 AtkEditableTextIface
*iface
;
192 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
194 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
196 if (iface
->delete_text
)
197 (*(iface
->delete_text
)) (text
, start_pos
, end_pos
);
201 * atk_editable_text_paste_text:
202 * @text: an #AtkEditableText
203 * @position: position to paste
205 * Paste text from clipboard to specified @position.
208 atk_editable_text_paste_text (AtkEditableText
*text
,
211 AtkEditableTextIface
*iface
;
213 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
215 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
217 if (iface
->paste_text
)
218 (*(iface
->paste_text
)) (text
, position
);