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