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:
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.
57 * Rename to: atspi_action_get_action_description
60 atspi_action_get_description (AtspiAction *obj, int i, GError **error)
62 return atspi_action_get_action_description (obj, i, error);
66 * atspi_action_get_action_description:
67 * @obj: a pointer to the #AtspiAction implementor to query.
68 * @i: an integer indicating which action to query.
70 * Get the description of '@i-th' action invocable on an
71 * object implementing #AtspiAction.
73 * Returns: a UTF-8 string describing the '@i-th' invocable action.
76 atspi_action_get_action_description (AtspiAction *obj, int i, GError **error)
81 g_return_val_if_fail (obj != NULL, NULL);
83 _atspi_dbus_call (obj, atspi_interface_action, "GetDescription", error, "i=>s", d_i, &retval);
89 * atspi_action_get_key_binding:
90 * @obj: a pointer to the #AtspiAction implementor to query.
91 * @i: an integer indicating which action to query.
93 * Get the keybindings for the @i-th action invocable on an
94 * object implementing #AtspiAction, if any are defined.
95 * The keybindings string format is as follows:
96 * there are multiple parts to a keybinding string (typically 3).
97 * They are delimited with ";". The first is the action's
98 * keybinding which is usable if the object implementing the action
99 * is currently posted to the screen, e.g. if a menu is posted
100 * then these keybindings for the corresponding menu-items are
101 * available. The second keybinding substring is the full key sequence
102 * necessary to post the action's widget and activate it, e.g. for
103 * a menu item such as "File->Open" it would both post the menu and
104 * activate the item. Thus the second keybinding string is available
105 * during the lifetime of the containing toplevel window as a whole,
106 * whereas the first keybinding string only works while the object
107 * implementing AtkAction is posted. The third (and optional)
108 * keybinding string is the "keyboard shortcut" which invokes the
109 * action without posting any menus.
110 * Meta-keys are indicated by the conventional strings
111 * "<Control>", "<Alt>", "<Shift>", "<Mod2>",
112 * etc. (we use the same string as gtk_accelerator_name() in
115 * Returns: a UTF-8 string which can be parsed to determine the @i-th
116 * invocable action's keybindings.
119 atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error)
121 dbus_int32_t d_i = i;
124 g_return_val_if_fail (obj != NULL, NULL);
126 _atspi_dbus_call (obj, atspi_interface_action, "GetKeyBinding", error, "i=>s", d_i, &retval);
132 * atspi_action_get_name:
133 * @obj: a pointer to the #AtspiAction implementor to query.
134 * @i: an integer indicating which action to query.
136 * Get the name of the '@i-th' action invocable on an
137 * object implementing #AtspiAction.
139 * Returns: the non-localized name of the action, as a UTF-8 string.
141 * Deprecated: 2.10: Use atspi_action_get_action_name instead.
142 * Rename to: atspi_action_get_action_name
145 atspi_action_get_name (AtspiAction *obj, gint i, GError **error)
147 return atspi_action_get_action_name (obj, i, error);
151 * atspi_action_get_action_name:
152 * @obj: a pointer to the #AtspiAction implementor to query.
153 * @i: an integer indicating which action to query.
155 * Get the name of the '@i-th' action invocable on an
156 * object implementing #AtspiAction.
158 * Returns: the non-localized name of the action, as a UTF-8 string.
161 atspi_action_get_action_name (AtspiAction *obj, gint i, GError **error)
163 dbus_int32_t d_i = i;
166 g_return_val_if_fail (obj != NULL, NULL);
168 _atspi_dbus_call (obj, atspi_interface_action, "GetName", error, "i=>s", d_i, &retval);
174 * atspi_action_get_localized_name:
175 * @obj: a pointer to the #AtspiAction implementor to query.
176 * @i: an integer indicating which action to query.
178 * Get the name of the '@i-th' action invocable on an
179 * object implementing #AtspiAction.
181 * Returns: the name of the action, as a UTF-8 string.
184 atspi_action_get_localized_name (AtspiAction *obj, gint i, GError **error)
186 dbus_int32_t d_i = i;
189 g_return_val_if_fail (obj != NULL, NULL);
191 _atspi_dbus_call (obj, atspi_interface_action, "GetLocalizedName", error,
192 "i=>s", d_i, &retval);
198 * atspi_action_do_action:
199 * @obj: a pointer to the #AtspiAction to query.
200 * @i: an integer specifying which action to invoke.
202 * Invoke the action indicated by #index.
204 * Returns: #TRUE if the action is successfully invoked, otherwise #FALSE.
207 atspi_action_do_action (AtspiAction *obj, gint i, GError **error)
209 dbus_int32_t d_i = i;
210 dbus_bool_t retval = FALSE;
212 g_return_val_if_fail (obj != NULL, FALSE);
214 _atspi_dbus_call (obj, atspi_interface_action, "DoAction", error, "i=>b", d_i, &retval);
220 atspi_action_base_init (AtspiAction *klass)
225 atspi_action_get_type (void)
227 static GType type = 0;
230 static const GTypeInfo tinfo =
232 sizeof (AtspiAction),
233 (GBaseInitFunc) atspi_action_base_init,
234 (GBaseFinalizeFunc) NULL,
237 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiAction", &tinfo, 0);