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"
28 struct _AtkEditableTextIfaceClass
33 typedef struct _AtkEditableTextIfaceClass AtkEditableTextIfaceClass
;
36 static void atk_editable_text_interface_init (AtkEditableTextIfaceClass
*klass
);
38 static gpointer parent_class
= NULL
;
43 atk_editable_text_get_type ()
45 static GType type
= 0;
48 static const GTypeInfo tinfo
=
50 sizeof (AtkEditableTextIface
),
56 type
= g_type_register_static (G_TYPE_INTERFACE
, "AtkEditableText", &tinfo
, 0);
63 * Additional GObject properties exported by AtkText:
64 * "accessible_text" (accessible text has changed)
65 * "accessible_caret" (accessible text cursor position changed:
71 atk_editable_text_interface_init (AtkEditableTextIfaceClass
*klass
)
73 parent_class
= g_type_class_ref (ATK_TYPE_EDITABLE_TEXT
);
75 /* Note that text_changed signal supports details "insert", "delete", possibly "replace". */
77 atk_signals
[TEXT_CHANGED
] =
78 g_signal_newc ("text_changed",
79 G_TYPE_FROM_CLASS (klass
),
80 G_SIGNAL_RUN_LAST
| G_SIGNAL_DETAILED
,
81 G_STRUCT_OFFSET (AtkEditableTextClass
, text_changed
), /* still need to declare and define this func */
83 g_cclosure_marshal_VOID__UINT_POINTER
,
85 2, G_TYPE_UINT
, ATK_TYPE_OBJECT
);
87 atk_signals
[CARET_MOVED
] =
88 g_signal_newc ("text_caret_moved",
89 G_TYPE_FROM_CLASS (klass
),
91 G_STRUCT_OFFSET (AtkTextClass
, caret_changed
), /* still need to declare and define this func */
93 g_cclosure_marshal_VOID__UINT_POINTER
,
95 2, G_TYPE_UINT
, ATK_TYPE_OBJECT
);
100 atk_editable_text_select_text (AtkEditableText
*text
,
104 AtkEditableTextIface
*iface
;
106 g_return_if_fail (text
!= NULL
);
107 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
109 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
111 if (iface
->select_text
)
112 (*(iface
->select_text
)) (text
, start_pos
, end_pos
);
116 atk_editable_text_set_attributes (AtkEditableText
*text
,
119 PangoAttrList
*attributes
)
121 AtkEditableTextIface
*iface
;
123 g_return_if_fail (text
!= NULL
);
124 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
126 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
128 if (iface
->set_attributes
)
129 (*(iface
->set_attributes
)) (text
, start_pos
, end_pos
, attributes
);
133 atk_editable_text_set_text_contents (AtkEditableText
*text
,
136 AtkEditableTextIface
*iface
;
138 g_return_if_fail (text
!= NULL
);
139 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
141 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
143 if (iface
->set_text_contents
)
144 (*(iface
->set_text_contents
)) (text
, string
);
148 atk_editable_text_insert_text (AtkEditableText
*text
,
153 AtkEditableTextIface
*iface
;
155 g_return_if_fail (text
!= NULL
);
156 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
158 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
160 if (iface
->insert_text
)
161 (*(iface
->insert_text
)) (text
, string
, length
, position
);
165 atk_editable_text_copy_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
);
176 if (iface
->copy_text
)
177 (*(iface
->copy_text
)) (text
, start_pos
, end_pos
);
181 atk_editable_text_cut_text (AtkEditableText
*text
,
185 AtkEditableTextIface
*iface
;
187 g_return_if_fail (text
!= NULL
);
188 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
190 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
193 (*(iface
->cut_text
)) (text
, start_pos
, end_pos
);
197 atk_editable_text_delete_text (AtkEditableText
*text
,
201 AtkEditableTextIface
*iface
;
203 g_return_if_fail (text
!= NULL
);
204 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
206 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
208 if (iface
->delete_text
)
209 (*(iface
->delete_text
)) (text
, start_pos
, end_pos
);
213 atk_editable_text_paste_text (AtkEditableText
*text
,
216 AtkEditableTextIface
*iface
;
218 g_return_if_fail (text
!= NULL
);
219 g_return_if_fail (ATK_IS_EDITABLE_TEXT (text
));
221 iface
= ATK_EDITABLE_TEXT_GET_IFACE (text
);
223 if (iface
->paste_text
)
224 (*(iface
->paste_text
)) (text
, position
);