Protect against NULL pointer dereference
[platform/upstream/atk.git] / atk / atkaction.h
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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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 #ifndef __ATK_ACTION_H__
21 #define __ATK_ACTION_H__
22
23 #if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
24 #error "Only <atk/atk.h> can be included directly."
25 #endif
26
27 #include <atk/atkobject.h>
28
29 G_BEGIN_DECLS
30
31 /*
32  */
33
34
35 #define ATK_TYPE_ACTION                    (atk_action_get_type ())
36 #define ATK_IS_ACTION(obj)                 G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_ACTION)
37 #define ATK_ACTION(obj)                    G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_ACTION, AtkAction)
38 #define ATK_ACTION_GET_IFACE(obj)          (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_ACTION, AtkActionIface))
39
40 #ifndef _TYPEDEF_ATK_ACTION_
41 #define _TYPEDEF_ATK_ACTION_
42 typedef struct _AtkAction AtkAction;
43 #endif
44 typedef struct _AtkActionIface AtkActionIface;
45
46 /**
47  * AtkActionIface:
48  * @do_action:
49  * @get_n_actions:
50  * @get_description:
51  * @get_name:
52  * @get_keybinding:
53  * @set_description:
54  * @get_localized_name:
55  *
56  * The #AtkAction interface should be supported by any object that can
57  * perform one or more actions. The interface provides the standard
58  * mechanism for an assistive technology to determine what those actions
59  * are as well as tell the object to perform them. Any object that can
60  * be manipulated should support this interface.
61  */
62 struct _AtkActionIface
63 {
64   /*< private >*/
65   GTypeInterface parent;
66
67   /*< public >*/
68   gboolean                (*do_action)         (AtkAction         *action,
69                                                 gint              i);
70   gint                    (*get_n_actions)     (AtkAction         *action);
71   const gchar*            (*get_description)   (AtkAction         *action,
72                                                 gint              i);
73   const gchar*            (*get_name)          (AtkAction         *action,
74                                                 gint              i);
75   const gchar*            (*get_keybinding)    (AtkAction         *action,
76                                                 gint              i);
77   gboolean                (*set_description)   (AtkAction         *action,
78                                                 gint              i,
79                                                 const gchar       *desc);
80   const gchar*            (*get_localized_name)(AtkAction         *action,
81                                                 gint              i);
82 };
83
84 ATK_AVAILABLE_IN_ALL
85 GType atk_action_get_type (void);
86
87 /*
88  * These are the function which would be called by an application with
89  * the argument being a AtkObject object cast to (AtkAction).
90  *
91  * The function will just check that * the corresponding
92  * function pointer is not NULL and will call it.
93  *
94  * The "real" implementation of the function for accessible will be
95  * provided in a support library
96  */
97
98 ATK_AVAILABLE_IN_ALL
99 gboolean   atk_action_do_action                (AtkAction         *action,
100                                             gint              i);
101 ATK_AVAILABLE_IN_ALL
102 gint   atk_action_get_n_actions            (AtkAction *action);
103 ATK_AVAILABLE_IN_ALL
104 const gchar*          atk_action_get_description  (AtkAction         *action,
105                                                    gint              i);
106 ATK_AVAILABLE_IN_ALL
107 const gchar*          atk_action_get_name         (AtkAction         *action,
108                                                    gint              i);
109 ATK_AVAILABLE_IN_ALL
110 const gchar*          atk_action_get_keybinding   (AtkAction         *action,
111                                                    gint              i);
112 ATK_AVAILABLE_IN_ALL
113 gboolean              atk_action_set_description  (AtkAction         *action,
114                                                    gint              i,
115                                                    const gchar       *desc);
116
117 /* NEW in ATK 1.1: */
118 ATK_AVAILABLE_IN_ALL
119 const gchar* atk_action_get_localized_name (AtkAction       *action,
120                                                      gint            i);
121
122 /*
123  * Additional GObject properties exported by AtkAction:
124  *    "accessible_action"
125  *       (an accessible action, or the list of actions, has changed)
126  */
127
128 G_END_DECLS
129
130 #endif /* __ATK_ACTION_H__ */