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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
|
#ifndef _SPI_H
#define _SPI_H
#include <cspi/spi-impl.h>
/*
* Definitions for AccessibleRole, AccessibleState,
* AccessibleEvent, and event listeners.
*/
#include <cspi/spi-roletypes.h>
#include <cspi/spi-statetypes.h>
#include <cspi/spi-listener.h>
/*
* Auxiliary typedefs and mask definitions
*/
#include <libspi/keymasks.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Enumerated type for text boundary types
*/
typedef enum
{
SPI_TEXT_BOUNDARY_CHAR,
SPI_TEXT_BOUNDARY_CURSOR_POS,
SPI_TEXT_BOUNDARY_WORD_START,
SPI_TEXT_BOUNDARY_WORD_END,
SPI_TEXT_BOUNDARY_SENTENCE_START,
SPI_TEXT_BOUNDARY_SENTENCE_END,
SPI_TEXT_BOUNDARY_LINE_START,
SPI_TEXT_BOUNDARY_LINE_END,
SPI_TEXT_BOUNDARY_ATTRIBUTE_RANGE
} AccessibleTextBoundaryType;
/*
*
* Enumerated type for relation types
*
*/
typedef enum
{
SPI_RELATION_LABEL_FOR,
SPI_RELATION_LABELED_BY,
SPI_RELATION_CONTROLLER_FOR,
SPI_RELATION_CONTROLLED_BY,
SPI_RELATION_MEMBER_OF
} AccessibleRelationType;
/* don't change the order of these ! */
typedef enum {
SPI_COORD_TYPE_SCREEN,
SPI_COORD_TYPE_WINDOW
} AccessibleCoordType;
typedef enum {
SPI_KEY_PRESS,
SPI_KEY_RELEASE,
SPI_KEY_PRESSRELEASE,
SPI_KEY_SYM
} AccessibleKeySynthType;
typedef enum {
SPI_KEYLISTENER_NOSYNC = 0,
SPI_KEYLISTENER_SYNCHRONOUS = 1,
SPI_KEYLISTENER_CANCONSUME = 2,
SPI_KEYLISTENER_ALL_WINDOWS = 4
} AccessibleKeyListenerSyncType;
typedef unsigned long AccessibleKeyEventMask;
/**
* AccessibleComponentLayer:
* @SPI_LAYER_INVALID: The layer cannot be determined or is somehow undefined.
* @SPI_LAYER_BACKGROUND: Component belongs to the destop background.
* @SPI_LAYER_CANVAS: Component is a canvas backdrop or drawing area.
* @SPI_LAYER_WIDGET: Component is a 'normal' widget.
* @SPI_LAYER_MDI: Component is drawn in the MDI layer and may have valid
* Z-information relative to other MDI-layer components.
* @SPI_LAYER_POPUP: Component is in the popup layer, above other widgets and
* MDI components.
* @SPI_LAYER_OVERLAY: Component is in the overlay plane - this value is reserved
* for future use.
* @SPI_LAYER_LAST_DEFINED: Used to determine the last valid value in the enum,
* should not be encountered.
**/
typedef enum {
SPI_LAYER_INVALID,
SPI_LAYER_BACKGROUND,
SPI_LAYER_CANVAS,
SPI_LAYER_WIDGET,
SPI_LAYER_MDI,
SPI_LAYER_POPUP,
SPI_LAYER_OVERLAY,
SPI_LAYER_LAST_DEFINED
} AccessibleComponentLayer;
/**
* AccessibleKeySet:
* @keysyms:
* @keycodes:
* @len:
*
* Structure containing identifying information about a set of keycode or
* keysyms.
**/
typedef struct _AccessibleKeySet
{
unsigned long *keysyms;
unsigned short *keycodes;
char **keystrings;
short len;
} AccessibleKeySet;
/**
* SPI_KEYSET_ALL_KEYS:
* @SPI_KEYSET_ALL_KEYS: A special value for an AccessibleKeySet type, which tacitly
* includes all keycodes and keyvals for the specified modifier set.
**/
#define SPI_KEYSET_ALL_KEYS NULL
typedef unsigned long AccessibleKeyMaskType;
/* Basic SPI initialization and event loop function prototypes */
int SPI_init (void);
void SPI_event_main (void);
void SPI_event_quit (void);
SPIBoolean SPI_eventIsReady (void);
AccessibleEvent *SPI_nextEvent (SPIBoolean waitForEvent);
int SPI_exit (void);
/* Event Listener creation and support. */
void SPI_freeAccessibleKeySet (
AccessibleKeySet *keyset);
AccessibleKeySet * SPI_createAccessibleKeySet (
int len,
const char *keysyms,
short *keycodes,
const char **keystrings);
AccessibleEventListener * SPI_createAccessibleEventListener (
AccessibleEventListenerCB callback,
void *user_data);
SPIBoolean AccessibleEventListener_addCallback (
AccessibleEventListener *listener,
AccessibleEventListenerCB callback,
void *user_data);
SPIBoolean AccessibleEventListener_removeCallback (
AccessibleEventListener *listener,
AccessibleEventListenerCB callback);
void AccessibleEventListener_unref (
AccessibleEventListener *listener);
/* Keystroke Listener creation and support. */
AccessibleKeystrokeListener * SPI_createAccessibleKeystrokeListener (
AccessibleKeystrokeListenerCB callback,
void *user_data);
SPIBoolean AccessibleKeystrokeListener_addCallback (
AccessibleKeystrokeListener *listener,
AccessibleKeystrokeListenerCB callback,
void *user_data);
SPIBoolean AccessibleKeystrokeListener_removeCallback (
AccessibleKeystrokeListener *listener,
AccessibleKeystrokeListenerCB callback);
void AccessibleKeystrokeListener_unref (
AccessibleKeystrokeListener *listener);
/* Global functions serviced by the registry */
SPIBoolean SPI_registerGlobalEventListener (
AccessibleEventListener *listener,
const char *eventType);
SPIBoolean SPI_deregisterGlobalEventListener (
AccessibleEventListener *listener,
const char *eventType);
SPIBoolean SPI_deregisterGlobalEventListenerAll (
AccessibleEventListener *listener);
SPIBoolean SPI_registerAccessibleKeystrokeListener (
AccessibleKeystrokeListener *listener,
AccessibleKeySet *keys,
AccessibleKeyMaskType modmask,
AccessibleKeyEventMask eventmask,
AccessibleKeyListenerSyncType sync_type);
SPIBoolean SPI_deregisterAccessibleKeystrokeListener (
AccessibleKeystrokeListener *listener,
AccessibleKeyMaskType modmask);
int SPI_getDesktopCount (void);
Accessible *SPI_getDesktop (int i);
int SPI_getDesktopList (Accessible **list);
SPIBoolean SPI_generateKeyEvent (long int keyval,
AccessibleKeySynthType synth_type);
SPIBoolean SPI_generateMouseEvent (long int x, long int y, char *name);
/* Accessible function prototypes */
void Accessible_ref (Accessible *obj);
void Accessible_unref (Accessible *obj);
char * Accessible_getName (Accessible *obj);
char * Accessible_getDescription (Accessible *obj);
Accessible * Accessible_getParent (Accessible *obj);
long Accessible_getChildCount (Accessible *obj);
Accessible * Accessible_getChildAtIndex (Accessible *obj,
long int childIndex);
long Accessible_getIndexInParent (Accessible *obj);
AccessibleRelation **Accessible_getRelationSet (Accessible *obj);
AccessibleRole Accessible_getRole (Accessible *obj);
char * Accessible_getRoleName (Accessible *obj);
AccessibleStateSet * Accessible_getStateSet (Accessible *obj);
/* Interface query methods */
SPIBoolean Accessible_isAction (Accessible *obj);
SPIBoolean Accessible_isApplication (Accessible *obj);
SPIBoolean Accessible_isComponent (Accessible *obj);
SPIBoolean Accessible_isEditableText (Accessible *obj);
SPIBoolean Accessible_isHypertext (Accessible *obj);
SPIBoolean Accessible_isImage (Accessible *obj);
SPIBoolean Accessible_isSelection (Accessible *obj);
SPIBoolean Accessible_isTable (Accessible *obj);
SPIBoolean Accessible_isText (Accessible *obj);
SPIBoolean Accessible_isValue (Accessible *obj);
AccessibleAction * Accessible_getAction (Accessible *obj);
AccessibleApplication * Accessible_getApplication (Accessible *obj);
AccessibleComponent * Accessible_getComponent (Accessible *obj);
AccessibleEditableText * Accessible_getEditableText (Accessible *obj);
AccessibleHypertext * Accessible_getHypertext (Accessible *obj);
AccessibleImage * Accessible_getImage (Accessible *obj);
AccessibleSelection * Accessible_getSelection (Accessible *obj);
AccessibleTable * Accessible_getTable (Accessible *obj);
AccessibleText * Accessible_getText (Accessible *obj);
AccessibleValue * Accessible_getValue (Accessible *obj);
AccessibleUnknown * Accessible_queryInterface (Accessible *obj,
const char *interface_name);
/* AccessibleAction function prototypes */
void AccessibleAction_ref (AccessibleAction *obj);
void AccessibleAction_unref (AccessibleAction *obj);
long AccessibleAction_getNActions (AccessibleAction *obj);
char *AccessibleAction_getName (AccessibleAction *obj,
long int i);
char *AccessibleAction_getDescription (AccessibleAction *obj,
long int i);
SPIBoolean AccessibleAction_doAction (AccessibleAction *obj,
long int i);
char *AccessibleAction_getKeyBinding (AccessibleAction *obj,
long int i);
/* AccessibleApplication function prototypes */
void AccessibleApplication_ref (AccessibleApplication *obj);
void AccessibleApplication_unref (AccessibleApplication *obj);
char *AccessibleApplication_getToolkitName (AccessibleApplication *obj);
char *AccessibleApplication_getVersion (AccessibleApplication *obj);
long AccessibleApplication_getID (AccessibleApplication *obj);
SPIBoolean AccessibleApplication_pause (AccessibleApplication *obj);
SPIBoolean AccessibleApplication_resume (AccessibleApplication *obj);
/* AccessibleComponent function prototypes */
void AccessibleComponent_ref (AccessibleComponent *obj);
void AccessibleComponent_unref (AccessibleComponent *obj);
SPIBoolean AccessibleComponent_contains (AccessibleComponent *obj,
long int x,
long int y,
AccessibleCoordType ctype);
Accessible *AccessibleComponent_getAccessibleAtPoint (
AccessibleComponent *obj,
long int x,
long int y,
AccessibleCoordType ctype);
void AccessibleComponent_getExtents (AccessibleComponent *obj,
long int *x,
long int *y,
long int *width,
long int *height,
AccessibleCoordType ctype);
void AccessibleComponent_getPosition (AccessibleComponent *obj,
long int *x,
long int *y,
AccessibleCoordType ctype);
void AccessibleComponent_getSize (AccessibleComponent *obj,
long int *width,
long int *height);
AccessibleComponentLayer
AccessibleComponent_getLayer (AccessibleComponent *obj);
void AccessibleComponent_grabFocus (AccessibleComponent *obj);
short AccessibleComponent_getMDIZOrder(AccessibleComponent *obj);
/* AccessibleEditableText function prototypes */
void
AccessibleEditableText_ref (AccessibleEditableText *obj);
void
AccessibleEditableText_unref (AccessibleEditableText *obj);
SPIBoolean
AccessibleEditableText_setAttributes (AccessibleEditableText *obj,
const char *attributes,
long int startOffset,
long int endOffset);
SPIBoolean
AccessibleEditableText_setTextContents (AccessibleEditableText *obj,
const char *newContents);
SPIBoolean
AccessibleEditableText_insertText (AccessibleEditableText *obj,
long int position,
const char *text,
long int length);
SPIBoolean
AccessibleEditableText_copyText (AccessibleText *obj,
long int startPos,
long int endPos);
SPIBoolean
AccessibleEditableText_cutText (AccessibleEditableText *obj,
long int startPos,
long int endPos);
SPIBoolean
AccessibleEditableText_deleteText (AccessibleEditableText *obj,
long int startPos,
long int endPos);
SPIBoolean
AccessibleEditableText_pasteText (AccessibleEditableText *obj,
long int position);
/*
*
* AccessibleHyperlink function prototypes
*
*/
void
AccessibleHyperlink_ref (AccessibleHyperlink *obj);
void
AccessibleHyperlink_unref (AccessibleHyperlink *obj);
long
AccessibleHyperlink_getNAnchors (AccessibleHyperlink *obj);
char *
AccessibleHyperlink_getURI (AccessibleHyperlink *obj,
long int i);
Accessible *
AccessibleHyperlink_getObject (AccessibleHyperlink *obj,
long int i);
void
AccessibleHyperlink_getIndexRange (AccessibleHyperlink *obj,
long int *startIndex,
long int *endIndex);
SPIBoolean
AccessibleHyperlink_isValid (AccessibleHyperlink *obj);
/*
*
* AccessibleHypertext function prototypes
*
*/
void
AccessibleHypertext_ref (AccessibleHypertext *obj);
void
AccessibleHypertext_unref (AccessibleHypertext *obj);
long
AccessibleHypertext_getNLinks (AccessibleHypertext *obj);
AccessibleHyperlink *
AccessibleHypertext_getLink (AccessibleHypertext *obj,
long int linkIndex);
long
AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
long int characterOffset);
/*
*
* AccessibleImage function prototypes
*
*/
void
AccessibleImage_ref (AccessibleImage *obj);
void
AccessibleImage_unref (AccessibleImage *obj);
char *
AccessibleImage_getImageDescription (AccessibleImage *obj);
void
AccessibleImage_getImageSize (AccessibleImage *obj,
long int *width,
long int *height);
void
AccessibleImage_getImagePosition (AccessibleImage *obj,
long int *x,
long int *y,
AccessibleCoordType ctype);
void
AccessibleImage_getImageExtents (AccessibleImage *obj,
long int *x,
long int *y,
long int *width,
long int *height,
AccessibleCoordType ctype);
/*
*
* AccessibleRelation function prototypes
*
*/
void AccessibleRelation_ref (AccessibleRelation *obj);
void AccessibleRelation_unref (AccessibleRelation *obj);
AccessibleRelationType
AccessibleRelation_getRelationType (AccessibleRelation *obj);
int
AccessibleRelation_getNTargets (AccessibleRelation *obj);
Accessible *
AccessibleRelation_getTarget (AccessibleRelation *obj, int i);
/*
*
* AccessibleSelection function prototypes
*
*/
void AccessibleSelection_ref (AccessibleSelection *obj);
void AccessibleSelection_unref (AccessibleSelection *obj);
long
AccessibleSelection_getNSelectedChildren (AccessibleSelection *obj);
Accessible *
AccessibleSelection_getSelectedChild (AccessibleSelection *obj,
long int selectedChildIndex);
SPIBoolean
AccessibleSelection_selectChild (AccessibleSelection *obj,
long int childIndex);
SPIBoolean
AccessibleSelection_deselectSelectedChild (AccessibleSelection *obj,
long int selectedChildIndex);
SPIBoolean
AccessibleSelection_isChildSelected (AccessibleSelection *obj,
long int childIndex);
SPIBoolean
AccessibleSelection_selectAll (AccessibleSelection *obj);
void
AccessibleSelection_clearSelection (AccessibleSelection *obj);
/*
*
* AccessibleStateSet function prototypes
*
*/
void AccessibleStateSet_ref (AccessibleStateSet *obj);
void AccessibleStateSet_unref (AccessibleStateSet *obj);
SPIBoolean
AccessibleStateSet_contains (AccessibleStateSet *obj,
AccessibleState state);
void
AccessibleStateSet_add (AccessibleStateSet *obj,
AccessibleState state);
void
AccessibleStateSet_remove (AccessibleStateSet *obj,
AccessibleState state);
SPIBoolean
AccessibleStateSet_equals (AccessibleStateSet *obj,
AccessibleStateSet *obj2);
AccessibleStateSet *
AccessibleStateSet_compare (AccessibleStateSet *obj,
AccessibleStateSet *obj2);
SPIBoolean
AccessibleStateSet_isEmpty (AccessibleStateSet *obj);
/*
*
* AccessibleTable function prototypes
*
*/
void AccessibleTable_ref (AccessibleTable *obj);
void AccessibleTable_unref (AccessibleTable *obj);
Accessible *
AccessibleTable_getCaption (AccessibleTable *obj);
Accessible *
AccessibleTable_getSummary (AccessibleTable *obj);
long
AccessibleTable_getNRows (AccessibleTable *obj);
long
AccessibleTable_getNColumns (AccessibleTable *obj);
Accessible *
AccessibleTable_getAccessibleAt (AccessibleTable *obj,
long int row,
long int column);
long
AccessibleTable_getIndexAt (AccessibleTable *obj,
long int row,
long int column);
long
AccessibleTable_getRowAtIndex (AccessibleTable *obj,
long int index);
long
AccessibleTable_getColumnAtIndex (AccessibleTable *obj,
long int index);
char *
AccessibleTable_getRowDescription (AccessibleTable *obj,
long int row);
char *
AccessibleTable_getColumnDescription (AccessibleTable *obj,
long int column);
long
AccessibleTable_getRowExtentAt (AccessibleTable *obj,
long int row,
long int column);
long
AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
long int row,
long int column);
Accessible *
AccessibleTable_getRowHeader (AccessibleTable *obj,
long int row);
Accessible *
AccessibleTable_getColumnHeader (AccessibleTable *obj,
long int column);
long
AccessibleTable_getNSelectedRows (AccessibleTable *obj);
long
AccessibleTable_getSelectedRows (AccessibleTable *obj,
long int **selectedRows);
long
AccessibleTable_getNSelectedColumns (AccessibleTable *obj);
long
AccessibleTable_getSelectedColumns (AccessibleTable *obj,
long int **selectedColumns);
SPIBoolean
AccessibleTable_isRowSelected (AccessibleTable *obj,
long int row);
SPIBoolean
AccessibleTable_isColumnSelected (AccessibleTable *obj,
long int column);
SPIBoolean
AccessibleTable_isSelected (AccessibleTable *obj,
long int row,
long int column);
/*
*
* AccessibleText function prototypes
*
*/
void AccessibleText_ref (AccessibleText *obj);
void AccessibleText_unref (AccessibleText *obj);
long
AccessibleText_getCharacterCount (AccessibleText *obj);
char *
AccessibleText_getText (AccessibleText *obj,
long int startOffset,
long int endOffset);
long
AccessibleText_getCaretOffset (AccessibleText *obj);
char *
AccessibleText_getAttributes (AccessibleText *obj,
long int offset,
long int *startOffset,
long int *endOffset);
SPIBoolean
AccessibleText_setCaretOffset (AccessibleText *obj,
long int newOffset);
char *
AccessibleText_getTextBeforeOffset (AccessibleText *obj,
long int offset,
AccessibleTextBoundaryType type,
long int *startOffset,
long int *endOffset);
char *
AccessibleText_getTextAtOffset (AccessibleText *obj,
long int offset,
AccessibleTextBoundaryType type,
long int *startOffset,
long int *endOffset);
char *
AccessibleText_getTextAfterOffset (AccessibleText *obj,
long int offset,
AccessibleTextBoundaryType type,
long int *startOffset,
long int *endOffset);
unsigned long
AccessibleText_getCharacterAtOffset (AccessibleText *obj,
long int offset);
void
AccessibleText_getCharacterExtents (AccessibleText *obj,
long int offset,
long int *x,
long int *y,
long int *width,
long int *height,
AccessibleCoordType type);
long
AccessibleText_getOffsetAtPoint (AccessibleText *obj,
long int x,
long int y,
AccessibleCoordType type);
long
AccessibleText_getNSelections (AccessibleText *obj);
void
AccessibleText_getSelection (AccessibleText *obj,
long int selectionNum,
long int *startOffset,
long int *endOffset);
SPIBoolean
AccessibleText_addSelection (AccessibleText *obj,
long int startOffset,
long int endOffset);
SPIBoolean
AccessibleText_removeSelection (AccessibleText *obj,
long int selectionNum);
SPIBoolean
AccessibleText_setSelection (AccessibleText *obj,
long int selectionNum,
long int startOffset,
long int endOffset);
/* AccessibleValue Function Prototypes: */
void AccessibleValue_ref (AccessibleValue *obj);
void AccessibleValue_unref (AccessibleValue *obj);
double AccessibleValue_getMinimumValue (AccessibleValue *obj);
double AccessibleValue_getCurrentValue (AccessibleValue *obj);
double AccessibleValue_getMaximumValue (AccessibleValue *obj);
SPIBoolean AccessibleValue_setCurrentValue (AccessibleValue *obj,
double newValue);
/* Misc methods */
void SPI_freeString (char *s);
#ifdef __cplusplus
}
#endif
#endif
|