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.
57 atspi_action_get_description (AtspiAction *obj, int i, GError **error)
62 g_return_val_if_fail (obj != NULL, NULL);
64 _atspi_dbus_call (obj, atspi_interface_action, "GetDescription", error, "i=>s", d_i, &retval);
70 * atspi_action_get_key_binding:
71 * @obj: a pointer to the #AtspiAction implementor to query.
72 * @i: an integer indicating which action to query.
74 * Get the keybindings for the @i-th action invocable on an
75 * object implementing #AtspiAction, if any are defined.
76 * The keybindings string format is as follows:
77 * there are multiple parts to a keybinding string (typically 3).
78 * They are delimited with ";". The first is the action's
79 * keybinding which is usable if the object implementing the action
80 * is currently posted to the screen, e.g. if a menu is posted
81 * then these keybindings for the corresponding menu-items are
82 * available. The second keybinding substring is the full key sequence
83 * necessary to post the action's widget and activate it, e.g. for
84 * a menu item such as "File->Open" it would both post the menu and
85 * activate the item. Thus the second keybinding string is available
86 * during the lifetime of the containing toplevel window as a whole,
87 * whereas the first keybinding string only works while the object
88 * implementing AtkAction is posted. The third (and optional)
89 * keybinding string is the "keyboard shortcut" which invokes the
90 * action without posting any menus.
91 * Meta-keys are indicated by the conventional strings
92 * "<Control>", "<Alt>", "<Shift>", "<Mod2>",
93 * etc. (we use the same string as gtk_accelerator_name() in
96 * Returns: a UTF-8 string which can be parsed to determine the @i-th
97 * invocable action's keybindings.
100 atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error)
102 dbus_int32_t d_i = i;
105 g_return_val_if_fail (obj != NULL, NULL);
107 _atspi_dbus_call (obj, atspi_interface_action, "GetKeyBinding", error, "i=>s", d_i, &retval);
113 * atspi_action_get_name:
114 * @obj: a pointer to the #AtspiAction implementor to query.
115 * @i: an integer indicating which action to query.
117 * Get the name of the '@i-th' action invocable on an
118 * object implementing #AtspiAction.
120 * Returns: the non-localized name of the action, as a UTF-8 string.
123 atspi_action_get_name (AtspiAction *obj, gint i, GError **error)
125 dbus_int32_t d_i = i;
128 g_return_val_if_fail (obj != NULL, NULL);
130 _atspi_dbus_call (obj, atspi_interface_action, "GetName", error, "i=>s", d_i, &retval);
136 * atspi_action_get_localized_name:
137 * @obj: a pointer to the #AtspiAction implementor to query.
138 * @i: an integer indicating which action to query.
140 * Get the name of the '@i-th' action invocable on an
141 * object implementing #AtspiAction.
143 * Returns: the name of the action, as a UTF-8 string.
146 atspi_action_get_localized_name (AtspiAction *obj, gint i, GError **error)
148 dbus_int32_t d_i = i;
151 g_return_val_if_fail (obj != NULL, NULL);
153 _atspi_dbus_call (obj, atspi_interface_action, "GetLocalizedName", error,
154 "i=>s", d_i, &retval);
160 * atspi_action_do_action:
161 * @obj: a pointer to the #AtspiAction to query.
162 * @i: an integer specifying which action to invoke.
164 * Invoke the action indicated by #index.
166 * Returns: #TRUE if the action is successfully invoked, otherwise #FALSE.
169 atspi_action_do_action (AtspiAction *obj, gint i, GError **error)
171 dbus_int32_t d_i = i;
172 dbus_bool_t retval = FALSE;
174 g_return_val_if_fail (obj != NULL, FALSE);
176 _atspi_dbus_call (obj, atspi_interface_action, "DoAction", error, "i=>b", d_i, &retval);
182 atspi_action_base_init (AtspiAction *klass)
187 atspi_action_get_type (void)
189 static GType type = 0;
192 static const GTypeInfo tinfo =
194 sizeof (AtspiAction),
195 (GBaseInitFunc) atspi_action_base_init,
196 (GBaseFinalizeFunc) NULL,
199 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiAction", &tinfo, 0);