Fix for 95827, adds API for registering "AccessibleDeviceListeners"
[platform/core/uifw/at-spi2-atk.git] / idl / Accessibility_Registry.idl
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 <Bonobo_Unknown.idl>
24 #include <Accessibility_Event.idl>
25 #include <Accessibility_Application.idl>
26 #include <Accessibility_Desktop.idl>
27
28 #ifndef _ACCESSIBILITY_REGISTRY_IDL_
29 #define _ACCESSIBILITY_REGISTRY_IDL_
30
31 module Accessibility {
32
33   typedef sequence<Desktop> DesktopSeq;
34
35   interface DeviceEventController;
36
37   interface Registry : EventListener {
38
39         /**
40          * registerApplication:
41          * @application: a reference to the requesting @Application
42          *
43          * Register a new application with the accessibility broker.
44          *
45          **/
46         oneway void registerApplication (in Application application);
47
48         /**
49          * deregisterApplication:
50          * @application: a reference to the @Application 
51          * to be deregistered.
52          *
53          * De-register an application previously registered with the broker.
54          *
55          **/
56         void deregisterApplication (in Application application);
57
58         /**
59          * registerGlobalEventListener:
60          * @listener: a reference to the requesting @EventListener.
61          * @eventName: a string which indicates the type of events about 
62          * which the client desires notification.
63          *
64          * Register a client's interest in (all) application events of 
65          * a certain type.
66          *
67          **/
68         void registerGlobalEventListener (in EventListener listener,
69                                           in string eventName);
70
71         /**
72          * deregisterGlobalEventListener:
73          * @listener: the requesting @EventListener
74          * @eventName: a string indicating the type of events
75          *
76          * Request that a previously registered client stop receiving
77          * global notifications for events of a certain type.
78          *
79          **/
80
81         void deregisterGlobalEventListenerAll (in EventListener listener);
82         /**
83          * deregisterGlobalEventListener:
84          * @listener: the requesting @EventListener
85          * @eventName: a string indicating the type of events
86          *
87          * Request that a previously registered client stop receiving
88          * global notifications for events of a certain type.
89          *
90          **/
91
92         void deregisterGlobalEventListener (in EventListener listener, 
93                                             in string event_name);
94         /** 
95          * event types: "Window" "Desktop"
96          *              "Window:Create" "Window:Destroy"
97          *              "Window:Iconify" "Window:Restore"
98          *              "Window:Fullscreen" "Window:Resize"
99          *              "Desktop:Create" "Desktop:Destroy"  
100          *              "Desktop:Focus" "Desktop:Defocus"
101          *              "Desktop:Reorder" 
102          *              "Focus"
103          *              "GtkWidget:show"
104          *              "GObject:notify:<propertyname>" 
105          *
106          *  ( not sure we should allow these last 2 forms, 
107          *    since they are toolkit-specific, but they're powerful )
108          *
109          **/              
110
111         /**
112          * getDesktopCount:
113          *
114          * Get the current number of desktops.
115          * Returns: a short integer indicating the current number of 
116          * @Desktops.
117          **/
118         short getDesktopCount ();
119
120         /**
121          * getDesktop:
122          * @n: the index of the requested @Desktop.
123          *
124          * Get the nth accessible desktop. 
125          *
126          * Returns: a reference to the requested @Desktop.
127          **/
128         Desktop getDesktop (in short n);
129
130         /**
131          * getDesktopList:
132          *
133          * Get a list of accessible desktops. 
134          *
135          * Returns: a sequence containing references to
136          * the @Desktops.
137          **/
138         DesktopSeq getDesktopList ();
139
140         /**
141          * getDeviceEventController:
142          *
143          * Returns: an object implementing DeviceEventController
144          **/
145         DeviceEventController getDeviceEventController ();
146
147         /**
148          * unImplemented:
149          *
150          * placeholders for future expansion.
151          */
152         void unImplemented ();
153         void unImplemented2 ();
154     };
155
156   /* Deprecated, DO NOT USE! */
157   enum KeyEventType {
158     KEY_PRESSED,
159     KEY_RELEASED
160   };
161
162   enum EventType {
163     KEY_PRESSED_EVENT,
164     KEY_RELEASED_EVENT,
165     BUTTON_PRESSED_EVENT,
166     BUTTON_RELEASED_EVENT
167   };
168
169   enum KeySynthType {
170     KEY_PRESS,
171     KEY_RELEASE,
172     KEY_PRESSRELEASE,
173     KEY_SYM,
174     KEY_STRING
175   };
176
177   enum ModifierType {
178     MODIFIER_SHIFT,
179     MODIFIER_ALT,
180     MODIFIER_CONTROL,
181     MODIFIER_META,
182     MODIFIER_META2,
183     MODIFIER_META3,
184     MODIFIER_SHIFTLOCK,
185     MODIFIER_NUMLOCK
186   };
187
188   struct EventListenerMode {
189     boolean synchronous;
190     boolean preemptive;
191     boolean global;       
192   };
193
194   typedef unsigned long ControllerEventMask;
195
196   struct DeviceEvent {
197     EventType type; 
198     long  id;
199     short hw_code;
200     unsigned short modifiers;
201     unsigned long timestamp;
202     string event_string;
203     boolean is_text;
204   };
205
206   struct KeyDefinition {
207     long keycode;
208     long keysym;
209     string keystring;
210     long unused;
211   };    
212
213   typedef sequence< KeyDefinition > KeySet;
214   typedef sequence< EventType > KeyEventTypeSeq;
215   typedef sequence< EventType > EventTypeSeq;
216
217   interface DeviceEventListener : Bonobo::Unknown {
218         boolean notifyEvent (in DeviceEvent event);
219         void    unImplemented__ ();
220         void    unImplemented_2_ ();
221         void    unImplemented_3_ ();
222         void    unImplemented_4_ ();
223   };
224
225   interface DeviceEventController : Bonobo::Unknown {
226
227         /**
228          * registerKeystrokeListener:
229          * @listener: a @DeviceEventListener which will intercept key events.
230          * @keys:     a @KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS.
231          * @mask:     a @ControllerEventMask filtering the intercepted key events.
232          * @type:     an @EventType mask that may created by ORing event types together.
233          * @is_synchronous: a @boolean indicating whether the listener should 
234          *            receive the events synchronously, potentially consuming them,
235          *            or just be notified asynchronously of those events that have
236          *            been generated.
237          * Returns: %true if successful, %false if not
238          *
239          * Register to intercept keyboard events, and either pass them on or
240          * consume them. 
241          *
242          **/
243         boolean registerKeystrokeListener (in DeviceEventListener listener,
244                                         in KeySet keys,
245                                         in ControllerEventMask mask,
246                                         in KeyEventTypeSeq type,
247                                         in EventListenerMode mode);
248     
249         /**
250          * deregisterKeystrokeListener:
251          * @listener: a @DeviceEventListener which will intercept key events.
252          * @keys:     a @KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS.
253          * @mask:     a @ControllerEventMask filtering the intercepted key events.
254          * @type:     an @EventType mask that may created by ORing event types together.
255          *
256          * Returns: void
257          *
258          * De-register a previously registered keyboard eventlistener.
259          *
260          **/
261         void deregisterKeystrokeListener (in DeviceEventListener listener,
262                                           in KeySet keys,
263                                           in ControllerEventMask mask,
264                                           in KeyEventTypeSeq type);
265     
266         /**
267          * registerDeviceEventListener:
268          * @listener: a @DeviceEventListener which will intercept events.
269          * @typeseq:  an @EventTypeSeq indicating which event types to listen for.
270          * Returns: %true if successful, %false if not
271          *
272          * Register to intercept events, and either pass them on or
273          * consume them. To listen to keyboard events use registerKeystrokeListener
274          * instead.
275          *
276          **/
277         boolean registerDeviceEventListener (in DeviceEventListener listener,
278                                              in EventTypeSeq typeseq);
279     
280         /**
281          * deregisterDeviceEventListener:
282          * @listener: a @DeviceEventListener which will intercept events.
283          * @typeseq:  an @EventTypeSeq indicating which event types to stop
284          *            listening for.
285          *
286          * Returns: void
287          *
288          * De-register a previously registered keyboard eventlistener.
289          *
290          **/
291         void deregisterDeviceEventListener (in DeviceEventListener listener,
292                                             in EventTypeSeq typeseq);
293     
294         boolean notifyListenersSync (in DeviceEvent event);
295
296         oneway void notifyListenersAsync (in DeviceEvent event);
297
298         /**
299          * generateKeyboardEvent:
300          * @keycode: a long integer indicating the keycode of
301          *          the keypress to be synthesized.
302          * @keystring: an optional UTF-8 string indicating a complex
303          *          keyboard input event.
304          * @type: a #KeySynthType indicating the type of event(s) to be 
305          *          synthesized: a key press, release, press-release pair,
306          *          or a complex input string (for instance from an
307          *          internationalized or complex text input method, or
308          *          a composed character).
309          *
310          * Note that @keycode may be truncated before being
311          *          processed, as keycode length may be platform-dependent
312          *          and keycode ranges are generally much smaller than
313          *          CORBA_long. 
314          * One or the other of @keycode or @keystring are generally NULL, 
315          *          (but not both), depending on the value of @type.
316          *
317          * Returns: void
318          *
319          * Synthesize a keyboard event.
320          *
321          **/
322          void generateKeyboardEvent (in long keycode, 
323                                      in string keystring, 
324                                      in KeySynthType type);
325
326         /**
327          * generateMouseEvent:
328          * @x: a long integer indicating the screen x coord for the mouse event.
329          * @y: a long integer indicating the screen y coord for the mouse event.
330          * @eventName: a string indicating the type of mouse event, e.g. "button1up"
331          * Returns: void
332          *
333          * Synthesize a mouse event.
334          *
335          **/
336          void generateMouseEvent (in long x, in long y, in string eventName);
337
338          /**
339           * unImplemented:
340           *
341           * placeholders for future expansion.
342           */
343          void unImplemented ();
344          void unImplemented2 ();
345     }; 
346 };
347
348 #endif