4a3149e6c21992643384d86377e59991bf276c80
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_event.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001 Sun Microsystems Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #include <cspi/spi-private.h>
24
25 /**
26  * createAccessibleEventListener:
27  * @callback : an #AccessibleEventListenerCB callback function, or NULL.
28  *
29  * Create a new #AccessibleEventListener with a specified (in-process) callback function.
30  *
31  * Returns: a pointer to a newly-created #AccessibleEventListener.
32  *
33  **/
34 AccessibleEventListener *
35 createAccessibleEventListener (AccessibleEventListenerCB callback)
36 {
37   AccessibleEventListener *listener = spi_event_listener_new ();
38   if (callback)
39     {
40       spi_event_listener_add_callback (listener, callback);
41     }
42   return listener;
43 }
44
45 /**
46  * AccessibleEventListener_addCallback:
47  * @listener: the #AccessibleEventListener instance to modify.
48  * @callback: an #AccessibleEventListenerCB function pointer.
49  *
50  * Add an in-process callback function to an existing AccessibleEventListener.
51  * Note that the callback function must live in the same address
52  * space as the AccessibleEventListener implementation code, thus one should not
53  * use this function to attach callbacks to a 'remote' event listener
54  * (that is, one that was not created by a client call to
55  * createAccessibleEventListener ();
56  *
57  * Returns: #TRUE if successful, otherwise #FALSE.
58  *
59  **/
60 boolean
61 AccessibleEventListener_addCallback (AccessibleEventListener *listener,
62                            AccessibleEventListenerCB callback)
63 {
64   spi_event_listener_add_callback (listener, callback);
65   return TRUE;
66 }
67
68 /**
69  * AccessibleEventListener_removeCallback:
70  * @listener: the #AccessibleEventListener instance to modify.
71  * @callback: an #AccessibleEventListenerCB function pointer.
72  *
73  * Remove an in-process callback function from an existing AccessibleEventListener.
74  *
75  * Returns: #TRUE if successful, otherwise #FALSE.
76  *
77  **/
78 boolean
79 AccessibleEventListener_removeCallback (AccessibleEventListener *listener,
80                                         AccessibleEventListenerCB callback)
81 {
82 /*  spi_event_listener_remove_callback (listener, callback); */
83   return TRUE;
84 }
85
86 /**
87  * createAccessibleKeystrokeListener:
88  * @callback : an #AccessibleKeystrokeListenerCB callback function, or NULL.
89  *
90  * Create a new #AccessibleKeystrokeListener with a specified callback function.
91  *
92  * Returns: a pointer to a newly-created #AccessibleKeystrokeListener.
93  *
94  **/
95 AccessibleKeystrokeListener *
96 createAccessibleKeystrokeListener (AccessibleKeystrokeListenerCB callback)
97 {
98   SpiKeystrokeListener *listener = spi_keystroke_listener_new ();
99   if (callback)
100     {
101       spi_keystroke_listener_add_callback (listener, callback);
102     }
103   return (AccessibleKeystrokeListener *)listener;
104 }
105
106 /**
107  * AccessibleKeystrokeListener_addCallback:
108  * @listener: the #AccessibleKeystrokeListener instance to modify.
109  * @callback: an #AccessibleKeystrokeListenerCB function pointer.
110  *
111  * Add an in-process callback function to an existing #AccessibleKeystrokeListener.
112  *
113  * Returns: #TRUE if successful, otherwise #FALSE.
114  *
115  **/
116 boolean
117 AccessibleKeystrokeListener_addCallback (AccessibleKeystrokeListener *listener,
118                                          AccessibleKeystrokeListenerCB callback)
119 {
120   spi_keystroke_listener_add_callback (listener, callback);
121   return TRUE;
122 }
123
124 /**
125  * AccessibleKeystrokeListener_removeCallback:
126  * @listener: the #AccessibleKeystrokeListener instance to modify.
127  * @callback: an #AccessibleKeystrokeListenerCB function pointer.
128  *
129  * Remove an in-process callback function from an existing #AccessibleKeystrokeListener.
130  *
131  * Returns: #TRUE if successful, otherwise #FALSE.
132  *
133  **/
134 boolean
135 AccessibleKeystrokeListener_removeCallback (AccessibleKeystrokeListener *listener,
136                                             AccessibleKeystrokeListenerCB callback)
137 {
138   spi_keystroke_listener_remove_callback (listener, callback);
139   return TRUE;
140 }
141