2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2008 Novell, Inc.
6 * Copyright 2001, 2002 Sun Microsystems Inc.,
7 * Copyright 2001, 2002 Ximian, Inc.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
26 #include <droute/droute.h>
28 #include "introspection.h"
33 impl_SetTextContents (DBusConnection * bus, DBusMessage * message,
36 AtkEditableText *editable = (AtkEditableText *) user_data;
37 const char *newContents;
41 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
42 droute_not_yet_handled_error (message));
43 if (!dbus_message_get_args
44 (message, NULL, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
46 return droute_invalid_arguments_error (message);
48 atk_editable_text_set_text_contents (editable, newContents);
50 // TODO decide if we really need this return value
51 reply = dbus_message_new_method_return (message);
54 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
61 impl_InsertText (DBusConnection * bus, DBusMessage * message, void *user_data)
63 AtkEditableText *editable = (AtkEditableText *) user_data;
64 dbus_int32_t position, length;
70 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
71 droute_not_yet_handled_error (message));
72 if (!dbus_message_get_args
73 (message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text,
74 DBUS_TYPE_INT32, &length, DBUS_TYPE_INVALID))
76 return droute_invalid_arguments_error (message);
79 atk_editable_text_insert_text (editable, text, length, &ip);
81 // TODO decide if we really need this return value
82 reply = dbus_message_new_method_return (message);
85 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
92 impl_CopyText (DBusConnection * bus, DBusMessage * message, void *user_data)
94 AtkEditableText *editable = (AtkEditableText *) user_data;
95 dbus_int32_t startPos, endPos;
97 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
98 droute_not_yet_handled_error (message));
99 if (!dbus_message_get_args
100 (message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
103 return droute_invalid_arguments_error (message);
105 atk_editable_text_copy_text (editable, startPos, endPos);
106 return dbus_message_new_method_return (message);
110 impl_CutText (DBusConnection * bus, DBusMessage * message, void *user_data)
112 AtkEditableText *editable = (AtkEditableText *) user_data;
113 dbus_int32_t startPos, endPos;
117 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
118 droute_not_yet_handled_error (message));
119 if (!dbus_message_get_args
120 (message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
123 return droute_invalid_arguments_error (message);
125 atk_editable_text_cut_text (editable, startPos, endPos);
127 // TODO decide if we really need this return value
128 reply = dbus_message_new_method_return (message);
131 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
138 impl_DeleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
140 AtkEditableText *editable = (AtkEditableText *) user_data;
141 dbus_int32_t startPos, endPos;
145 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
146 droute_not_yet_handled_error (message));
147 if (!dbus_message_get_args
148 (message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
151 return droute_invalid_arguments_error (message);
153 atk_editable_text_delete_text (editable, startPos, endPos);
155 // TODO decide if we really need this return value
156 reply = dbus_message_new_method_return (message);
159 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
166 impl_PasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
168 AtkEditableText *editable = (AtkEditableText *) user_data;
169 dbus_int32_t position;
173 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
174 droute_not_yet_handled_error (message));
175 if (!dbus_message_get_args
176 (message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
178 return droute_invalid_arguments_error (message);
180 atk_editable_text_paste_text (editable, position);
182 // TODO decide if we really need this return value
183 reply = dbus_message_new_method_return (message);
186 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
192 static DRouteMethod methods[] = {
193 {impl_SetTextContents, "SetTextContents"},
194 {impl_InsertText, "InsertText"},
195 {impl_CopyText, "CopyText"},
196 {impl_CutText, "CutText"},
197 {impl_DeleteText, "DeleteText"},
198 {impl_PasteText, "PasteText"},
203 spi_initialize_editabletext (DRoutePath * path)
205 spi_atk_add_interface (path,
206 ATSPI_DBUS_INTERFACE_EDITABLE_TEXT, spi_org_a11y_atspi_EditableText, methods, NULL);