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