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