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