Added better gtk-doc comments.
[platform/upstream/atk.git] / atk / atkeditabletext.c
1 /* ATK - The Accessibility Toolkit for GTK+
2  * Copyright 2001 Sun Microsystems Inc.
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include "atkeditabletext.h"
21
22
23 struct _AtkEditableTextIfaceClass
24 {
25   GObjectClass parent;
26 };
27
28 typedef struct _AtkEditableTextIfaceClass AtkEditableTextIfaceClass;
29
30 GType
31 atk_editable_text_get_type ()
32 {
33   static GType type = 0;
34
35   if (!type) {
36     static const GTypeInfo tinfo =
37     {
38       sizeof (AtkEditableTextIface),
39       NULL,
40       NULL,
41
42     };
43
44     type = g_type_register_static (G_TYPE_INTERFACE, "AtkEditableText", &tinfo, 0);
45   }
46
47   return type;
48 }
49
50
51 /**
52  *atk_editable_text_select_text:
53  *@text: an #AtkEditableText
54  *@start_pos: start position
55  *@end_pos: end position
56  *
57  *Select text between @start_pos and @end_pos
58  **/
59 void 
60 atk_editable_text_select_text (AtkEditableText  *text,
61                                gint             start_pos,
62                                gint             end_pos)
63 {
64   AtkEditableTextIface *iface;
65
66   g_return_if_fail (text != NULL);
67   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
68
69   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
70
71   if (iface->select_text)
72     (*(iface->select_text)) (text, start_pos, end_pos);
73 }
74
75 /**
76  *atk_editable_text_set_attributes:
77  *@text: an #AtkEditableText
78  *@start_pos: start position
79  *@end_pos: end position
80  *@attributes: a #PangoAttrList to set for @text
81  *
82  *Set attributes for text between @start_pos and @end_pos
83  **/
84 void 
85 atk_editable_text_set_attributes (AtkEditableText  *text,
86                                   gint             start_pos,
87                                   gint             end_pos,
88                                   PangoAttrList    *attributes)
89 {
90   AtkEditableTextIface *iface;
91
92   g_return_if_fail (text != NULL);
93   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
94
95   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
96
97   if (iface->set_attributes)
98     (*(iface->set_attributes)) (text, start_pos, end_pos, attributes);
99 }
100
101 /**
102  *atk_editable_text_set_text_contents:
103  *@text: an #AtkEditableText
104  *@string: string to set for text contents of @text
105  *
106  *Set text contents of @text
107  **/
108 void 
109 atk_editable_text_set_text_contents (AtkEditableText  *text,
110                                      const gchar      *string)
111 {
112   AtkEditableTextIface *iface;
113
114   g_return_if_fail (text != NULL);
115   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
116
117   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
118
119   if (iface->set_text_contents)
120     (*(iface->set_text_contents)) (text, string);
121 }
122
123 /**
124  *atk_editable_text_insert_text:
125  *@text: an #AtkEditableText
126  *@string: a #gchar string to insert
127  *@length: number of characters to insert @string
128  *@position: position at which to insert @string
129  *
130  *Insert @length characters of @string into text contents
131  * of @text at position @position 
132  **/
133 void 
134 atk_editable_text_insert_text (AtkEditableText  *text,
135                                const gchar      *string,
136                                gint             length,
137                                gint             *position)
138 {
139   AtkEditableTextIface *iface;
140
141   g_return_if_fail (text != NULL);
142   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
143
144   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
145
146   if (iface->insert_text)
147     (*(iface->insert_text)) (text, string, length, position);
148 }
149
150 /**
151  *atk_editable_text_copy_text:
152  *@text: an #AtkEditableText
153  *@start_pos: start position
154  *@end_pos: end position
155  *
156  * Copy text between @start_pos and @end_pos
157  **/
158 void 
159 atk_editable_text_copy_text (AtkEditableText  *text,
160                              gint             start_pos,
161                              gint             end_pos)
162 {
163   AtkEditableTextIface *iface;
164
165   g_return_if_fail (text != NULL);
166   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
167
168   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
169
170   if (iface->copy_text)
171     (*(iface->copy_text)) (text, start_pos, end_pos);
172 }
173
174 /**
175  *atk_editable_text_cut_text:
176  *@text: an #AtkEditableText
177  *@start_pos: start position
178  *@end_pos: end position
179  *
180  * Cut text between @start_pos and @end_pos
181  **/
182 void 
183 atk_editable_text_cut_text  (AtkEditableText  *text,
184                              gint             start_pos,
185                              gint             end_pos)
186 {
187   AtkEditableTextIface *iface;
188
189   g_return_if_fail (text != NULL);
190   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
191
192   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
193
194   if (iface->cut_text)
195     (*(iface->cut_text)) (text, start_pos, end_pos);
196 }
197
198 /**
199  *atk_editable_text_delete_text:
200  *@text: an #AtkEditableText
201  *@start_pos: start position
202  *@end_pos: end position
203  *
204  * Delete text between @start_pos and @end_pos
205  **/
206 void 
207 atk_editable_text_delete_text (AtkEditableText  *text,
208                                gint             start_pos,
209                                gint             end_pos)
210 {
211   AtkEditableTextIface *iface;
212
213   g_return_if_fail (text != NULL);
214   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
215
216   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
217
218   if (iface->delete_text)
219     (*(iface->delete_text)) (text, start_pos, end_pos);
220 }
221
222 /**
223  *atk_editable_text_paste_text:
224  *@text: an #AtkEditableText
225  *@position: position to paste
226  *
227  * Paste text at @position 
228  **/
229 void 
230 atk_editable_text_paste_text (AtkEditableText  *text,
231                               gint             position)
232 {
233   AtkEditableTextIface *iface;
234
235   g_return_if_fail (text != NULL);
236   g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
237
238   iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
239
240   if (iface->paste_text)
241     (*(iface->paste_text)) (text, position);
242 }