95bc6fb471f4b60dd8a805e3513b76133e94525a
[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
149   enum KeyEventType {
150     KEY_PRESSED,
151     KEY_RELEASED
152   };
153
154   enum EventType {
155     KEY_PRESSED_EVENT,
156     KEY_RELEASED_EVENT
157   };
158
159   enum KeySynthType {
160     KEY_PRESS,
161     KEY_RELEASE,
162     KEY_PRESSRELEASE,
163     KEY_SYM
164   };
165
166   enum ModifierType {
167     MODIFIER_SHIFT,
168     MODIFIER_ALT,
169     MODIFIER_CONTROL,
170     MODIFIER_META,
171     MODIFIER_META2,
172     MODIFIER_META3,
173     MODIFIER_SHIFTLOCK,
174     MODIFIER_NUMLOCK
175   };
176
177   typedef unsigned long ControllerEventMask;
178
179   struct DeviceEvent {
180     EventType type; 
181     long  id;
182     short hw_code;
183     unsigned short modifiers;
184     unsigned long timestamp;
185     string event_string;
186     boolean is_text;
187   };
188
189   typedef sequence< long > KeySet;
190   typedef sequence< KeyEventType > KeyEventTypeSeq;
191
192   interface DeviceEventListener : Bonobo::Unknown {
193         boolean notifyEvent (in DeviceEvent event);
194   };
195
196   interface DeviceEventController : Bonobo::Unknown {
197
198         /**
199          * registerKeystrokeListener:
200          * @listener: a @DeviceEventListener which will intercept key events.
201          * @keys:     a @KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS.
202          * @mask:     a @ControllerEventMask filtering the intercepted key events.
203          * @type:     an @EventType mask that may created by ORing event types together.
204          * @is_synchronous: a @boolean indicating whether the listener should 
205          *            receive the events synchronously, potentially consuming them,
206          *            or just be notified asynchronously of those events that have
207          *            been generated.
208          * Returns: void
209          *
210          * Register to intercept keyboard events, and either pass them on or
211          * consume them. 
212          *
213          **/
214         void registerKeystrokeListener (in DeviceEventListener listener,
215                                         in KeySet keys,
216                                         in ControllerEventMask mask,
217                                         in KeyEventTypeSeq type,
218                                         in boolean is_synchronous);
219     
220         /**
221          * deregisterKeystrokeListener:
222          * @listener: a @DeviceEventListener which will intercept key events.
223          * @keys:     a @KeySet indicating which keys to intercept, or KEYSET_ALL_KEYS.
224          * @mask:     a @ControllerEventMask filtering the intercepted key events.
225          * @type:     an @EventType mask that may created by ORing event types together.
226          * @is_synchronous: a @boolean indicating whether the listener should 
227          *            receive the events synchronously, potentially consuming them,
228          *            or just be notified asynchronously of those events that have
229          *            been generated.
230          * Returns: void
231          *
232          * De-register a previously registered keyboard eventlistener.
233          *
234          **/
235         void deregisterKeystrokeListener (in DeviceEventListener listener,
236                                           in KeySet keys,
237                                           in ControllerEventMask mask,
238                                           in KeyEventTypeSeq type,
239                                           in boolean is_synchronous);
240     
241         boolean notifyListenersSync (in DeviceEvent event);
242
243         oneway void notifyListenersAsync (in DeviceEvent event);
244
245         /**
246          * generateKeyEvent:
247          * @keycode: a long integer indicating the keycode of
248          *          the keypress to be synthesized.
249          *
250          * Note that this long may be truncated before being
251          *          processed, as keycode length may be platform-dependent
252          *          and keycode ranges are generally much smaller than
253          *          CORBA_long. 
254          *
255          * Returns: void
256          *
257          * Synthesize a keypress event.
258          *
259          **/
260          void generateKeyEvent (in long keycode, in KeySynthType type);
261
262         /**
263          * generateMouseEvent:
264          * @x: a long integer indicating the screen x coord for the mouse event.
265          * @y: a long integer indicating the screen y coord for the mouse event.
266          * @eventName: a string indicating the type of mouse event, e.g. "button1up"
267          * Returns: void
268          *
269          * Synthesize a mouse event.
270          *
271          **/
272          void generateMouseEvent (in long x, in long y, in string eventName);
273     }; 
274 };
275
276 #endif