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>
27 #include "introspection.h"
32 impl_SetTextContents (DBusConnection * bus, DBusMessage * message,
35 AtkEditableText *editable = (AtkEditableText *) user_data;
36 const char *newContents;
41 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
42 droute_not_yet_handled_error (message));
43 dbus_error_init (&error);
44 if (!dbus_message_get_args
45 (message, &error, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
47 return droute_invalid_arguments_error (message);
49 atk_editable_text_set_text_contents (editable, newContents);
51 // TODO decide if we really need this return value
52 reply = dbus_message_new_method_return (message);
55 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
62 impl_InsertText (DBusConnection * bus, DBusMessage * message, void *user_data)
64 AtkEditableText *editable = (AtkEditableText *) user_data;
65 dbus_int32_t position, length;
72 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
73 droute_not_yet_handled_error (message));
74 dbus_error_init (&error);
75 if (!dbus_message_get_args
76 (message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text,
77 DBUS_TYPE_INT32, &length, DBUS_TYPE_INVALID))
79 return droute_invalid_arguments_error (message);
82 atk_editable_text_insert_text (editable, text, length, &ip);
84 // TODO decide if we really need this return value
85 reply = dbus_message_new_method_return (message);
88 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
95 impl_CopyText (DBusConnection * bus, DBusMessage * message, void *user_data)
97 AtkEditableText *editable = (AtkEditableText *) user_data;
98 dbus_int32_t startPos, endPos;
101 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
102 droute_not_yet_handled_error (message));
103 dbus_error_init (&error);
104 if (!dbus_message_get_args
105 (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
108 return droute_invalid_arguments_error (message);
110 atk_editable_text_copy_text (editable, startPos, endPos);
111 return dbus_message_new_method_return (message);
115 impl_CutText (DBusConnection * bus, DBusMessage * message, void *user_data)
117 AtkEditableText *editable = (AtkEditableText *) user_data;
118 dbus_int32_t startPos, endPos;
123 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
124 droute_not_yet_handled_error (message));
125 dbus_error_init (&error);
126 if (!dbus_message_get_args
127 (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
130 return droute_invalid_arguments_error (message);
132 atk_editable_text_cut_text (editable, startPos, endPos);
134 // TODO decide if we really need this return value
135 reply = dbus_message_new_method_return (message);
138 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
145 impl_DeleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
147 AtkEditableText *editable = (AtkEditableText *) user_data;
148 dbus_int32_t startPos, endPos;
153 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
154 droute_not_yet_handled_error (message));
155 dbus_error_init (&error);
156 if (!dbus_message_get_args
157 (message, &error, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
160 return droute_invalid_arguments_error (message);
162 atk_editable_text_delete_text (editable, startPos, endPos);
164 // TODO decide if we really need this return value
165 reply = dbus_message_new_method_return (message);
168 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
175 impl_PasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
177 AtkEditableText *editable = (AtkEditableText *) user_data;
178 dbus_int32_t position;
183 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
184 droute_not_yet_handled_error (message));
185 dbus_error_init (&error);
186 if (!dbus_message_get_args
187 (message, &error, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
189 return droute_invalid_arguments_error (message);
191 atk_editable_text_paste_text (editable, position);
193 // TODO decide if we really need this return value
194 reply = dbus_message_new_method_return (message);
197 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
203 static DRouteMethod methods[] = {
204 {impl_SetTextContents, "SetTextContents"},
205 {impl_InsertText, "InsertText"},
206 {impl_CopyText, "CopyText"},
207 {impl_CutText, "CutText"},
208 {impl_DeleteText, "DeleteText"},
209 {impl_PasteText, "PasteText"},
214 spi_initialize_editabletext (DRoutePath * path)
216 droute_path_add_interface (path,
217 ATSPI_DBUS_INTERFACE_EDITABLE_TEXT, spi_org_a11y_atspi_EditableText, methods, NULL);