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;
40 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
41 droute_not_yet_handled_error (message));
42 if (!dbus_message_get_args
43 (message, NULL, DBUS_TYPE_STRING, &newContents, DBUS_TYPE_INVALID))
45 return droute_invalid_arguments_error (message);
47 atk_editable_text_set_text_contents (editable, newContents);
49 // TODO decide if we really need this return value
50 reply = dbus_message_new_method_return (message);
53 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
60 impl_InsertText (DBusConnection * bus, DBusMessage * message, void *user_data)
62 AtkEditableText *editable = (AtkEditableText *) user_data;
63 dbus_int32_t position, length;
69 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
70 droute_not_yet_handled_error (message));
71 if (!dbus_message_get_args
72 (message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_STRING, &text,
73 DBUS_TYPE_INT32, &length, DBUS_TYPE_INVALID))
75 return droute_invalid_arguments_error (message);
78 atk_editable_text_insert_text (editable, text, length, &ip);
80 // TODO decide if we really need this return value
81 reply = dbus_message_new_method_return (message);
84 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
91 impl_CopyText (DBusConnection * bus, DBusMessage * message, void *user_data)
93 AtkEditableText *editable = (AtkEditableText *) user_data;
94 dbus_int32_t startPos, endPos;
96 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
97 droute_not_yet_handled_error (message));
98 if (!dbus_message_get_args
99 (message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
102 return droute_invalid_arguments_error (message);
104 atk_editable_text_copy_text (editable, startPos, endPos);
105 return dbus_message_new_method_return (message);
109 impl_CutText (DBusConnection * bus, DBusMessage * message, void *user_data)
111 AtkEditableText *editable = (AtkEditableText *) user_data;
112 dbus_int32_t startPos, endPos;
116 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
117 droute_not_yet_handled_error (message));
118 if (!dbus_message_get_args
119 (message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
122 return droute_invalid_arguments_error (message);
124 atk_editable_text_cut_text (editable, startPos, endPos);
126 // TODO decide if we really need this return value
127 reply = dbus_message_new_method_return (message);
130 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
137 impl_DeleteText (DBusConnection * bus, DBusMessage * message, void *user_data)
139 AtkEditableText *editable = (AtkEditableText *) user_data;
140 dbus_int32_t startPos, endPos;
144 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
145 droute_not_yet_handled_error (message));
146 if (!dbus_message_get_args
147 (message, NULL, DBUS_TYPE_INT32, &startPos, DBUS_TYPE_INT32, &endPos,
150 return droute_invalid_arguments_error (message);
152 atk_editable_text_delete_text (editable, startPos, endPos);
154 // TODO decide if we really need this return value
155 reply = dbus_message_new_method_return (message);
158 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
165 impl_PasteText (DBusConnection * bus, DBusMessage * message, void *user_data)
167 AtkEditableText *editable = (AtkEditableText *) user_data;
168 dbus_int32_t position;
172 g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (user_data),
173 droute_not_yet_handled_error (message));
174 if (!dbus_message_get_args
175 (message, NULL, DBUS_TYPE_INT32, &position, DBUS_TYPE_INVALID))
177 return droute_invalid_arguments_error (message);
179 atk_editable_text_paste_text (editable, position);
181 // TODO decide if we really need this return value
182 reply = dbus_message_new_method_return (message);
185 dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv,
191 static DRouteMethod methods[] = {
192 {impl_SetTextContents, "SetTextContents"},
193 {impl_InsertText, "InsertText"},
194 {impl_CopyText, "CopyText"},
195 {impl_CutText, "CutText"},
196 {impl_DeleteText, "DeleteText"},
197 {impl_PasteText, "PasteText"},
202 spi_initialize_editabletext (DRoutePath * path)
204 droute_path_add_interface (path,
205 ATSPI_DBUS_INTERFACE_EDITABLE_TEXT, spi_org_a11y_atspi_EditableText, methods, NULL);