Enhancements to Accessibility::Text, based on patches from
[platform/core/uifw/at-spi2-atk.git] / cspi / spi.h
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #ifndef _SPI_H
25 #define _SPI_H
26
27 #include <cspi/spi-impl.h>
28 /*
29  * Definitions for AccessibleRole, AccessibleState,
30  * and event listeners.
31  */
32 #include <cspi/spi-roletypes.h>
33 #include <cspi/spi-statetypes.h>
34 #include <cspi/spi-listener.h>
35
36 /*
37  * Auxiliary typedefs and mask definitions
38  */
39 #include <libspi/keymasks.h>
40
41 #ifdef  __cplusplus
42 extern "C" {
43 #endif
44
45 /**
46  *AccessibleTextBoundaryType:
47  *@SPI_TEXT_BOUNDARY_CHAR: Delimiter is the current character's bounds.
48  *@SPI_TEXT_BOUNDARY_CURSOR_POS: Delimiter is the current text caret position.
49  *@SPI_TEXT_BOUNDARY_WORD_START: Bounds run from the first character of a word to the first 
50  * character of the following word (i.e. including trailing whitespace, if any) within the text object.
51  *@SPI_TEXT_BOUNDARY_WORD_END: Bounds run from the last character of a word to the last 
52  * character of the following word (i.e. including leading whitespace) within the text object.
53  *@SPI_TEXT_BOUNDARY_SENTENCE_START: Bounds run from the first character of a sentence to the first 
54  * character of the next sentence in the text object.
55  *@SPI_TEXT_BOUNDARY_SENTENCE_END: Bounds run from the last character of a sentence to the last 
56  * character of the next sentence in the text object.
57  *@SPI_TEXT_BOUNDARY_LINE_START: Bounds span one line of text, with the line delimiter at the end of the
58  * bounds, if present, within the current text object.
59  *@SPI_TEXT_BOUNDARY_LINE_END: Bounds span one line of text, including a preceding line delimiter
60  * if present within the current text object.
61  *@SPI_TEXT_BOUNDARY_ATTRIBUTE_RANGE: Bounds span the run, relative to the specified offset and
62  * text accessor API rules, over which the attributes of the text object are invariant.  
63  *
64  *Text boundary types used for specifying boundaries for regions of text.
65  **/
66 typedef enum
67 {
68   SPI_TEXT_BOUNDARY_CHAR,
69   SPI_TEXT_BOUNDARY_CURSOR_POS,
70   SPI_TEXT_BOUNDARY_WORD_START,
71   SPI_TEXT_BOUNDARY_WORD_END,
72   SPI_TEXT_BOUNDARY_SENTENCE_START,
73   SPI_TEXT_BOUNDARY_SENTENCE_END,
74   SPI_TEXT_BOUNDARY_LINE_START,
75   SPI_TEXT_BOUNDARY_LINE_END,
76   SPI_TEXT_BOUNDARY_ATTRIBUTE_RANGE
77 } AccessibleTextBoundaryType;
78
79 /**
80  *AccessibleTextClipType
81  *@SPI_TEXT_CLIP_NONE: No clipping to be done
82  *@SPI_TEXT_CLIP_MIN: Text clipped by min coordinate is omitted
83  *@SPI_TEXT_CLIP_MAX: Text clipped by max coordinate is omitted
84  *@SPI_TEXT_CLIP_BOTH: Only text fully within mix/max bound is retained
85  *
86  *Describes the type of clipping required.
87  **/
88 typedef enum
89 {
90   SPI_TEXT_CLIP_NONE,
91   SPI_TEXT_CLIP_MIN,
92   SPI_TEXT_CLIP_MAX,
93   SPI_TEXT_CLIP_BOTH
94 } AccessibleTextClipType;
95
96 /**
97  *AccessibleRelationType:
98  *@SPI_RELATION_NULL: Not used, this is an invalid value for this enumeration.
99  *@SPI_RELATION_LABEL_FOR: Indicates an object is a label for one or more target objects.
100  *@SPI_RELATION_LABELED_BY: Indicates an object is labelled by one or more target objects.
101  *@SPI_RELATION_CONTROLLED_BY: Indicates an object controlled by one or more target objects.
102  *@SPI_RELATION_CONTROLLER_FOR: Indicates an object is an controller for one or more target objects.
103  *@SPI_RELATION_MEMBER_OF: Indicates an object is a member of a group of one or
104 more target objects.
105  *@SPI_RELATION_NODE_CHILD_OF: Indicates an object is a cell in a treetable which is displayed because a cell in the same column is expanded and identifies that cell.
106  *@SPI_RELATION_EXTENDED: This value indicates that a relation other than those pre-specified by this version of AT-SPI
107  * is present.
108  *@SPI_RELATION_FLOWS_TO: Indicates that the object has content that flows logically to another
109  *  AtkObject in a sequential way, (for instance text-flow).
110  *@SPI_RELATION_FLOWS_FROM: Indicates that the object has content that flows logically from
111  *  another AtkObject in a sequential way, (for instance text-flow).
112  *@SPI_RELATION_SUBWINDOW_OF: Indicates a subwindow attached to a component but otherwise has no connection in the UI heirarchy to that component.
113  *@SPI_RELATION_EMBEDS: Indicates that the object visually embeds
114  *  another object's content, i.e. this object's content flows around
115  *  another's content.
116  *@SPI_RELATION_EMBEDDED_BY: Inverse of %SPI_RELATION_EMBEDS, indicates that
117  *  this object's content is visualy embedded in another object.
118  *@SPI_RELATION_POPUP_FOR: Indicates that an object is a popup for another objec *@SPI_RELATION_PARENT_WINDOW_OF: Indicates that an object is a parent window of another object.
119  *@SPI_RELATION_DESCRIBED_BY: Indicates that another object provides descriptive information about this object; more verbose than %SPI_RELATION_LABELLED_BY.
120  *@SPI_RELATION_DESCRIPTION_FOR: Indicates that an object provides descriptive information about another object; more verbose than %SPI_RELATION_LABEL_FOR.
121  *@SPI_RELATION_LAST_DEFINED: Do not use, this is an implementation detail used
122  *  to identify the size of this enumeration.
123  *
124  *Describes the type of the relation
125  **/
126 typedef enum
127 {
128   SPI_RELATION_NULL,
129   SPI_RELATION_LABEL_FOR,
130   SPI_RELATION_LABELED_BY,
131   SPI_RELATION_CONTROLLER_FOR,
132   SPI_RELATION_CONTROLLED_BY,
133   SPI_RELATION_MEMBER_OF,
134   SPI_RELATION_NODE_CHILD_OF,
135   SPI_RELATION_EXTENDED,
136   SPI_RELATION_FLOWS_TO,
137   SPI_RELATION_FLOWS_FROM,
138   SPI_RELATION_SUBWINDOW_OF,
139   SPI_RELATION_EMBEDS,
140   SPI_RELATION_EMBEDDED_BY,
141   SPI_RELATION_POPUP_FOR,
142   SPI_RELATION_PARENT_WINDOW_OF,
143   SPI_RELATION_DESCRIPTION_FOR,
144   SPI_RELATION_DESCRIBED_BY,
145   SPI_RELATION_LAST_DEFINED
146 } AccessibleRelationType;
147
148
149 /* don't change the order of these ! */
150 /**
151  *AccessibleCoordType:
152  *@SPI_COORD_TYPE_SCREEN: specifies xy coordinates relative to the screen
153  *@SPI_COORD_TYPE_WINDOW: specifies xy coordinates relative to an object's
154  * top-level window
155  *
156  *Specifies how xy coordinates are to be interpreted. Used by functions such
157  *as AccessibleComponent_getPosition() and AccessibleText_getCharacterExtents()
158  **/
159 typedef enum {
160   SPI_COORD_TYPE_SCREEN,
161   SPI_COORD_TYPE_WINDOW
162 } AccessibleCoordType;
163
164 /**
165  *AccessibleKeySynthType:
166  *@SPI_KEY_PRESS: Generates a keypress event (requires a subsequent #SPI_KEY_RELEASE event)
167  *@SPI_KEY_RELEASE: Generates a key-release event
168  *@SPI_KEY_PRESSRELEASE: Generates a key press/release event pair.
169  *@SPI_KEY_SYM: Injects a "keysym" event into the stream, as if a press/release pair occurred; allows 
170  * the user to specify the key via its symbolic name, as opposed to simulating a hardware press of a 
171  * specific key.
172  *@SPI_KEY_STRING: Injects one or more keysym events into the keyboard buffer, or directly inserts 
173  * a string value into the currently focussed text widget, if the widgets supports this.
174  * #SPI_KEY_STRING synthesis provides a shortcut for text substring insertion, and also allows the
175  * insertion of text which is not currently available via the current keyboard's keymap.
176  *
177  * Specifies the type of a generated event.
178  **/
179 typedef enum {
180   SPI_KEY_PRESS,
181   SPI_KEY_RELEASE, 
182   SPI_KEY_PRESSRELEASE,
183   SPI_KEY_SYM,
184   SPI_KEY_STRING
185 } AccessibleKeySynthType;
186
187 /**
188  *AccessibleKeyListenerSyncType:
189  *@SPI_KEYLISTENER_NOSYNC: Events may be delivered asynchronously, 
190  * which means in some cases they may already have been delivered to the 
191  * application before the AT client receives the notification.  
192  *@SPI_KEYLISTENER_SYNCHRONOUS: Events are delivered synchronously, before the 
193  * currently focussed application sees them.  
194  *@SPI_KEYLISTENER_CANCONSUME: Events may be consumed by the AT client.  Presumes and
195  * requires #SPI_KEYLISTENER_SYNCHRONOUS, incompatible with #SPI_KEYLISTENER_NOSYNC.
196  *@SPI_KEYLISTENER_ALL_WINDOWS: Events are received not from the application toolkit layer, but
197  * from the device driver or windowing system subsystem; such notifications are 'global' in the 
198  * sense that they are not broken or defeated by applications that participate poorly
199  * in the accessibility APIs, or not at all; however because of the intrusive nature of
200  * such snooping, it can have side-effects on certain older platforms.  If unconditional
201  * event notifications, even when inaccessible or "broken" applications have focus, are not
202  * required, it may be best to avoid this enum value/flag.
203  *
204  *Specified the tyupe of a key listener event.
205  * Certain of the values above can and should be bitwise-'OR'ed
206  * together, observing the compatibility limitations specified in the description of
207  * each value.  For instance, #SPI_KEYLISTENER_ALL_WINDOWS | #SPI_KEYLISTENER_CANCONSUME is
208  * a commonly used combination which gives the AT complete control over the delivery of matching
209  * events.  However, such filters should be used sparingly as they may have a negative impact on 
210  * system performance.
211  **/
212 typedef enum {
213   SPI_KEYLISTENER_NOSYNC = 0,
214   SPI_KEYLISTENER_SYNCHRONOUS = 1,
215   SPI_KEYLISTENER_CANCONSUME = 2,
216   SPI_KEYLISTENER_ALL_WINDOWS = 4
217 } AccessibleKeyListenerSyncType;
218
219
220 /**
221  *AccessibleStreamableContentSeekType
222  *@SPI_STREAM_SEEK_SET: seek from the 'top' of the streamable
223  *@SPI_STREAM_SEEK_CUR: seek from the current position in the stream
224  *@SPI_STREAM_SEEK_END: seek from the end of the stream (if known)
225  *
226  *The seek type for a specified offset in AccessibleStreamableContent_seek.
227  **/
228 typedef enum
229 {
230   SPI_STREAM_SEEK_SET,
231   SPI_STREAM_SEEK_CUR,
232   SPI_STREAM_SEEK_END
233 } AccessibleStreamableContentSeekType;
234
235 /**
236  * SPIException:
237  * @type: private
238  * @source: private
239  * @ev: private
240  * @code: private
241  * @desc: private
242  *
243  * An opaque object encapsulating information about thrown exceptions.
244  **/
245 typedef struct _SPIException SPIException;
246
247
248 typedef SPIBoolean (*SPIExceptionHandler) (SPIException *err, SPIBoolean is_fatal);
249
250 /**
251  * SPIExceptionCode:
252  * @SPI_EXCEPTION_UNSPECIFIED: An exception of unknown type, or which doesn't fit the other types.
253  * @SPI_EXCEPTION_DISCONNECT: Communication with the object or service has been disconnected;
254  * this usually means that the object or service has died or exited.
255  * @SPI_EXCEPTION_NO_IMPL: The object or service is missing the implementation for a request.
256  * @SPI_EXCEPTION_IO: The communications channel has become corrupted, blocked, or is otherwise in a bad state.
257  * @SPI_EXCEPTION_BAD_DATA: The data received or sent over the interface has been identified as 
258  * improperly formatted or otherwise fails to match the expectations.
259  *
260  * Exception codes indicating what's gone wrong in an AT-SPI call.
261  **/
262 typedef enum {
263         SPI_EXCEPTION_UNSPECIFIED,
264         SPI_EXCEPTION_DISCONNECT,
265         SPI_EXCEPTION_NO_IMPL,
266         SPI_EXCEPTION_IO,
267         SPI_EXCEPTION_BAD_DATA
268 } SPIExceptionCode;
269
270 /**
271  * SPIExceptionType:
272  * @SPI_EXCEPTION_SOURCE_UNSPECIFIED: Don't know or can't tell where the problem is
273  * @SPI_EXCEPTION_SOURCE_ACCESSIBLE: The source of an event or query (i.e. an app) has thrown the exception.
274  * @SPI_EXCEPTION_SOURCE_REGISTRY: The AT-SPI registry has thrown the exception or cannot be reached.
275  * @SPI_EXCEPTION_SOURCE_DEVICE: The device event subsystem has encountered an error condition.
276  *
277  * The general source of the failure, i.e. whether the app, registry, or device system has encountered trouble.
278  **/
279 typedef enum {
280         SPI_EXCEPTION_SOURCE_UNSPECIFIED,
281         SPI_EXCEPTION_SOURCE_ACCESSIBLE,
282         SPI_EXCEPTION_SOURCE_REGISTRY,
283         SPI_EXCEPTION_SOURCE_DEVICE
284 } SPIExceptionType;
285
286 typedef unsigned long AccessibleKeyEventMask;
287 typedef unsigned long AccessibleDeviceEventMask;
288 /**
289  * SPIRect:
290  * @x: The position of the minimum x value of the rectangle (i.e. left hand corner)
291  * @y: The position of the minimum y value of the rectangle's bounds.
292  * @width: Width of the rectangle in pixels.
293  * @height: Height of the rectangle in pixels.
294  *
295  * A structure encapsulating a rectangle. 
296  **/
297 typedef struct {
298         long x;
299         long y;
300         long width;
301         long height;
302 } SPIRect;
303
304 /**
305  *AccessibleComponentLayer:
306  *@SPI_LAYER_INVALID: The layer cannot be determined or is somehow undefined.
307  *@SPI_LAYER_BACKGROUND: Component belongs to the destop background.
308  *@SPI_LAYER_CANVAS: Component is a canvas backdrop or drawing area.
309  *@SPI_LAYER_WIDGET: Component is a 'normal' widget.
310  *@SPI_LAYER_MDI: Component is drawn in the MDI layer and may have valid
311  *                         Z-information relative to other MDI-layer components.
312  *@SPI_LAYER_POPUP: Component is in the popup layer, above other widgets and
313  *                         MDI components.
314  *@SPI_LAYER_OVERLAY: Component is in the overlay plane - this value is reserved
315  *                         for future use.
316  *@SPI_LAYER_WINDOW: Component is in the window layer and have valid Z-information
317  *                   relative to other window-layer components.
318  *@SPI_LAYER_LAST_DEFINED: Used to determine the last valid value in the enum,
319  *                         should not be encountered.   
320  *
321  * Describes the layer of a component.
322  *
323  * These enumerated "layer values" are used when determining which UI
324  * rendering layer a component is drawn into, which can help in making
325  * determinations of when components occlude one another.
326  **/
327 typedef enum {
328     SPI_LAYER_INVALID,
329     SPI_LAYER_BACKGROUND,
330     SPI_LAYER_CANVAS,
331     SPI_LAYER_WIDGET,
332     SPI_LAYER_MDI,
333     SPI_LAYER_POPUP,
334     SPI_LAYER_OVERLAY,
335     SPI_LAYER_WINDOW,
336     SPI_LAYER_LAST_DEFINED      
337 } AccessibleComponentLayer;
338
339
340 /**
341  * AccessibleTextRange:
342  * @start: the first nominal character position within the range.
343  * @end: the first nominal character position following the range.
344  * @content: The actual text content between @start and @end, as a UTF-8 string.
345  *
346  * Structure which encapsulates a text range - must be associated with an
347  *          AccessibleText-implementing object.
348  **/
349 typedef struct _AccessibleTextRange
350 {
351   long int        start;
352   long int        end;
353   char           *contents;
354 } AccessibleTextRange;
355
356 /**
357  * AccessibleKeySet:
358  * @keysyms:
359  * @keycodes:
360  * @len:
361  *
362  * Structure containing identifying information about a set of keycode or
363  *        keysyms.
364  **/
365 typedef struct _AccessibleKeySet
366 {
367   unsigned long  *keysyms;
368   unsigned short *keycodes;
369   char          **keystrings;
370   short           len;
371 } AccessibleKeySet;
372
373 /*
374  * A special value for an AccessibleKeySet type, which tacitly
375  * includes all keycodes and keyvals for the specified modifier set.
376  */
377 #define SPI_KEYSET_ALL_KEYS NULL
378
379 typedef unsigned long AccessibleModifierMaskType;
380 /**
381  *AccessibleKeyMaskType:
382  *
383  *AccessibleKeyMaskType is a mask which is a set of key event modifiers
384  *which is specified in SPI_registerAccessibleKeystrokeListener.
385  **/
386
387 typedef AccessibleModifierMaskType AccessibleKeyMaskType;
388
389 typedef struct _AccessibleAttributeSet
390 {
391     int len;
392     char **attributes;
393 } AccessibleAttributeSet;
394
395 /* Basic SPI initialization and event loop function prototypes */
396
397 int              SPI_init         (void);
398 void             SPI_event_main   (void);
399 void             SPI_event_quit   (void);
400 SPIBoolean       SPI_eventIsReady (void);
401 AccessibleEvent *SPI_nextEvent    (SPIBoolean waitForEvent);
402 int              SPI_exit         (void);
403
404 /* Event Listener creation and support.  */
405
406 void                      SPI_freeAccessibleKeySet (
407                                                    AccessibleKeySet         *keyset);
408 AccessibleKeySet        * SPI_createAccessibleKeySet (
409                                                    int                       len,
410                                                    const char               *keysyms,
411                                                    short                    *keycodes,
412                                                    const char              **keystrings);
413 AccessibleEventListener * SPI_createAccessibleEventListener (
414                                                    AccessibleEventListenerCB callback,
415                                                    void                     *user_data);
416 SPIBoolean                AccessibleEventListener_addCallback (
417                                                    AccessibleEventListener  *listener,
418                                                    AccessibleEventListenerCB callback,
419                                                    void                     *user_data);
420 SPIBoolean                AccessibleEventListener_removeCallback (
421                                                    AccessibleEventListener  *listener,
422                                                    AccessibleEventListenerCB callback);
423 void                      AccessibleEventListener_unref (
424                                                    AccessibleEventListener  *listener);
425
426 /* Device Event Listener creation and support.  */
427
428 /* First four are deprecated in favor of the last four; really just a re-name */
429
430 AccessibleKeystrokeListener * SPI_createAccessibleKeystrokeListener (
431                                         AccessibleKeystrokeListenerCB callback,
432                                         void                         *user_data);
433 SPIBoolean                    AccessibleKeystrokeListener_addCallback (
434                                         AccessibleKeystrokeListener  *listener,
435                                         AccessibleKeystrokeListenerCB callback,
436                                         void                         *user_data);
437 SPIBoolean                    AccessibleKeystrokeListener_removeCallback (
438                                         AccessibleKeystrokeListener *listener,
439                                         AccessibleKeystrokeListenerCB callback);
440 void                          AccessibleKeystrokeListener_unref (
441                                         AccessibleKeystrokeListener *listener);
442
443 AccessibleDeviceListener   * SPI_createAccessibleDeviceListener (
444                                         AccessibleDeviceListenerCB callback,
445                                         void                      *user_data);
446 SPIBoolean                    AccessibleDeviceListener_addCallback (
447                                         AccessibleDeviceListener  *listener,
448                                         AccessibleDeviceListenerCB callback,
449                                         void                      *user_data);
450 SPIBoolean                    AccessibleDeviceListener_removeCallback (
451                                         AccessibleDeviceListener  *listener,
452                                         AccessibleDeviceListenerCB callback);
453 void                          AccessibleDeviceListener_unref (
454                                         AccessibleDeviceListener *listener);
455
456 /* Global functions serviced by the registry */
457
458 SPIBoolean SPI_registerGlobalEventListener           (
459                                        AccessibleEventListener *listener,
460                                        const char              *eventType);
461 SPIBoolean SPI_deregisterGlobalEventListener         (
462                                        AccessibleEventListener *listener,
463                                        const char              *eventType);
464 SPIBoolean SPI_deregisterGlobalEventListenerAll      (
465                                        AccessibleEventListener *listener);
466 SPIBoolean SPI_registerAccessibleKeystrokeListener   (
467                                        AccessibleKeystrokeListener *listener,
468                                        AccessibleKeySet             *keys,
469                                        AccessibleKeyMaskType         modmask,
470                                        AccessibleKeyEventMask        eventmask,
471                                        AccessibleKeyListenerSyncType sync_type);
472 SPIBoolean SPI_deregisterAccessibleKeystrokeListener (
473                                        AccessibleKeystrokeListener *listener,
474                                        AccessibleKeyMaskType        modmask);
475
476 SPIBoolean SPI_registerDeviceEventListener   (
477                                        AccessibleDeviceListener   *listener,
478                                        AccessibleDeviceEventMask   eventmask,
479                                        void                       *filter);
480 SPIBoolean SPI_deregisterDeviceEventListener (
481                                        AccessibleDeviceListener   *listener,
482                                        void                       *filter);
483
484 int         SPI_getDesktopCount                  (void);
485 Accessible *SPI_getDesktop                       (int i);
486 int         SPI_getDesktopList                   (Accessible ***desktop_list);
487 void        SPI_freeDesktopList                  (Accessible  **desktop_list);
488
489 SPIBoolean  SPI_generateKeyboardEvent            (long int                    keyval,
490                                                   char                       *keystring,
491                                                   AccessibleKeySynthType      synth_type);
492
493 SPIBoolean  SPI_generateMouseEvent               (long int x, long int y, char *name);
494
495 /* Accessible function prototypes  */
496
497 void                 Accessible_ref              (Accessible *obj);
498 void                 Accessible_unref            (Accessible *obj);
499 char *               Accessible_getName          (Accessible *obj);
500 char *               Accessible_getDescription   (Accessible *obj);
501 Accessible *         Accessible_getParent        (Accessible *obj);
502 long                 Accessible_getChildCount    (Accessible *obj);
503 Accessible *         Accessible_getChildAtIndex  (Accessible *obj,
504                                                   long int    childIndex);
505 long                 Accessible_getIndexInParent (Accessible *obj);
506 AccessibleRelation **Accessible_getRelationSet   (Accessible *obj);
507 AccessibleRole       Accessible_getRole          (Accessible *obj);
508 char *               Accessible_getRoleName      (Accessible *obj);
509 char *               Accessible_getLocalizedRoleName (Accessible *obj);
510 AccessibleStateSet * Accessible_getStateSet      (Accessible *obj);
511 AccessibleAttributeSet *Accessible_getAttributes (Accessible *obj);
512 AccessibleApplication *Accessible_getHostApplication (Accessible *obj);
513
514 /* Interface query methods */
515
516 SPIBoolean Accessible_isAction            (Accessible *obj);
517 SPIBoolean Accessible_isApplication       (Accessible *obj);
518 SPIBoolean Accessible_isComponent         (Accessible *obj);
519 SPIBoolean Accessible_isDocument          (Accessible *obj);
520 SPIBoolean Accessible_isEditableText      (Accessible *obj);
521 SPIBoolean Accessible_isHypertext         (Accessible *obj);
522 SPIBoolean Accessible_isImage             (Accessible *obj);
523 SPIBoolean Accessible_isSelection         (Accessible *obj);
524 SPIBoolean Accessible_isStreamableContent (Accessible *obj);
525 SPIBoolean Accessible_isTable             (Accessible *obj);
526 SPIBoolean Accessible_isText              (Accessible *obj);
527 SPIBoolean Accessible_isValue             (Accessible *obj);
528
529 AccessibleAction *            Accessible_getAction            (Accessible *obj);
530 AccessibleApplication *       Accessible_getApplication       (Accessible *obj);
531 AccessibleComponent *         Accessible_getComponent         (Accessible *obj);
532 AccessibleDocument *          Accessible_getDocument          (Accessible *obj);
533 AccessibleEditableText *      Accessible_getEditableText      (Accessible *obj);
534 AccessibleHypertext *         Accessible_getHypertext         (Accessible *obj);
535 AccessibleImage *             Accessible_getImage             (Accessible *obj);
536 AccessibleSelection *         Accessible_getSelection         (Accessible *obj);
537 AccessibleStreamableContent * Accessible_getStreamableContent (Accessible *obj);
538 AccessibleTable *             Accessible_getTable             (Accessible *obj);
539 AccessibleText *              Accessible_getText              (Accessible *obj);
540 AccessibleValue *             Accessible_getValue             (Accessible *obj);
541 AccessibleUnknown *           Accessible_queryInterface       (Accessible *obj,
542                                                    const char *interface_name);
543
544 /* AccessibleAction function prototypes  */
545
546 void       AccessibleAction_ref            (AccessibleAction *obj);
547 void       AccessibleAction_unref          (AccessibleAction *obj);
548 long       AccessibleAction_getNActions    (AccessibleAction *obj);
549 char      *AccessibleAction_getName        (AccessibleAction *obj,
550                                             long int          i);
551 char      *AccessibleAction_getDescription (AccessibleAction *obj,
552                                             long int          i);
553 SPIBoolean AccessibleAction_doAction       (AccessibleAction *obj,
554                                             long int          i);
555 char      *AccessibleAction_getKeyBinding  (AccessibleAction *obj,
556                                             long int          i);
557
558 /* AccessibleApplication function prototypes  */
559
560 void       AccessibleApplication_ref            (AccessibleApplication *obj);
561 void       AccessibleApplication_unref          (AccessibleApplication *obj);
562 char      *AccessibleApplication_getToolkitName (AccessibleApplication *obj);
563 char      *AccessibleApplication_getVersion     (AccessibleApplication *obj);
564 long       AccessibleApplication_getID          (AccessibleApplication *obj);
565 char      *AccessibleApplication_getLocale      (AccessibleApplication *obj, int lc_category);
566 SPIBoolean AccessibleApplication_pause          (AccessibleApplication *obj);
567 SPIBoolean AccessibleApplication_resume         (AccessibleApplication *obj);
568
569 /* AccessibleComponent function prototypes */
570
571 void        AccessibleComponent_ref         (AccessibleComponent *obj);
572 void        AccessibleComponent_unref       (AccessibleComponent *obj);
573 SPIBoolean  AccessibleComponent_contains    (AccessibleComponent *obj,
574                                              long int             x,
575                                              long int             y,
576                                              AccessibleCoordType  ctype);
577 Accessible *AccessibleComponent_getAccessibleAtPoint (
578                                              AccessibleComponent *obj,
579                                              long int             x,
580                                              long int             y,
581                                              AccessibleCoordType  ctype);
582 void        AccessibleComponent_getExtents  (AccessibleComponent *obj,
583                                              long int            *x,
584                                              long int            *y,
585                                              long int            *width,
586                                              long int            *height,
587                                              AccessibleCoordType  ctype);
588 void        AccessibleComponent_getPosition (AccessibleComponent *obj,
589                                              long int            *x,
590                                              long int            *y,
591                                              AccessibleCoordType  ctype);
592 void        AccessibleComponent_getSize     (AccessibleComponent *obj,
593                                              long int            *width,
594                                              long int            *height);
595 AccessibleComponentLayer
596             AccessibleComponent_getLayer    (AccessibleComponent *obj);
597 SPIBoolean  AccessibleComponent_grabFocus   (AccessibleComponent *obj);
598 short       AccessibleComponent_getMDIZOrder(AccessibleComponent *obj);
599 double      AccessibleComponent_getAlpha    (AccessibleComponent *obj);
600
601 /* AccessibleDocument function prototypes  */
602
603 void        AccessibleDocument_ref               (AccessibleDocument *obj);
604 void        AccessibleDocument_unref             (AccessibleDocument *obj);
605 char       *AccessibleDocument_getLocale         (AccessibleDocument *obj);
606 char       *AccessibleDocument_getAttributeValue (AccessibleDocument *obj,
607                                                   char *attribute);
608 AccessibleAttributeSet *AccessibleDocument_getAttributes     (AccessibleDocument *obj);
609
610 /* AccessibleEditableText function prototypes  */
611
612 void
613 AccessibleEditableText_ref (AccessibleEditableText *obj);
614
615 void
616 AccessibleEditableText_unref (AccessibleEditableText *obj);
617
618 SPIBoolean
619 AccessibleEditableText_setAttributes (AccessibleEditableText *obj,
620                                       const char *attributes,
621                                       long int startOffset,
622                                       long int endOffset);
623
624 SPIBoolean
625 AccessibleEditableText_setTextContents (AccessibleEditableText *obj,
626                                         const char *newContents);
627
628 SPIBoolean
629 AccessibleEditableText_insertText (AccessibleEditableText *obj,
630                                    long int position,
631                                    const char *text,
632                                    long int length);
633
634 SPIBoolean
635 AccessibleEditableText_copyText (AccessibleText *obj,
636                                  long int startPos,
637                                  long int endPos);
638
639 SPIBoolean
640 AccessibleEditableText_cutText (AccessibleEditableText *obj,
641                                 long int startPos,
642                                 long int endPos);
643
644 SPIBoolean
645 AccessibleEditableText_deleteText (AccessibleEditableText *obj,
646                                    long int startPos,
647                                    long int endPos);
648
649 SPIBoolean
650 AccessibleEditableText_pasteText (AccessibleEditableText *obj,
651                                   long int position);
652
653 /*
654  *
655  * AccessibleHyperlink function prototypes
656  *
657  */
658 void
659 AccessibleHyperlink_ref (AccessibleHyperlink *obj);
660 void
661 AccessibleHyperlink_unref (AccessibleHyperlink *obj);
662
663 long
664 AccessibleHyperlink_getNAnchors (AccessibleHyperlink *obj);
665
666 char *
667 AccessibleHyperlink_getURI (AccessibleHyperlink *obj,
668                             long int i);
669
670 Accessible *
671 AccessibleHyperlink_getObject (AccessibleHyperlink *obj,
672                                long int i);
673
674 void
675 AccessibleHyperlink_getIndexRange (AccessibleHyperlink *obj,
676                                    long int *startIndex,
677                                    long int *endIndex);
678
679 SPIBoolean
680 AccessibleHyperlink_isValid (AccessibleHyperlink *obj);
681
682 /*
683  *
684  * AccessibleHypertext function prototypes
685  *
686  */
687
688 void
689 AccessibleHypertext_ref (AccessibleHypertext *obj);
690
691 void
692 AccessibleHypertext_unref (AccessibleHypertext *obj);
693
694 long
695 AccessibleHypertext_getNLinks (AccessibleHypertext *obj);
696
697 AccessibleHyperlink *
698 AccessibleHypertext_getLink (AccessibleHypertext *obj,
699                              long int linkIndex);
700
701 long
702 AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
703                                   long int characterOffset);
704
705 /*
706  *
707  * AccessibleImage function prototypes
708  *
709  */
710
711 void
712 AccessibleImage_ref (AccessibleImage *obj);
713
714 void
715 AccessibleImage_unref (AccessibleImage *obj);
716
717 char *
718 AccessibleImage_getImageDescription (AccessibleImage *obj);
719
720 void
721 AccessibleImage_getImageSize (AccessibleImage *obj,
722                               long int *width,
723                               long int *height);
724
725 void
726 AccessibleImage_getImagePosition (AccessibleImage *obj,
727                                   long int *x,
728                                   long int *y,
729                                   AccessibleCoordType ctype);
730
731 void
732 AccessibleImage_getImageExtents (AccessibleImage *obj,
733                                  long int *x,
734                                  long int *y,
735                                  long int *width,
736                                  long int *height,
737                                  AccessibleCoordType ctype);
738 char *
739 AccessibleImage_getImageLocale  (AccessibleImage *obj);
740
741 /*
742  *
743  * AccessibleRelation function prototypes
744  *
745  */
746
747 void AccessibleRelation_ref   (AccessibleRelation *obj);
748 void AccessibleRelation_unref (AccessibleRelation *obj);
749
750 AccessibleRelationType
751 AccessibleRelation_getRelationType (AccessibleRelation *obj);
752
753 int
754 AccessibleRelation_getNTargets (AccessibleRelation *obj);
755
756 Accessible *
757 AccessibleRelation_getTarget (AccessibleRelation *obj, int i);
758
759
760 /*
761  *
762  * AccessibleSelection function prototypes
763  *
764  */
765
766 void AccessibleSelection_ref   (AccessibleSelection *obj);
767 void AccessibleSelection_unref (AccessibleSelection *obj);
768
769 long
770 AccessibleSelection_getNSelectedChildren (AccessibleSelection *obj);
771
772 Accessible *
773 AccessibleSelection_getSelectedChild (AccessibleSelection *obj,
774                                       long int selectedChildIndex);
775
776 SPIBoolean
777 AccessibleSelection_selectChild (AccessibleSelection *obj,
778                                  long int childIndex);
779
780 SPIBoolean
781 AccessibleSelection_deselectSelectedChild (AccessibleSelection *obj,
782                                            long int selectedChildIndex);
783
784 SPIBoolean
785 AccessibleSelection_isChildSelected (AccessibleSelection *obj,
786                                      long int childIndex);
787
788 SPIBoolean
789 AccessibleSelection_selectAll (AccessibleSelection *obj);
790
791 SPIBoolean
792 AccessibleSelection_clearSelection (AccessibleSelection *obj);
793
794
795 /*
796  *
797  * AccessibleStateSet function prototypes
798  *
799  */
800
801 void AccessibleStateSet_ref   (AccessibleStateSet *obj);
802 void AccessibleStateSet_unref (AccessibleStateSet *obj);
803
804 SPIBoolean
805 AccessibleStateSet_contains (AccessibleStateSet *obj,
806                              AccessibleState state);
807
808 void
809 AccessibleStateSet_add (AccessibleStateSet *obj,
810                         AccessibleState state);
811
812 void
813 AccessibleStateSet_remove (AccessibleStateSet *obj,
814                            AccessibleState state);
815
816 SPIBoolean
817 AccessibleStateSet_equals (AccessibleStateSet *obj,
818                            AccessibleStateSet *obj2);
819
820 AccessibleStateSet *
821 AccessibleStateSet_compare (AccessibleStateSet *obj,
822                             AccessibleStateSet *obj2);
823
824 SPIBoolean
825 AccessibleStateSet_isEmpty (AccessibleStateSet *obj);
826
827 void
828 AccessibleStreamableContent_ref (AccessibleStreamableContent *obj);
829 void
830 AccessibleStreamableContent_unref (AccessibleStreamableContent *obj);
831 char **
832 AccessibleStreamableContent_getContentTypes (AccessibleStreamableContent *obj);
833
834 void
835 AccessibleStreamableContent_freeContentTypesList (AccessibleStreamableContent *obj,
836                                                  char **content_types);
837 #define AccessibleStreamableContent_freeContentTypeList(a, b) AccessibleStreamableContent_freeContentTypesList(a,b)
838
839 SPIBoolean
840 AccessibleStreamableContent_open (AccessibleStreamableContent *obj,
841                                   const char *content_type);
842 SPIBoolean
843 AccessibleStreamableContent_close (AccessibleStreamableContent *obj);
844
845 long
846 AccessibleStreamableContent_seek (AccessibleStreamableContent *obj,
847                                   long int offset,
848                                   AccessibleStreamableContentSeekType seek_type);
849 SPIBoolean
850 AccessibleStreamableContent_read (AccessibleStreamableContent *obj,
851                                   void *buff,
852                                   long int nbytes,
853                                   unsigned int read_type);
854 /*
855  *
856  * AccessibleTable function prototypes
857  *
858  */
859
860 void AccessibleTable_ref   (AccessibleTable *obj);
861 void AccessibleTable_unref (AccessibleTable *obj);
862
863 Accessible *
864 AccessibleTable_getCaption (AccessibleTable *obj);
865
866 Accessible *
867 AccessibleTable_getSummary (AccessibleTable *obj);
868
869 long
870 AccessibleTable_getNRows (AccessibleTable *obj);
871
872 long
873 AccessibleTable_getNColumns (AccessibleTable *obj);
874
875 Accessible *
876 AccessibleTable_getAccessibleAt (AccessibleTable *obj,
877                                  long int row,
878                                  long int column);
879
880 long
881 AccessibleTable_getIndexAt (AccessibleTable *obj,
882                             long int row,
883                             long int column);
884
885 long
886 AccessibleTable_getRowAtIndex (AccessibleTable *obj,
887                                long int index);
888
889 long
890 AccessibleTable_getColumnAtIndex (AccessibleTable *obj,
891                                   long int index);
892
893 char *
894 AccessibleTable_getRowDescription (AccessibleTable *obj,
895                                    long int row);
896
897 char *
898 AccessibleTable_getColumnDescription (AccessibleTable *obj,
899                                       long int column);
900
901 long
902 AccessibleTable_getRowExtentAt (AccessibleTable *obj,
903                                 long int row,
904                                 long int column);
905
906 long
907 AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
908                                    long int row,
909                                    long int column);
910
911 Accessible *
912 AccessibleTable_getRowHeader (AccessibleTable *obj,
913                               long int row);
914
915 Accessible *
916 AccessibleTable_getColumnHeader (AccessibleTable *obj,
917                                  long int column);
918
919 long
920 AccessibleTable_getNSelectedRows (AccessibleTable *obj);
921
922 long
923 AccessibleTable_getSelectedRows (AccessibleTable *obj,
924                                  long int **selectedRows);
925
926 long
927 AccessibleTable_getNSelectedColumns (AccessibleTable *obj);
928
929 long
930 AccessibleTable_getSelectedColumns (AccessibleTable *obj,
931                                     long int **selectedColumns);
932
933 SPIBoolean
934 AccessibleTable_isRowSelected (AccessibleTable *obj,
935                                long int row);
936
937 SPIBoolean
938 AccessibleTable_isColumnSelected (AccessibleTable *obj,
939                                   long int column);
940
941 SPIBoolean
942 AccessibleTable_isSelected (AccessibleTable *obj,
943                             long int row,
944                             long int column);
945
946 SPIBoolean
947 AccessibleTable_addRowSelection (AccessibleTable *obj,
948                                  long int row);
949 SPIBoolean
950 AccessibleTable_addColumnSelection (AccessibleTable *obj,
951                                     long int column);
952
953 SPIBoolean
954 AccessibleTable_removeRowSelection (AccessibleTable *obj,
955                                     long int row);
956 SPIBoolean
957 AccessibleTable_removeColumnSelection (AccessibleTable *obj,
958                                        long int column);
959
960 /*
961  *
962  * AccessibleText function prototypes
963  *
964  */
965
966 void AccessibleText_ref   (AccessibleText *obj);
967 void AccessibleText_unref (AccessibleText *obj);
968
969 long
970 AccessibleText_getCharacterCount (AccessibleText *obj);
971
972 char *
973 AccessibleText_getText (AccessibleText *obj,
974                         long int startOffset,
975                         long int endOffset);
976
977 long
978 AccessibleText_getCaretOffset (AccessibleText *obj);
979
980 char *
981 AccessibleText_getAttributes (AccessibleText *obj,
982                                  long int offset,
983                                  long int *startOffset,
984                                  long int *endOffset);
985
986 char *
987 AccessibleText_getDefaultAttributes (AccessibleText *obj);
988
989 SPIBoolean
990 AccessibleText_setCaretOffset (AccessibleText *obj,
991                                long int newOffset);
992
993 char *
994 AccessibleText_getTextBeforeOffset (AccessibleText *obj,
995                                     long int offset,
996                                     AccessibleTextBoundaryType type,
997                                     long int *startOffset,
998                                     long int *endOffset);
999
1000 char *
1001 AccessibleText_getTextAtOffset (AccessibleText *obj,
1002                                 long int offset,
1003                                 AccessibleTextBoundaryType type,
1004                                 long int *startOffset,
1005                                 long int *endOffset);
1006
1007 char *
1008 AccessibleText_getTextAfterOffset (AccessibleText *obj,
1009                                    long int offset,
1010                                    AccessibleTextBoundaryType type,
1011                                    long int *startOffset,
1012                                    long int *endOffset);
1013
1014 unsigned long
1015 AccessibleText_getCharacterAtOffset (AccessibleText *obj,
1016                                      long int offset);
1017
1018 void
1019 AccessibleText_getCharacterExtents (AccessibleText *obj,
1020                                     long int offset,
1021                                     long int *x,
1022                                     long int *y,
1023                                     long int *width,
1024                                     long int *height,
1025                                     AccessibleCoordType type);
1026
1027 void
1028 AccessibleText_getRangeExtents (AccessibleText *obj,
1029                                 long int startOffset,
1030                                 long int endOffset,
1031                                 long int *x,
1032                                 long int *y,
1033                                 long int *width,
1034                                 long int *height,
1035                                 AccessibleCoordType type);
1036
1037 AccessibleTextRange **
1038 AccessibleText_getBoundedRanges (AccessibleText *obj,
1039                                  long int x,
1040                                  long int y,
1041                                  long int width,
1042                                  long int height,
1043                                  AccessibleCoordType type,
1044                                  AccessibleTextClipType clipTypeX,
1045                                  AccessibleTextClipType clipTypeY);
1046
1047 void
1048 AccessibleTextRange_freeRanges (AccessibleTextRange **ranges);
1049
1050 long
1051 AccessibleText_getOffsetAtPoint (AccessibleText *obj,
1052                                  long int x,
1053                                  long int y,
1054                                  AccessibleCoordType type);
1055
1056 long
1057 AccessibleText_getNSelections (AccessibleText *obj);
1058
1059 void
1060 AccessibleText_getSelection (AccessibleText *obj,
1061                              long int selectionNum,
1062                              long int *startOffset,
1063                              long int *endOffset);
1064
1065
1066 SPIBoolean
1067 AccessibleText_addSelection (AccessibleText *obj,
1068                              long int startOffset,
1069                              long int endOffset);
1070
1071 SPIBoolean
1072 AccessibleText_removeSelection (AccessibleText *obj,
1073                                 long int selectionNum);
1074
1075 SPIBoolean
1076 AccessibleText_setSelection (AccessibleText *obj,
1077                              long int selectionNum,
1078                              long int startOffset,
1079                              long int endOffset);
1080 AccessibleAttributeSet *
1081 AccessibleText_getAttributeRun  (AccessibleText *obj,
1082                                  long int offset,
1083                                  long int *startOffset,
1084                                  long int *endOffset,
1085                                  long int includeDefaults);
1086 AccessibleAttributeSet *
1087 AccessibleText_getDefaultAttributeSet (AccessibleText *obj);
1088
1089 /* AccessibleValue Function Prototypes:  */
1090
1091 void       AccessibleValue_ref             (AccessibleValue *obj);
1092 void       AccessibleValue_unref           (AccessibleValue *obj);
1093 double     AccessibleValue_getMinimumValue (AccessibleValue *obj);
1094 double     AccessibleValue_getCurrentValue (AccessibleValue *obj);
1095 double     AccessibleValue_getMaximumValue (AccessibleValue *obj);
1096 SPIBoolean AccessibleValue_setCurrentValue (AccessibleValue *obj,
1097                                             double           newValue);
1098 double     AccessibleValue_getMinimumIncrement (AccessibleValue *obj);
1099
1100 /* Persistance and lifecycle control for AccessibleEvents. */
1101 SPIBoolean AccessibleEvent_ref (const AccessibleEvent *e);
1102 void AccessibleEvent_unref (const AccessibleEvent *e);
1103
1104 /*
1105  * Prototypes for accessor functions, to obtain context
1106  * information for accessible events.
1107  */
1108
1109 char*                  AccessibleEvent_getSourceName (const AccessibleEvent *e);
1110 AccessibleRole         AccessibleEvent_getSourceRole (const AccessibleEvent *e);
1111 AccessibleApplication* AccessibleEvent_getSourceApplication (const AccessibleEvent *e);
1112 SPIBoolean             AccessibleEvent_getSourceDetails (const AccessibleEvent *e, char **name, 
1113                                                          AccessibleRole *role, 
1114                                                          AccessibleApplication **app);
1115
1116 char*        AccessibleTextChangedEvent_getChangeString (const AccessibleEvent *e);
1117 Accessible * AccessibleChildChangedEvent_getChildAccessible (const AccessibleEvent *e);
1118
1119 Accessible * AccessibleParentChangedEvent_getParentAccessible (const AccessibleEvent *e);
1120
1121 char*        AccessibleTextSelectionChangedEvent_getSelectionString (const AccessibleEvent *e);
1122
1123 char*        AccessibleWindowEvent_getTitleString (const AccessibleEvent *e);
1124
1125 Accessible * AccessibleActiveDescendantChangedEvent_getActiveDescendant (const AccessibleEvent *e);
1126
1127 Accessible * AccessibleTableSummaryChangedEvent_getSummaryAccessible (const AccessibleEvent *e); 
1128
1129 Accessible * AccessibleTableHeaderChangedEvent_getHeaderAccessible (const AccessibleEvent *e);
1130
1131 char *       AccessibleTableCaptionChangedEvent_getCaptionString (const AccessibleEvent *e);
1132
1133 char *       AccessibleTableRowDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e);
1134
1135 char *       AccessibleTableColumnDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e);
1136
1137 char *       AccessibleDescriptionChangedEvent_getDescriptionString (const AccessibleEvent *e);
1138
1139 char *       AccessibleNameChangedEvent_getNameString (const AccessibleEvent *e);
1140 SPIRect *    AccessibleBoundsChangedEvent_getNewBounds (const AccessibleEvent *e);
1141
1142 /* Misc methods and error handling */
1143 void SPI_freeString (char *s);
1144
1145 char* SPI_dupString (char *s);
1146
1147 void SPI_freeRect (SPIRect *r);
1148
1149 SPIBoolean SPI_exceptionHandlerPush (SPIExceptionHandler *handler);
1150
1151 SPIExceptionHandler* SPI_exceptionHandlerPop (void);
1152
1153 SPIExceptionType SPIException_getSourceType (SPIException *err);
1154
1155 SPIExceptionCode SPIException_getExceptionCode (SPIException *err);
1156
1157 Accessible* SPIAccessibleException_getSource (SPIException *err);
1158
1159 char* SPIException_getDescription (SPIException *err);
1160
1161 #ifdef  __cplusplus
1162 }
1163 #endif
1164
1165 #endif