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