1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "atkaction.h"
23 atk_action_get_type (void)
25 static GType type
= 0;
30 sizeof (AtkActionIface
),
32 (GBaseFinalizeFunc
) NULL
,
36 type
= g_type_register_static (G_TYPE_INTERFACE
, "AtkAction", &tinfo
, 0);
43 * atk_action_do_action:
44 * @action: a #GObject instance that implements AtkActionIface
45 * @i: the action index corresponding to the action to be performed
47 * Perform the specified action on the object.
49 * Returns: %TRUE if success, %FALSE otherwise
53 atk_action_do_action (AtkAction
*obj
,
56 AtkActionIface
*iface
;
58 g_return_val_if_fail (ATK_IS_ACTION (obj
), FALSE
);
60 iface
= ATK_ACTION_GET_IFACE (obj
);
63 return (iface
->do_action
) (obj
, i
);
69 * atk_action_get_n_actions:
70 * @action: a #GObject instance that implements AtkActionIface
72 * Gets the number of accessible actions available on the object.
73 * If there are more than one, the first one is considered the
74 * "default" action of the object.
76 * Returns: a the number of actions, or 0 if @action does not
77 * implement this interface.
80 atk_action_get_n_actions (AtkAction
*obj
)
82 AtkActionIface
*iface
;
84 g_return_val_if_fail (ATK_IS_ACTION (obj
), 0);
86 iface
= ATK_ACTION_GET_IFACE (obj
);
88 if (iface
->get_n_actions
)
89 return (iface
->get_n_actions
) (obj
);
95 * atk_action_get_description:
96 * @action: a #GObject instance that implements AtkActionIface
97 * @i: the action index corresponding to the action to be performed
99 * Returns a description of the specified action of the object.
101 * Returns a description string, or %NULL
102 * if @action does not implement this interface.
104 G_CONST_RETURN gchar
*
105 atk_action_get_description (AtkAction
*obj
,
108 AtkActionIface
*iface
;
110 g_return_val_if_fail (ATK_IS_ACTION (obj
), NULL
);
112 iface
= ATK_ACTION_GET_IFACE (obj
);
114 if (iface
->get_description
)
115 return (iface
->get_description
) (obj
, i
);
121 * atk_action_get_name:
122 * @action: a #GObject instance that implements AtkActionIface
123 * @i: the action index corresponding to the action to be performed
125 * Returns a non-localized string naming the specified action of the
126 * object. This name is generally not descriptive of the end result
127 * of the action, but instead names the 'interaction type' which the
128 * object supports. By convention, the above strings should be used to
129 * represent the actions which correspond to the common point-and-click
130 * interaction techniques of the same name: i.e.
131 * "click", "press", "release", "drag", "drop", "popup", etc.
132 * The "popup" action should be used to pop up a context menu for the
133 * object, if one exists.
135 * For technical reasons, some toolkits cannot guarantee that the
136 * reported action is actually 'bound' to a nontrivial user event;
137 * i.e. the result of some actions via atk_action_do_action() may be
140 * Returns a name string, or %NULL
141 * if @action does not implement this interface.
143 G_CONST_RETURN gchar
*
144 atk_action_get_name (AtkAction
*obj
,
147 AtkActionIface
*iface
;
149 g_return_val_if_fail (ATK_IS_ACTION (obj
), NULL
);
151 iface
= ATK_ACTION_GET_IFACE (obj
);
154 return (iface
->get_name
) (obj
, i
);
160 * atk_action_get_localized_name:
161 * @action: a #GObject instance that implements AtkActionIface
162 * @i: the action index corresponding to the action to be performed
164 * Returns the localized name of the specified action of the object.
166 * Returns a name string, or %NULL
167 * if @action does not implement this interface.
169 G_CONST_RETURN gchar
*
170 atk_action_get_localized_name (AtkAction
*obj
,
173 AtkActionIface
*iface
;
175 g_return_val_if_fail (ATK_IS_ACTION (obj
), NULL
);
177 iface
= ATK_ACTION_GET_IFACE (obj
);
179 if (iface
->get_localized_name
)
180 return (iface
->get_localized_name
) (obj
, i
);
186 * atk_action_get_keybinding:
187 * @action: a #GObject instance that implements AtkActionIface
188 * @i: the action index corresponding to the action to be performed
190 * Returns a keybinding associated with this action, if one exists.
191 * The returned string is in the format "<a>;<b>;<c>"
192 * (i.e. semicolon-delimited), where <a> is the keybinding which
193 * activates the object if it is presently enabled onscreen,
194 * <b> corresponds to the keybinding or sequence of keys
195 * which invokes the action even if the relevant element is not
196 * currently posted on screen (for instance, for a menu item it
197 * posts the parent menus before invoking). The last token in the
198 * above string, if non-empty, represents a keyboard shortcut which
199 * invokes the same action without posting the component or its
200 * enclosing menus or dialogs.
202 * Returns a string representing the available keybindings, or %NULL
203 * if there is no keybinding for this action.
206 G_CONST_RETURN gchar
*
207 atk_action_get_keybinding (AtkAction
*obj
,
210 AtkActionIface
*iface
;
212 g_return_val_if_fail (ATK_IS_ACTION (obj
), NULL
);
214 iface
= ATK_ACTION_GET_IFACE (obj
);
216 if (iface
->get_keybinding
)
217 return (iface
->get_keybinding
) (obj
, i
);
223 * atk_action_set_description:
224 * @action: a #GObject instance that implements AtkActionIface
225 * @i: the action index corresponding to the action to be performed
226 * @desc: the description to be assigned to this action
228 * Sets a description of the specified action of the object.
230 * Returns: a gboolean representing if the description was successfully set;
233 atk_action_set_description (AtkAction
*obj
,
237 AtkActionIface
*iface
;
239 g_return_val_if_fail (ATK_IS_ACTION (obj
), FALSE
);
241 iface
= ATK_ACTION_GET_IFACE (obj
);
243 if (iface
->set_description
)
244 return (iface
->set_description
) (obj
, i
, desc
);