a321b54a03731132894f92306e7a69e7db31ffef
[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,
662                            const char *interface_name)
663 {
664   Bonobo_Unknown iface;
665   
666   if (!obj)
667     {
668       return NULL;
669     }
670
671   iface = Accessibility_Accessible_queryInterface (CSPI_OBJREF (obj),
672                                                    interface_name,
673                                                    cspi_ev ());
674
675   /*
676    * FIXME: we need to be fairly sure that references are going
677    * to mach up if we are going to expose QueryInterface, ie. we
678    * can't allow people to do:
679    * b = a.qi ("b"); b.unref, b.unref to release a's reference.
680    * this should be no real problem though for this level of API
681    * user.
682    */
683
684   return cspi_object_add (iface);
685 }
686
687
688 /**
689  * AccessibleRelation_ref:
690  * @obj: a pointer to the #AccessibleRelation object on which to operate.
691  *
692  * Increment the reference count for an #AccessibleRelation object.
693  *
694  * Returns: (no return code implemented yet).
695  *
696  **/
697 int
698 AccessibleRelation_ref (AccessibleRelation *obj)
699 {
700   cspi_object_ref (obj);
701   return 0;
702 }
703
704 /**
705  * AccessibleRelation_unref:
706  * @obj: a pointer to the #AccessibleRelation object on which to operate.
707  *
708  * Decrement the reference count for an #AccessibleRelation object.
709  *
710  * Returns: (no return code implemented yet).
711  *
712  **/
713 int
714 AccessibleRelation_unref (AccessibleRelation *obj)
715 {
716   cspi_object_unref (obj);
717   return 0;
718 }
719
720 /**
721  * AccessibleRelation_getRelationType:
722  * @obj: a pointer to the #AccessibleRelation object to query.
723  *
724  * Get the type of relationship represented by an #AccessibleRelation.
725  *
726  * Returns: an #AccessibleRelationType indicating the type of relation
727  *         encapsulated in this #AccessibleRelation object.
728  *
729  **/
730 AccessibleRelationType
731 AccessibleRelation_getRelationType (AccessibleRelation *obj)
732 {
733   return 0;
734 }
735
736 /**
737  * AccessibleRelation_getNTargets:
738  * @obj: a pointer to the #AccessibleRelation object to query.
739  *
740  * Get the number of objects which this relationship has as its
741  *       target objects (the subject is the #Accessible from which this
742  *       #AccessibleRelation originated).
743  *
744  * Returns: a short integer indicating how many target objects which the
745  *       originating #Accessible object has the #AccessibleRelation
746  *       relationship with.
747  **/
748 int
749 AccessibleRelation_getNTargets (AccessibleRelation *obj)
750 {
751   return 0;
752 }
753
754 /**
755  * AccessibleRelation_getTarget:
756  * @obj: a pointer to the #AccessibleRelation object to query.
757  * @i: a (zero-index) integer indicating which (of possibly several) target is requested.
758  *
759  * Get the @i-th target of a specified #AccessibleRelation relationship.
760  *
761  * Returns: an #Accessible which is the @i-th object with which the
762  *      originating #Accessible has relationship specified in the
763  *      #AccessibleRelation object.
764  *
765  **/
766 Accessible *
767 AccessibleRelation_getTarget (AccessibleRelation *obj, int i)
768 {
769   return NULL;
770 }
771
772 /**
773  * AccessibleStateSet_ref:
774  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
775  *
776  * Increment the reference count for an #AccessibleStateSet object.
777  *
778  * Returns: (no return code implemented yet).
779  *
780  **/
781 int
782 AccessibleStateSet_ref (AccessibleStateSet *obj)
783 {
784   cspi_object_ref (obj);
785   return 0;
786 }
787
788 /**
789  * AccessibleStateSet_unref:
790  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
791  *
792  * Decrement the reference count for an #AccessibleStateSet object.
793  *
794  * Returns: (no return code implemented yet).
795  *
796  **/
797 int
798 AccessibleStateSet_unref (AccessibleStateSet *obj)
799 {
800   cspi_object_unref (obj);
801   return 0;
802 }
803
804
805 /**
806  * AccessibleStateSet_contains:
807  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
808  * @state: an #AccessibleState for which the specified #AccessibleStateSet
809  *       will be queried.
810  *
811  * Determine whether a given #AccessibleStateSet includes a given state; that is,
812  *       whether @state is true for the stateset in question.
813  *
814  * Returns: #TRUE if @state is true/included in the given #AccessibleStateSet,
815  *          otherwise #FALSE.
816  *
817  **/
818 SPIBoolean
819 AccessibleStateSet_contains (AccessibleStateSet *obj,
820                              AccessibleState state)
821 {
822   CORBA_boolean retval = Accessibility_StateSet_contains (CSPI_OBJREF (obj), state, cspi_ev ());
823   cspi_check_ev (cspi_ev (), "contains");
824   return (SPIBoolean) retval;
825 }
826
827 /**
828  * AccessibleStateSet_add:
829  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
830  * @state: an #AccessibleState to be added to the specified #AccessibleStateSet
831  *
832  * Add a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
833  *       given state to #TRUE in the stateset.
834  *
835  **/
836 void
837 AccessibleStateSet_add (AccessibleStateSet *obj,
838                         AccessibleState state)
839 {
840   Accessibility_StateSet_add (CSPI_OBJREF (obj), state, cspi_ev ());
841   cspi_check_ev (cspi_ev (), "contains");
842 }
843
844
845 /**
846  * AccessibleStateSet_remove:
847  * @obj: a pointer to the #AccessibleStateSet object on which to operate.
848  * @state: an #AccessibleState to be removed from the specified #AccessibleStateSet
849  *
850  * Remove a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
851  *       given state to #FALSE in the stateset.)
852  *
853  **/
854 void
855 AccessibleStateSet_remove (AccessibleStateSet *obj,
856                            AccessibleState state)
857 {
858   Accessibility_StateSet_remove (CSPI_OBJREF (obj), state, cspi_ev ());
859   cspi_check_ev (cspi_ev (), "contains");
860 }
861
862 /**
863  * AccessibleStateSet_equals:
864  * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
865  * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
866  *
867  * Determine whether two instances of #AccessibleStateSet are equivalent (i.e.
868  *         consist of the same #AccessibleStates).  Useful for checking multiple
869  *         state variables at once; construct the target state then compare against it.
870  *
871  * @see AccessibleStateSet_compare().
872  *
873  * Returns: #TRUE if the two #AccessibleStateSets are equivalent,
874  *          otherwise #FALSE.
875  *
876  **/
877 SPIBoolean
878 AccessibleStateSet_equals (AccessibleStateSet *obj,
879                            AccessibleStateSet *obj2)
880 {
881   return Accessibility_StateSet_equals (CSPI_OBJREF (obj), CSPI_OBJREF (obj2), cspi_ev ());
882 }
883
884 /**
885  * AccessibleStateSet_compare:
886  * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
887  * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
888  *
889  * Determine the differences between two instances of #AccessibleStateSet.
890  * Not Yet Implemented.
891  *.
892  * @see AccessibleStateSet_equals().
893  *
894  * Returns: an #AccessibleStateSet object containing all states contained on one of
895  *          the two sets but not the other.
896  *
897  **/
898 AccessibleStateSet *
899 AccessibleStateSet_compare (AccessibleStateSet *obj,
900                             AccessibleStateSet *obj2)
901 {
902   return NULL;  
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