Added better gtk-doc comments.
[platform/upstream/atk.git] / atk / atkaction.c
1 /* ATK -  Accessibility Toolkit
2  * Copyright 2001 Sun Microsystems Inc.
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include "atkaction.h"
21
22 GType
23 atk_action_get_type ()
24 {
25   static GType type = 0;
26
27   if (!type) {
28     GTypeInfo tinfo =
29     {
30       sizeof (AtkActionIface),
31       NULL,
32       NULL,
33
34     };
35
36     type = g_type_register_static (G_TYPE_INTERFACE, "AtkAction", &tinfo, 0);
37   }
38
39   return type;
40 }
41
42 /**
43  * atk_action_do_action:
44  * @action: a GObject instance that implements AtkActionIface
45  * @i: a %gint indicating the action to be performed 
46  *
47  * This function would be called by an application with
48  * the argument being a AtkObject object cast to (AtkAction).
49  * The function will just check that * the corresponding
50  * function pointer is not NULL and will call it.
51  * The "real" implementation of the function for accessible will be
52  * provided in a support library
53  *
54  **/
55 void
56 atk_action_do_action (AtkAction *obj,
57                       gint      i)
58 {
59   AtkActionIface *iface;
60
61   g_return_if_fail (obj != NULL);
62   g_return_if_fail (ATK_IS_ACTION (obj));
63
64   iface = ATK_ACTION_GET_IFACE (obj);
65
66   if (iface->do_action)
67     (iface->do_action) (obj, i);
68 }
69
70 /**
71  * atk_action_get_n_actions:
72  * @action: a GObject instance that implements AtkActionIface
73  *
74  * 
75  * This function would be called by an application with
76  * the argument being a AtkObject object cast to (AtkAction).
77  * The function will just check that * the corresponding
78  * function pointer is not NULL and will call it.
79  * The "real" implementation of the function for accessible will be
80  * provided in a support library
81  *
82  * Returns a %gint representing the number of actions , or 0
83  * if value does not implement this interface.
84  **/
85 gint
86 atk_action_get_n_actions  (AtkAction *obj)
87 {
88   AtkActionIface *iface;
89
90   g_return_val_if_fail (obj != NULL, 0);
91   g_return_val_if_fail (ATK_IS_ACTION (obj), 0);
92
93   iface = ATK_ACTION_GET_IFACE (obj);
94
95   if (iface->get_n_actions)
96     return (iface->get_n_actions) (obj);
97   else
98     return 0;
99 }
100
101 /**
102  * atk_action_get_description:
103  * @action: a GObject instance that implements AtkActionIface
104  * @i: a %gint indicating the action
105  *
106  * 
107  * This function would be called by an application with
108  * the argument being a AtkObject object cast to (AtkAction).
109  * The function will just check that * the corresponding
110  * function pointer is not NULL and will call it.
111  * The "real" implementation of the function for accessible will be
112  * provided in a support library
113  *
114  * Returns a #gchar representing the description, or %NULL
115  * if value does not implement this interface.
116  **/
117 G_CONST_RETURN gchar*
118 atk_action_get_description (AtkAction *obj,
119                             gint      i)
120 {
121   AtkActionIface *iface;
122
123   g_return_val_if_fail (obj != NULL, NULL);
124   g_return_val_if_fail (ATK_IS_ACTION (obj), NULL);
125
126   iface = ATK_ACTION_GET_IFACE (obj);
127
128   if (iface->get_description)
129     return (iface->get_description) (obj, i);
130   else
131     return NULL;
132 }
133
134 /**
135  * atk_action_get_keybinding:
136  * @action: a GObject instance that implements AtkActionIface
137  * @i: a %gint indicating the action
138  *
139  * 
140  * This function would be called by an application with
141  * the argument being a AtkObject object cast to (AtkAction).
142  * The function will just check that * the corresponding
143  * function pointer is not NULL and will call it.
144  * The "real" implementation of the function for accessible will be
145  * provided in a support library
146  *
147  * Returns a #gchar representing the keybinding, or %NULL
148  * if there is no keybinding for this action.
149  *
150  **/
151 G_CONST_RETURN gchar*
152 atk_action_get_keybinding (AtkAction *obj,
153                            gint      i)
154 {
155   AtkActionIface *iface;
156
157   g_return_val_if_fail (obj != NULL, NULL);
158   g_return_val_if_fail (ATK_IS_ACTION (obj), NULL);
159
160   iface = ATK_ACTION_GET_IFACE (obj);
161
162   if (iface->get_keybinding)
163     return (iface->get_keybinding) (obj, i);
164   else
165     return NULL;
166 }