Changes to introspection generation to remove DOCTYPE and XML
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_action.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
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.
12  *
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.
17  *
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.
22  */
23
24 #include <cspi/spi-private.h>
25
26 /**
27  * AccessibleAction_ref:
28  * @obj: a pointer to the #AccessibleAction on which to operate.
29  *
30  * Increment the reference count for an #AccessibleAction.
31  **/
32 void
33 AccessibleAction_ref (AccessibleAction *obj)
34 {
35   cspi_object_ref (obj);
36 }
37
38 /**
39  * AccessibleAction_unref:
40  * @obj: a pointer to the #AccessibleAction on which to operate.
41  *
42  * Decrement the reference count for an #AccessibleAction.
43  **/
44 void
45 AccessibleAction_unref (AccessibleAction *obj)
46 {
47   cspi_object_unref (obj);
48 }
49
50 /**
51  * AccessibleAction_getNActions:
52  * @obj: a pointer to the #AccessibleAction to query.
53  *
54  * Get the number of actions invokable on an #AccessibleAction implementor.
55  *
56  * Returns: a #long integer indicatin the number of invokable actions.
57  **/
58 long
59 AccessibleAction_getNActions (AccessibleAction *obj)
60 {
61   long retval;
62
63   cspi_return_val_if_fail (obj != NULL, -1);
64
65   retval =
66     Accessibility_Action__get_nActions (CSPI_OBJREF (obj), cspi_ev ());
67
68   cspi_return_val_if_ev ("getNActions", -1);
69
70   return retval;
71 }
72
73 /**
74  * AccessibleAction_getDescription:
75  * @obj: a pointer to the #AccessibleAction implementor to query.
76  * @i: a long integer indicating which action to query.
77  *
78  * Get the description of '@i-th' action invokable on an
79  *      object implementing #AccessibleAction.
80  *
81  * Returns: a UTF-8 string describing the '@i-th' invokable action.
82  **/
83 char *
84 AccessibleAction_getDescription (AccessibleAction *obj,
85                                  long int          i)
86 {
87   char *retval;
88   cspi_return_val_if_fail (obj != NULL, NULL);
89
90   retval =
91     Accessibility_Action_getDescription (CSPI_OBJREF (obj),
92                                          i,
93                                          cspi_ev ());
94
95   cspi_return_val_if_ev ("getDescription", NULL);
96
97   return retval;
98 }
99
100 /**
101  * AccessibleAction_getKeyBinding:
102  * @obj: a pointer to the #AccessibleAction implementor to query.
103  * @i: a long integer indicating which action to query.
104  *
105  * Get the keybindings for the @i-th action invokable on an
106  *      object implementing #AccessibleAction, if any are defined.
107  *      The keybindings string format is as follows:
108  *        there are multiple parts to a keybinding string (typically 3).
109  *        They are delimited with ";".  The first is the action's
110  *        keybinding which is usable if the object implementing the action
111  *        is currently posted to the screen, e.g. if a menu is posted 
112  *        then these keybindings for the corresponding menu-items are
113  *        available.  The second keybinding substring is the full key sequence
114  *        necessary to post the action's widget and activate it, e.g. for
115  *        a menu item such as "File->Open" it would both post the menu and
116  *        activate the item.  Thus the second keybinding string is available
117  *        during the lifetime of the containing toplevel window as a whole,
118  *        whereas the first keybinding string only works while the object
119  *        implementing AtkAction is posted.  The third (and optional)
120  *        keybinding string is the "keyboard shortcut" which invokes the 
121  *        action without posting any menus. 
122  *        Meta-keys are indicated by the conventional strings
123  *        "<Control>", "<Alt>", "<Shift>", "<Mod2>",
124  *        etc. (we use the same string as gtk_accelerator_name() in 
125  *        gtk+-2.X.
126  *
127  * Returns: a UTF-8 string which can be parsed to determine the @i-th
128  *       invokable action's keybindings.
129  **/
130 char *
131 AccessibleAction_getKeyBinding (AccessibleAction *obj,
132                                 long int          i)
133 {
134   char *retval;
135
136   cspi_return_val_if_fail (obj != NULL, NULL);
137
138   retval =
139     Accessibility_Action_getKeyBinding (CSPI_OBJREF (obj),
140        i,
141        cspi_ev ());
142
143   cspi_return_val_if_ev ("getKeyBinding", NULL);
144
145   return retval;
146 }
147
148 /**
149  * AccessibleAction_getName:
150  * @obj: a pointer to the #AccessibleAction implementor to query.
151  * @i: a long integer indicating which action to query.
152  *
153  * Get the name of the '@i-th' action invokable on an
154  *      object implementing #AccessibleAction.
155  *
156  * Returns: the 'event type' name of the action, as a UTF-8 string.
157  **/
158 char *
159 AccessibleAction_getName (AccessibleAction *obj,
160                           long int          i)
161 {
162   char *retval;
163
164   cspi_return_val_if_fail (obj != NULL, NULL);
165
166   retval =
167    Accessibility_Action_getName (CSPI_OBJREF (obj),
168                                  i,
169                                  cspi_ev ());
170
171   cspi_return_val_if_ev ("getName", NULL);
172
173   return retval;
174 }
175
176 /**
177  * AccessibleAction_doAction:
178  * @obj: a pointer to the #AccessibleAction to query.
179  * @i: an integer specifying which action to invoke.
180  *
181  * Invoke the action indicated by #index.
182  *
183  * Returns: #TRUE if the action is successfully invoked, otherwise #FALSE.
184  **/
185 SPIBoolean
186 AccessibleAction_doAction (AccessibleAction *obj,
187                            long int i)
188 {
189   SPIBoolean retval;
190
191   cspi_return_val_if_fail (obj != NULL, FALSE);
192
193   retval = Accessibility_Action_doAction (CSPI_OBJREF (obj),
194                                    i,
195                                    cspi_ev ());
196
197   cspi_return_val_if_ev ("doAction", FALSE);
198
199   return retval;
200 }