summaryrefslogtreecommitdiff
path: root/atspi/atspi-event-listener.h
blob: b294525e4c9d1cad8f6f2fc08a87d58f46b73b83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
 * AT-SPI - Assistive Technology Service Provider Interface
 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
 *
 * Copyright 2002 Ximian, Inc.
 *           2002 Sun Microsystems Inc.
 * Copyright 2010, 2011 Novell, Inc.
 *
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef _ATSPI_EVENT_LISTENER_H_
#define _ATSPI_EVENT_LISTENER_H_

#include "glib-object.h"

#include "atspi-types.h"

G_BEGIN_DECLS

GType atspi_event_get_type (void);

/**
 * AtspiEventListenerCB:
 * @event: (transfer full): The event for which notification is sent.
 * @user_data: User data which is passed to the callback each time a notification takes place.
 *
 * A function prototype for callbacks via which clients are notified of AT-SPI events.
 *
 **/
typedef void (*AtspiEventListenerCB) (AtspiEvent *event,
                                      void *user_data);

/**
 * AtspiEventListenerSimpleCB:
 * @event: (transfer full): The event for which notification is sent.
 *
 * Like #AtspiEventlistenerCB, but with no user_data.
 *
 **/
typedef void (*AtspiEventListenerSimpleCB) (const AtspiEvent *event);

#define ATSPI_TYPE_EVENT_LISTENER (atspi_event_listener_get_type ())
#define ATSPI_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListener))
#define ATSPI_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass))
#define ATSPI_IS_EVENT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_EVENT_LISTENER))
#define ATSPI_IS_EVENT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATSPI_TYPE_EVENT_LISTENER))
#define ATSPI_EVENT_LISTENER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATSPI_TYPE_EVENT_LISTENER, AtspiEventListenerClass))

typedef struct _AtspiEventListener AtspiEventListener;
struct _AtspiEventListener
{
  GObject parent;
  AtspiEventListenerCB callback;
  void *user_data;
  GDestroyNotify cb_destroyed;
};

typedef struct _AtspiEventListenerClass AtspiEventListenerClass;
struct _AtspiEventListenerClass
{
  GObjectClass parent_class;
};

GType atspi_event_listener_get_type (void);

AtspiEventListener *
atspi_event_listener_new (AtspiEventListenerCB callback,
                          gpointer user_data,
                          GDestroyNotify callback_destroyed);

AtspiEventListener *
atspi_event_listener_new_simple (AtspiEventListenerSimpleCB callback,
                                 GDestroyNotify callback_destroyed);

gboolean
atspi_event_listener_register (AtspiEventListener *listener,
                               const gchar *event_type,
                               GError **error);

gboolean
atspi_event_listener_register_full (AtspiEventListener *listener,
                                    const gchar *event_type,
                                    GArray *properties,
                                    GError **error);

gboolean
atspi_event_listener_register_with_app (AtspiEventListener *listener,
                                        const gchar *event_type,
                                        GArray *properties,
                                        AtspiAccessible *app,
                                        GError **error);

gboolean
atspi_event_listener_register_from_callback (AtspiEventListenerCB callback,
                                             void *user_data,
                                             GDestroyNotify callback_destroyed,
                                             const gchar *event_type,
                                             GError **error);

gboolean
atspi_event_listener_register_from_callback_full (AtspiEventListenerCB callback,
                                                  void *user_data,
                                                  GDestroyNotify callback_destroyed,
                                                  const gchar *event_type,
                                                  GArray *properties,
                                                  GError **error);

gboolean
atspi_event_listener_register_from_callback_with_app (AtspiEventListenerCB callback,
                                                      void *user_data,
                                                      GDestroyNotify callback_destroyed,
                                                      const gchar *event_type,
                                                      GArray *properties,
                                                      AtspiAccessible *app,
                                                      GError **error);

gboolean
atspi_event_listener_register_no_data (AtspiEventListenerSimpleCB callback,
                                       GDestroyNotify callback_destroyed,
                                       const gchar *event_type,
                                       GError **error);

gboolean
atspi_event_listener_deregister (AtspiEventListener *listener,
                                 const gchar *event_type,
                                 GError **error);

gboolean
atspi_event_listener_deregister_from_callback (AtspiEventListenerCB callback,
                                               void *user_data,
                                               const gchar *event_type,
                                               GError **error);

gboolean
atspi_event_listener_deregister_no_data (AtspiEventListenerSimpleCB callback,
                                         const gchar *event_type,
                                         GError **error);

G_END_DECLS

#endif /* _ATSPI_EVENT_LISTENER_H_ */