2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #include "atspi-private.h"
27 * atspi_action_get_n_actions:
28 * @obj: a pointer to the #AtspiAction to query.
30 * Get the number of actions invokable on an #AtspiAction implementor.
32 * Returns: an integer indicating the number of invocable actions.
35 atspi_action_get_n_actions (AtspiAction *obj, GError **error)
37 dbus_int32_t retval = 0;
39 g_return_val_if_fail (obj != NULL, -1);
41 _atspi_dbus_get_property (obj, atspi_interface_action, "NActions", error, "i", &retval);
47 * atspi_action_get_description: (rename-to atspi_action_get_action_description)
48 * @obj: a pointer to the #AtspiAction implementor to query.
49 * @i: an integer indicating which action to query.
51 * Get the description of '@i-th' action invocable on an
52 * object implementing #AtspiAction.
54 * Returns: a UTF-8 string describing the '@i-th' invocable action.
56 * Deprecated: 2.10: Use atspi_action_get_action_description instead.
59 atspi_action_get_description (AtspiAction *obj, int i, GError **error)
61 return atspi_action_get_action_description (obj, i, error);
65 * atspi_action_get_action_description:
66 * @obj: a pointer to the #AtspiAction implementor to query.
67 * @i: an integer indicating which action to query.
69 * Get the description of '@i-th' action invocable on an
70 * object implementing #AtspiAction.
72 * Returns: a UTF-8 string describing the '@i-th' invocable action.
75 atspi_action_get_action_description (AtspiAction *obj, int i, GError **error)
80 g_return_val_if_fail (obj != NULL, NULL);
82 _atspi_dbus_call (obj, atspi_interface_action, "GetDescription", error, "i=>s", d_i, &retval);
88 * atspi_action_get_key_binding:
89 * @obj: a pointer to the #AtspiAction implementor to query.
90 * @i: an integer indicating which action to query.
92 * Get the keybindings for the @i-th action invocable on an
93 * object implementing #AtspiAction, if any are defined.
94 * The keybindings string format is as follows:
95 * there are multiple parts to a keybinding string (typically 3).
96 * They are delimited with ";". The first is the action's
97 * keybinding which is usable if the object implementing the action
98 * is currently posted to the screen, e.g. if a menu is posted
99 * then these keybindings for the corresponding menu-items are
100 * available. The second keybinding substring is the full key sequence
101 * necessary to post the action's widget and activate it, e.g. for
102 * a menu item such as "File->Open" it would both post the menu and
103 * activate the item. Thus the second keybinding string is available
104 * during the lifetime of the containing toplevel window as a whole,
105 * whereas the first keybinding string only works while the object
106 * implementing AtkAction is posted. The third (and optional)
107 * keybinding string is the "keyboard shortcut" which invokes the
108 * action without posting any menus.
109 * Meta-keys are indicated by the conventional strings
110 * "<Control>", "<Alt>", "<Shift>", "<Mod2>",
111 * etc. (we use the same string as gtk_accelerator_name() in
114 * Returns: a UTF-8 string which can be parsed to determine the @i-th
115 * invocable action's keybindings.
118 atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error)
120 dbus_int32_t d_i = i;
123 g_return_val_if_fail (obj != NULL, NULL);
125 _atspi_dbus_call (obj, atspi_interface_action, "GetKeyBinding", error, "i=>s", d_i, &retval);
131 * atspi_action_get_name: (rename-to atspi_action_get_action_name)
132 * @obj: a pointer to the #AtspiAction implementor to query.
133 * @i: an integer indicating which action to query.
135 * Get the name of the '@i-th' action invocable on an
136 * object implementing #AtspiAction.
138 * Returns: the non-localized name of the action, as a UTF-8 string.
140 * Deprecated: 2.10: Use atspi_action_get_action_name instead.
143 atspi_action_get_name (AtspiAction *obj, gint i, GError **error)
145 return atspi_action_get_action_name (obj, i, error);
149 * atspi_action_get_action_name:
150 * @obj: a pointer to the #AtspiAction implementor to query.
151 * @i: an integer indicating which action to query.
153 * Get the name of the '@i-th' action invocable on an
154 * object implementing #AtspiAction.
156 * Returns: the non-localized name of the action, as a UTF-8 string.
159 atspi_action_get_action_name (AtspiAction *obj, gint i, GError **error)
161 dbus_int32_t d_i = i;
164 g_return_val_if_fail (obj != NULL, NULL);
166 _atspi_dbus_call (obj, atspi_interface_action, "GetName", error, "i=>s", d_i, &retval);
172 * atspi_action_get_localized_name:
173 * @obj: a pointer to the #AtspiAction implementor to query.
174 * @i: an integer indicating which action to query.
176 * Get the name of the '@i-th' action invocable on an
177 * object implementing #AtspiAction.
179 * Returns: the name of the action, as a UTF-8 string.
182 atspi_action_get_localized_name (AtspiAction *obj, gint i, GError **error)
184 dbus_int32_t d_i = i;
187 g_return_val_if_fail (obj != NULL, NULL);
189 _atspi_dbus_call (obj, atspi_interface_action, "GetLocalizedName", error,
190 "i=>s", d_i, &retval);
196 * atspi_action_do_action:
197 * @obj: a pointer to the #AtspiAction to query.
198 * @i: an integer specifying which action to invoke.
200 * Invoke the action indicated by #index.
202 * Returns: #TRUE if the action is successfully invoked, otherwise #FALSE.
205 atspi_action_do_action (AtspiAction *obj, gint i, GError **error)
207 dbus_int32_t d_i = i;
208 dbus_bool_t retval = FALSE;
210 g_return_val_if_fail (obj != NULL, FALSE);
212 _atspi_dbus_call (obj, atspi_interface_action, "DoAction", error, "i=>b", d_i, &retval);
218 atspi_action_base_init (AtspiAction *klass)
223 atspi_action_get_type (void)
225 static GType type = 0;
228 static const GTypeInfo tinfo =
230 sizeof (AtspiAction),
231 (GBaseInitFunc) atspi_action_base_init,
232 (GBaseFinalizeFunc) NULL,
235 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiAction", &tinfo, 0);