Added methods for Component Layer and MDI Z-Order information (see
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_accessible.c
1 #include <stdlib.h> /* for malloc */
2 #include <cspi/spi-private.h>
3
4 #define MAX_ROLES 100
5
6 static char *role_names [MAX_ROLES] =
7 {
8   " ",
9   "accelerator label",
10   "alert",
11   "animation",
12   "arrow",
13   "calendar",
14   "canvas",
15   "check box",
16   "menu item",
17   "color chooser",
18   "column header",
19   "combo box",
20   "date editor",
21   "desktop icon",
22   "desktop frame",
23   "dial",
24   "dialog",
25   "directory pane",
26   "drawing area",
27   "file chooser",
28   "filler",
29   "font chooser",
30   "frame",
31   "glass pane",
32   "HTML container",
33   "icon",
34   "image",
35   "internal frame",
36   "label",
37   "layered pane",
38   "list",
39   "list item",
40   "menu",
41   "menubar",
42   "menu item",
43   "option pane",
44   "page tab",
45   "page tab list",
46   "panel",
47   "password text",
48   "popup menu",
49   "progress bar",
50   "pushbutton",
51   "radiobutton",
52   "radio menu item",
53   "root pane",
54   "row header",
55   "scrollbar",
56   "scrollpane",
57   "separator",
58   "slider",
59   "split pane",
60   "spin button",
61   "status bar",
62   "table",
63   "table cell",
64   "table column header",
65   "table row header",
66   "tearoff menu item",
67   "text",
68   "toggle button",
69   "toolbar",
70   "tooltip",
71   "tree",
72   " ",
73   "viewport",
74   "window",
75 };
76
77 /**
78  * AccessibleRole_getName:
79  * @role: an #AccessibleRole object to query.
80  *
81  * Get a localizeable string that indicates the name of an #AccessibleRole.
82  *
83  * Returns: a localizable string name for an #AccessibleRole enumerated type.
84  **/
85 char*
86 AccessibleRole_getName (AccessibleRole role)
87 {
88   /*
89    * TODO: replace with implementation linked to ATK, which
90    *  now supports Role/Name mapping
91    */
92         
93   if (role < MAX_ROLES) return role_names [(int) role];
94   else return "";
95 }
96
97 /**
98  * Accessible_ref:
99  * @obj: a pointer to the #Accessible object on which to operate.
100  *
101  * Increment the reference count for an #Accessible object.
102  *
103  * Returns: (no return code implemented yet).
104  *
105  **/
106 int
107 Accessible_ref (Accessible *obj)
108 {
109   cspi_object_ref (obj);
110   return 0;
111 }
112
113 /**
114  * Accessible_unref:
115  * @obj: a pointer to the #Accessible object on which to operate.
116  *
117  * Decrement the reference count for an #Accessible object.
118  *
119  * Returns: (no return code implemented yet).
120  *
121  **/
122 int
123 Accessible_unref (Accessible *obj)
124 {
125   cspi_object_unref (obj);
126   return 0;
127 }
128
129 /**
130  * Accessible_getName:
131  * @obj: a pointer to the #Accessible object on which to operate.
132  *
133  * Get the name of an #Accessible object.
134  *
135  * Returns: a UTF-8 string indicating the name of the #Accessible object.
136  *
137  **/
138 char *
139 Accessible_getName (Accessible *obj)
140 {
141   char *retval = 
142     (char *)
143     Accessibility_Accessible__get_name (CSPI_OBJREF (obj), cspi_ev ());
144   cspi_check_ev (cspi_ev (), "getName"); 
145   return retval;
146 }
147
148 /**
149  * Accessible_getDescription:
150  * @obj: a pointer to the #Accessible object on which to operate.
151  *
152  * Get the description of an #Accessible object.
153  *
154  * Returns: a UTF-8 string describing the #Accessible object.
155  *
156  **/
157 char *
158 Accessible_getDescription (Accessible *obj)
159 {
160   char *retval = (char *)
161     Accessibility_Accessible__get_description (CSPI_OBJREF (obj), cspi_ev ());
162   cspi_check_ev (cspi_ev (), "getDescription");
163   return retval;
164 }
165
166 /**
167  * Accessible_getParent:
168  * @obj: a pointer to the #Accessible object to query.
169  *
170  * Get an #Accessible object's parent container.
171  *
172  * Returns: a pointer tothe #Accessible object which contains the given
173  *          #Accessible instance, or NULL if the @obj has no parent container.
174  *
175  **/
176 Accessible *
177 Accessible_getParent (Accessible *obj)
178 {
179   Accessible *retval = 
180       cspi_object_add (Accessibility_Accessible__get_parent (CSPI_OBJREF (obj), cspi_ev ()));
181   cspi_check_ev (cspi_ev (), "getParent");
182   return retval;
183 }
184
185 /**
186  * Accessible_getChildCount:
187  * @obj: a pointer to the #Accessible object on which to operate.
188  *
189  * Get the number of children contained by an #Accessible object.
190  *
191  * Returns: a #long indicating the number of #Accessible children
192  *          contained by an #Accessible object.
193  *
194  **/
195 long
196 Accessible_getChildCount (Accessible *obj)
197 {
198   long retval = (long) Accessibility_Accessible__get_childCount (CSPI_OBJREF (obj), cspi_ev ());
199   cspi_check_ev (cspi_ev (), "getChildCount");
200   return retval;
201 }
202
203 /**
204  * Accessible_getChildAtIndex:
205  * @obj: a pointer to the #Accessible object on which to operate.
206  * @childIndex: a #long indicating which child is specified.
207  *
208  * Get the #Accessible child of an #Accessible object at a given index.
209  *
210  * Returns: a pointer to the #Accessible child object at index
211  *          @childIndex.
212  *
213  **/
214 Accessible *
215 Accessible_getChildAtIndex (Accessible *obj,
216                             long int childIndex)
217 {
218   Accessible *retval = cspi_object_add (Accessibility_Accessible_getChildAtIndex (CSPI_OBJREF (obj), childIndex, cspi_ev ()));
219   cspi_check_ev (cspi_ev (), "getChildAtIndex");
220   return retval;
221 }
222
223 /**
224  * Accessible_getIndexInParent:
225  * @obj: a pointer to the #Accessible object on which to operate.
226  *
227  * Get the index of an #Accessible object in its containing #Accessible.
228  *
229  * Returns: a #long indicating the index of the #Accessible object
230  *          in its parent (i.e. containing) #Accessible instance,
231  *          or -1 if @obj has no containing parent.
232  *
233  **/
234 long
235 Accessible_getIndexInParent (Accessible *obj)
236 {
237   long retval = (long) Accessibility_Accessible_getIndexInParent (CSPI_OBJREF (obj), cspi_ev ());
238   cspi_check_ev (cspi_ev (), "getIndexInParent");
239   return retval;
240 }
241
242 /**
243  * Accessible_getRelationSet:
244  * @obj: a pointer to the #Accessible object on which to operate.
245  *
246  * Get the set of #AccessibleRelation objects which describe this #Accessible object's
247  *       relationships with other #Accessible objects.
248  *
249  * Returns: an array of #AccessibleRelation pointers.
250  *
251  **/
252 AccessibleRelation **
253 Accessible_getRelationSet (Accessible *obj)
254 {
255   AccessibleRelation **relations;
256   int n_relations;
257   int i;
258   Accessibility_RelationSet *relation_set =     
259           Accessibility_Accessible_getRelationSet (CSPI_OBJREF (obj), cspi_ev ());
260   
261   /* this looks hack-ish, but it's based on the CORBA C bindings spec */
262   n_relations = relation_set->_length;
263   relations = malloc (sizeof (AccessibleRelation *) * n_relations);
264   
265   for (i=0; i<n_relations; ++i)
266     {
267       relations[i] = cspi_object_add (relation_set->_buffer[i]);
268     }
269   relations[i] = CORBA_OBJECT_NIL;
270
271   return relations;
272 }
273
274 /**
275  * Accessible_getRole:
276  * @obj: a pointer to the #Accessible object on which to operate.
277  *
278  * Get the UI role of an #Accessible object.
279  *
280  * Returns: a UTF-8 string indicating the UI role of the #Accessible object.
281  *
282  **/
283 char *
284 Accessible_getRole (Accessible *obj)
285 {
286   char *retval = AccessibleRole_getName (
287                   Accessibility_Accessible_getRole (CSPI_OBJREF (obj), cspi_ev ()));
288   cspi_check_ev (cspi_ev (), "getRole");
289   return retval;
290 }
291
292 /**
293  * Accessible_getStateSet:
294  * @obj: a pointer to the #Accessible object on which to operate.
295  *
296  * Not Yet Implemented.
297  *
298  * Returns: a pointer to an #AccessibleStateSet representing the object's current state.
299  **/
300 AccessibleStateSet *
301 Accessible_getStateSet (Accessible *obj)
302 {
303   return NULL;
304 }
305
306 /* Interface query methods */
307
308 static SPIBoolean
309 cspi_accessible_is_a (Accessible *obj,
310                      const char *interface_name)
311 {
312   SPIBoolean        retval;
313   Bonobo_Unknown unknown;
314
315   unknown = Bonobo_Unknown_queryInterface (CSPI_OBJREF (obj),
316                                            interface_name, cspi_ev ());
317
318   if (BONOBO_EX (cspi_ev ()))
319     {
320       g_error ("Exception '%s' checking if is '%s'",
321                bonobo_exception_get_text (cspi_ev ()),
322                interface_name);
323     }
324
325   if (unknown != CORBA_OBJECT_NIL)
326     {
327       retval = TRUE;
328       bonobo_object_release_unref (unknown, NULL);
329     }
330   else
331     {
332       retval= FALSE;
333     }
334
335   return retval;
336 }
337
338 /**
339  * Accessible_isAction:
340  * @obj: a pointer to the #Accessible instance to query.
341  *
342  * Query whether the specified #Accessible implements #AccessibleAction.
343  *
344  * Returns: #TRUE if @obj implements the #AccessibleAction interface,
345  *          #FALSE otherwise.
346  **/
347 SPIBoolean
348 Accessible_isAction (Accessible *obj)
349 {
350   return cspi_accessible_is_a (obj,
351                               "IDL:Accessibility/Action:1.0");
352 }
353
354 /**
355  * Accessible_isComponent:
356  * @obj: a pointer to the #Accessible instance to query.
357  *
358  * Query whether the specified #Accessible implements #AccessibleComponent.
359  *
360  * Returns: #TRUE if @obj implements the #AccessibleComponent interface,
361  *          #FALSE otherwise.
362  **/
363 SPIBoolean
364 Accessible_isComponent (Accessible *obj)
365 {
366   return cspi_accessible_is_a (obj,
367                               "IDL:Accessibility/Component:1.0");
368 }
369
370 /**
371  * Accessible_isEditableText:
372  * @obj: a pointer to the #Accessible instance to query.
373  *
374  * Query whether the specified #Accessible implements #AccessibleEditableText.
375  *
376  * Returns: #TRUE if @obj implements the #AccessibleEditableText interface,
377  *          #FALSE otherwise.
378  **/
379 SPIBoolean
380 Accessible_isEditableText (Accessible *obj)
381 {
382   return cspi_accessible_is_a (obj,
383                               "IDL:Accessibility/EditableText:1.0");
384 }
385
386 /**
387  * Accessible_isHypertext:
388  * @obj: a pointer to the #Accessible instance to query.
389  *
390  * Query whether the specified #Accessible implements #AccessibleHypertext.
391  *
392  * Returns: #TRUE if @obj implements the #AccessibleHypertext interface,
393  *          #FALSE otherwise.
394  **/
395 SPIBoolean
396 Accessible_isHypertext (Accessible *obj)
397 {
398   return cspi_accessible_is_a (obj,
399                               "IDL:Accessibility/Hypertext:1.0");
400 }
401
402 /**
403  * Accessible_isImage:
404  * @obj: a pointer to the #Accessible instance to query.
405  *
406  * Query whether the specified #Accessible implements #AccessibleImage.
407  *
408  * Returns: #TRUE if @obj implements the #AccessibleImage interface,
409  *          #FALSE otherwise.
410 **/
411 SPIBoolean
412 Accessible_isImage (Accessible *obj)
413 {
414   return cspi_accessible_is_a (obj,
415                               "IDL:Accessibility/Image:1.0");
416 }
417
418 /**
419  * Accessible_isSelection:
420  * @obj: a pointer to the #Accessible instance to query.
421  *
422  * Query whether the specified #Accessible implements #AccessibleSelection.
423  *
424  * Returns: #TRUE if @obj implements the #AccessibleSelection interface,
425  *          #FALSE otherwise.
426 **/
427 SPIBoolean
428 Accessible_isSelection (Accessible *obj)
429 {
430   return cspi_accessible_is_a (obj,
431                               "IDL:Accessibility/Selection:1.0");
432 }
433
434 /**
435  * Accessible_isTable:
436  * @obj: a pointer to the #Accessible instance to query.
437  *
438  * Query whether the specified #Accessible implements #AccessibleTable.
439  *
440  * Returns: #TRUE if @obj implements the #AccessibleTable interface,
441  *          #FALSE otherwise.
442 **/
443 SPIBoolean
444 Accessible_isTable (Accessible *obj)
445 {
446   return cspi_accessible_is_a (obj,
447                               "IDL:Accessibility/Table:1.0");
448 }
449
450 /**
451  * Accessible_isText:
452  * @obj: a pointer to the #Accessible instance to query.
453  *
454  * Query whether the specified #Accessible implements #AccessibleText.
455  *
456  * Returns: #TRUE if @obj implements the #AccessibleText interface,
457  *          #FALSE otherwise.
458 **/
459 SPIBoolean
460 Accessible_isText (Accessible *obj)
461 {
462   return cspi_accessible_is_a (obj,
463                               "IDL:Accessibility/Text:1.0");
464 }
465
466 /**
467  * Accessible_isValue:
468  * @obj: a pointer to the #Accessible instance to query.
469  *
470  * Query whether the specified #Accessible implements #AccessibleValue.
471  *
472  * Returns: #TRUE if @obj implements the #AccessibleValue interface,
473  *          #FALSE otherwise.
474 **/
475 SPIBoolean
476 Accessible_isValue (Accessible *obj)
477 {
478   return cspi_accessible_is_a (obj,
479                               "IDL:Accessibility/Value:1.0");
480 }
481
482 /**
483  * Accessible_getAction:
484  * @obj: a pointer to the #Accessible instance to query.
485  *
486  * Get the #AccessibleAction interface for an #Accessible.
487  *
488  * Returns: a pointer to an #AccessibleAction interface instance, or
489  *          NULL if @obj does not implement #AccessibleAction.
490  **/
491 AccessibleAction *
492 Accessible_getAction (Accessible *obj)
493 {
494   return (AccessibleAction *) Accessible_queryInterface (
495           obj, "IDL:Accessibility/Action:1.0");
496 }
497
498 /**
499  * Accessible_getComponent:
500  * @obj: a pointer to the #Accessible instance to query.
501  *
502  * Get the #AccessibleComponent interface for an #Accessible.
503  *
504  * Returns: a pointer to an #AccessibleComponent interface instance, or
505  *          NULL if @obj does not implement #AccessibleComponent.
506  **/
507 AccessibleComponent *
508 Accessible_getComponent (Accessible *obj)
509 {
510   return (AccessibleComponent *) Accessible_queryInterface (
511           obj, "IDL:Accessibility/Component:1.0");
512 }
513
514 /**
515  * Accessible_getEditableText:
516  * @obj: a pointer to the #Accessible instance to query.
517  *
518  * Get the #AccessibleEditableText interface for an #Accessible.
519  *
520  * Returns: a pointer to an #AccessibleEditableText interface instance, or
521  *          NULL if @obj does not implement #AccessibleEditableText.
522  **/
523 AccessibleEditableText *
524 Accessible_getEditableText (Accessible *obj)
525 {
526   return (AccessibleEditableText *) Accessible_queryInterface (
527           obj, "IDL:Accessibility/EditableText:1.0");
528 }
529
530
531
532 /**
533  * Accessible_getHypertext:
534  * @obj: a pointer to the #Accessible instance to query.
535  *
536  * Get the #AccessibleHypertext interface for an #Accessible.
537  *
538  * Returns: a pointer to an #AccessibleHypertext interface instance, or
539  *          NULL if @obj does not implement #AccessibleHypertext.
540  **/
541 AccessibleHypertext *
542 Accessible_getHypertext (Accessible *obj)
543 {
544   return (AccessibleHypertext *) Accessible_queryInterface (
545           obj, "IDL:Accessibility/Hypertext:1.0");
546 }
547
548
549
550 /**
551  * Accessible_getImage:
552  * @obj: a pointer to the #Accessible instance to query.
553  *
554  * Get the #AccessibleImage interface for an #Accessible.
555  *
556  * Returns: a pointer to an #AccessibleImage interface instance, or
557  *          NULL if @obj does not implement #AccessibleImage.
558  **/
559 AccessibleImage *
560 Accessible_getImage (Accessible *obj)
561 {
562   return (AccessibleImage *) Accessible_queryInterface (
563           obj, "IDL:Accessibility/Image:1.0");
564 }
565
566
567
568 /**
569  * Accessible_getSelection:
570  * @obj: a pointer to the #Accessible instance to query.
571  *
572  * Get the #AccessibleSelection interface for an #Accessible.
573  *
574  * Returns: a pointer to an #AccessibleSelection interface instance, or
575  *          NULL if @obj does not implement #AccessibleSelection.
576  **/
577 AccessibleSelection *
578 Accessible_getSelection (Accessible *obj)
579 {
580   return (AccessibleSelection *) Accessible_queryInterface (
581           obj, "IDL:Accessibility/Selection:1.0");
582 }
583
584
585
586 /**
587  * Accessible_getTable:
588  * @obj: a pointer to the #Accessible instance to query.
589  *
590  * Get the #AccessibleTable interface for an #Accessible.
591  *
592  * Returns: a pointer to an #AccessibleTable interface instance, or
593  *          NULL if @obj does not implement #AccessibleTable.
594  **/
595 AccessibleTable *
596 Accessible_getTable (Accessible *obj)
597 {
598   return (AccessibleTable *) Accessible_queryInterface (
599           obj, "IDL:Accessibility/Table:1.0");
600 }
601
602 /**
603  * Accessible_getText:
604  * @obj: a pointer to the #Accessible instance to query.
605  *
606  * Get the #AccessibleText interface for an #Accessible.
607  *
608  * Returns: a pointer to an #AccessibleText interface instance, or
609  *          NULL if @obj does not implement #AccessibleText.
610  **/
611 AccessibleText *
612 Accessible_getText (Accessible *obj)
613 {
614   return (AccessibleText *) Accessible_queryInterface (
615           obj, "IDL:Accessibility/Text:1.0");
616 }
617
618
619
620 /**
621  * Accessible_getValue:
622  * @obj: a pointer to the #Accessible instance to query.
623  *
624  * Get the #AccessibleValue interface for an #Accessible.
625  *
626  * Returns: a pointer to an #AccessibleValue interface instance, or
627  *          NULL if @obj does not implement #AccessibleValue.
628  **/
629 AccessibleValue *
630 Accessible_getValue (Accessible *obj)
631 {
632   return (AccessibleValue *) Accessible_queryInterface (
633           obj, "IDL:Accessibility/Value:1.0");
634 }
635
636
637
638 /**
639  * Accessible_queryInterface:
640  * @obj: a pointer to the #Accessible instance to query.
641  * @interface_name: a UTF-8 character string specifiying the requested interface.
642  *
643  * Query an #Accessible object to for a named interface.
644  *
645  * Returns: an instance of the named interface object, if it is implemented
646  *          by @obj, or NULL otherwise.
647  *
648  **/
649 GenericInterface *
650 Accessible_queryInterface (Accessible *obj, char *interface_name)
651 {
652   Bonobo_Unknown iface;
653
654   iface = Accessibility_Accessible_queryInterface (CSPI_OBJREF (obj),
655                                                    interface_name,
656                                                    cspi_ev ());
657
658   /*
659    * FIXME: we need to be fairly sure that references are going
660    * to mach up if we are going to expose QueryInterface, ie. we
661    * can't allow people to do:
662    * b = a.qi ("b"); b.unref, b.unref to release a's reference.
663    * this should be no real problem though for this level of API
664    * user.
665    */
666
667   return cspi_object_add (iface);
668 }
669
670
671 /**
672  * AccessibleRelation_ref:
673  * @obj: a pointer to the #AccessibleRelation object on which to operate.
674  *
675  * Increment the reference count for an #AccessibleRelation object.
676  *
677  * Returns: (no return code implemented yet).
678  *
679  **/
680 int
681 AccessibleRelation_ref (AccessibleRelation *obj)
682 {
683   cspi_object_ref (obj);
684   return 0;
685 }
686
687 /**
688  * AccessibleRelation_unref:
689  * @obj: a pointer to the #AccessibleRelation object on which to operate.
690  *
691  * Decrement the reference count for an #AccessibleRelation object.
692  *
693  * Returns: (no return code implemented yet).
694  *
695  **/
696 int
697 AccessibleRelation_unref (AccessibleRelation *obj)
698 {
699   cspi_object_unref (obj);
700   return 0;
701 }
702
703 /**
704  * AccessibleRelation_getRelationType:
705  * @obj: a pointer to the #AccessibleRelation object to query.
706  *
707  * Get the type of relationship represented by an #AccessibleRelation.
708  *
709  * Returns: an #AccessibleRelationType indicating the type of relation
710  *         encapsulated in this #AccessibleRelation object.
711  *
712  **/
713 AccessibleRelationType
714 AccessibleRelation_getRelationType (AccessibleRelation *obj)
715 {
716   return 0;
717 }
718
719 /**
720  * AccessibleRelation_getNTargets:
721  * @obj: a pointer to the #AccessibleRelation object to query.
722  *
723  * Get the number of objects which this relationship has as its
724  *       target objects (the subject is the #Accessible from which this
725  *       #AccessibleRelation originated).
726  *
727  * Returns: a short integer indicating how many target objects which the
728  *       originating #Accessible object has the #AccessibleRelation
729  *       relationship with.
730  **/
731 int
732 AccessibleRelation_getNTargets (AccessibleRelation *obj)
733 {
734   return 0;
735 }
736
737 /**
738  * AccessibleRelation_getTarget:
739  * @obj: a pointer to the #AccessibleRelation object to query.
740  * @i: a (zero-index) integer indicating which (of possibly several) target is requested.
741  *
742  * Get the @i-th target of a specified #AccessibleRelation relationship.
743  *
744  * Returns: an #Accessible which is the @i-th object with which the
745  *      originating #Accessible has relationship specified in the
746  *      #AccessibleRelation object.
747  *
748  **/
749 Accessible *
750 AccessibleRelation_getTarget (AccessibleRelation *obj, int i)
751 {
752   return NULL;
753 }
754
755 /**
756  * AccessibleStateSet_ref:
757  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
758  *
759  * Increment the reference count for an #AccessibleStateSet object.
760  *
761  * Returns: (no return code implemented yet).
762  *
763  **/
764 int
765 AccessibleStateSet_ref (AccessibleStateSet *obj)
766 {
767   cspi_object_ref (obj);
768   return 0;
769 }
770
771 /**
772  * AccessibleStateSet_unref:
773  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
774  *
775  * Decrement the reference count for an #AccessibleStateSet object.
776  *
777  * Returns: (no return code implemented yet).
778  *
779  **/
780 int
781 AccessibleStateSet_unref (AccessibleStateSet *obj)
782 {
783   cspi_object_unref (obj);
784   return 0;
785 }
786
787
788 /**
789  * AccessibleStateSet_contains:
790  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
791  * @state: an #AccessibleState for which the specified #AccessibleStateSet
792  *       will be queried.
793  *
794  * Determine whether a given #AccessibleStateSet includes a given state; that is,
795  *       whether @state is true for the stateset in question.
796  *
797  * Returns: #TRUE if @state is true/included in the given #AccessibleStateSet,
798  *          otherwise #FALSE.
799  *
800  **/
801 SPIBoolean
802 AccessibleStateSet_contains (AccessibleStateSet *obj,
803                              AccessibleState state)
804 {
805   CORBA_boolean retval = Accessibility_StateSet_contains (CSPI_OBJREF (obj), state, cspi_ev ());
806   cspi_check_ev (cspi_ev (), "contains");
807   return (SPIBoolean) retval;
808 }
809
810 /**
811  * AccessibleStateSet_add:
812  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
813  * @state: an #AccessibleState to be added to the specified #AccessibleStateSet
814  *
815  * Add a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
816  *       given state to #TRUE in the stateset.
817  *
818  **/
819 void
820 AccessibleStateSet_add (AccessibleStateSet *obj,
821                         AccessibleState state)
822 {
823   Accessibility_StateSet_add (CSPI_OBJREF (obj), state, cspi_ev ());
824   cspi_check_ev (cspi_ev (), "contains");
825 }
826
827
828 /**
829  * AccessibleStateSet_remove:
830  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
831  * @state: an #AccessibleState to be removed from the specified #AccessibleStateSet
832  *
833  * Remove a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
834  *       given state to #FALSE in the stateset.)
835  *
836  **/
837 void
838 AccessibleStateSet_remove (AccessibleStateSet *obj,
839                            AccessibleState state)
840 {
841   Accessibility_StateSet_remove (CSPI_OBJREF (obj), state, cspi_ev ());
842   cspi_check_ev (cspi_ev (), "contains");
843 }
844
845 /**
846  * AccessibleStateSet_equals:
847  * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
848  * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
849  *
850  * Determine whether two instances of #AccessibleStateSet are equivalent (i.e.
851  *         consist of the same #AccessibleStates).  Useful for checking multiple
852  *         state variables at once; construct the target state then compare against it.
853  *
854  * @see AccessibleStateSet_compare().
855  *
856  * Returns: #TRUE if the two #AccessibleStateSets are equivalent,
857  *          otherwise #FALSE.
858  *
859  **/
860 SPIBoolean
861 AccessibleStateSet_equals (AccessibleStateSet *obj,
862                            AccessibleStateSet *obj2)
863 {
864   return Accessibility_StateSet_equals (CSPI_OBJREF (obj), CSPI_OBJREF (obj2), cspi_ev ());
865 }
866
867 /**
868  * AccessibleStateSet_compare:
869  * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
870  * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
871  * @differenceSet: a pointer to an array of #AccessibleStates, which is set when the
872  *        fuction returns to point to an array of states representing the states which
873  *        the two state sets do not have in common.
874  *
875  * Determine the differences between two instances of #AccessibleStateSet.
876  *.
877  * @see AccessibleStateSet_equals().
878  *
879  * Returns: an #AccessibleStateSet object containing all states contained on one of
880  *          the two sets but not the other.
881  *
882  **/
883 void
884 AccessibleStateSet_compare (AccessibleStateSet *obj,
885                             AccessibleStateSet *obj2,
886                             AccessibleStateSet **differenceSet);
887
888
889 /**
890  * AccessibleStateSet_isEmpty:
891  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
892  *
893  * Determine whether a given #AccessibleStateSet is the empty set.
894  *
895  * Returns: #TRUE if the given #AccessibleStateSet contains no (true) states,
896  *          otherwise #FALSE.
897  *
898  **/
899 SPIBoolean
900 AccessibleStateSet_isEmpty (AccessibleStateSet *obj)
901 {
902   return TRUE;  
903   /*  return Accessibility_StateSet_isEmpty (CSPI_OBJREF (obj), cspi_ev ());*/
904 }
905
906
907
908