1 #include <stdlib.h> /* for malloc */
2 #include <cspi/spi-private.h>
6 static char *role_names [MAX_ROLES] =
64 "table column header",
78 * AccessibleRole_getName:
79 * @role: an #AccessibleRole object to query.
81 * Get a localizeable string that indicates the name of an #AccessibleRole.
83 * Returns: a localizable string name for an #AccessibleRole enumerated type.
86 AccessibleRole_getName (AccessibleRole role)
88 if (role < MAX_ROLES) return role_names [(int) role];
96 * @obj: a pointer to the #Accessible object on which to operate.
98 * Increment the reference count for an #Accessible object.
100 * Returns: (no return code implemented yet).
104 Accessible_ref (Accessible *obj)
106 Accessibility_Accessible_ref (*obj, spi_ev ());
107 spi_check_ev (spi_ev (), "ref");
114 * @obj: a pointer to the #Accessible object on which to operate.
116 * Decrement the reference count for an #Accessible object.
118 * Returns: (no return code implemented yet).
122 Accessible_unref (Accessible *obj)
124 Accessibility_Accessible_unref (*obj, spi_ev ());
125 spi_check_ev (spi_ev (), "unref");
130 * Accessible_getName:
131 * @obj: a pointer to the #Accessible object on which to operate.
133 * Get the name of an #Accessible object.
135 * Returns: a UTF-8 string indicating the name of the #Accessible object.
139 Accessible_getName (Accessible *obj)
143 Accessibility_Accessible__get_name (*obj, spi_ev ());
144 spi_check_ev (spi_ev (), "getName");
149 * Accessible_getDescription:
150 * @obj: a pointer to the #Accessible object on which to operate.
152 * Get the description of an #Accessible object.
154 * Returns: a UTF-8 string describing the #Accessible object.
158 Accessible_getDescription (Accessible *obj)
160 char *retval = (char *)
161 Accessibility_Accessible__get_description (*obj, spi_ev ());
162 spi_check_ev (spi_ev (), "getDescription");
167 * Accessible_getParent:
168 * @obj: a pointer to the #Accessible object to query.
170 * Get an #Accessible object's parent container.
172 * Returns: a pointer tothe #Accessible object which contains the given
173 * #Accessible instance, or NULL if the @obj has no parent container.
177 Accessible_getParent (Accessible *obj)
180 spi_object_add (Accessibility_Accessible__get_parent (*obj, spi_ev ()));
181 spi_check_ev (spi_ev (), "getParent");
186 * Accessible_getChildCount:
187 * @obj: a pointer to the #Accessible object on which to operate.
189 * Get the number of children contained by an #Accessible object.
191 * Returns: a #long indicating the number of #Accessible children
192 * contained by an #Accessible object.
196 Accessible_getChildCount (Accessible *obj)
198 long retval = (long) Accessibility_Accessible__get_childCount (*obj, spi_ev ());
199 spi_check_ev (spi_ev (), "getChildCount");
204 * Accessible_getChildAtIndex:
205 * @obj: a pointer to the #Accessible object on which to operate.
206 * @childIndex: a #long indicating which child is specified.
208 * Get the #Accessible child of an #Accessible object at a given index.
210 * Returns: a pointer to the #Accessible child object at index
215 Accessible_getChildAtIndex (Accessible *obj,
218 Accessible *retval = spi_object_add (Accessibility_Accessible_getChildAtIndex (*obj, childIndex, spi_ev ()));
219 spi_check_ev (spi_ev (), "getChildAtIndex");
224 * Accessible_getIndexInParent:
225 * @obj: a pointer to the #Accessible object on which to operate.
227 * Get the index of an #Accessible object in its containing #Accessible.
229 * Returns: a #long indicating the index of the #Accessible object
230 * in its parent (i.e. containing) #Accessible instance,
231 * or -1 if @obj has no containing parent.
235 Accessible_getIndexInParent (Accessible *obj)
237 long retval = (long) Accessibility_Accessible_getIndexInParent (*obj, spi_ev ());
238 spi_check_ev (spi_ev (), "getIndexInParent");
243 * Accessible_getRelationSet:
244 * @obj: a pointer to the #Accessible object on which to operate.
246 * Get the set of #AccessibleRelation objects which describe this #Accessible object's
247 * relationships with other #Accessible objects.
249 * Returns: an array of #AccessibleRelation pointers.
252 AccessibleRelation **
253 Accessible_getRelationSet (Accessible *obj)
255 AccessibleRelation **relations;
258 Accessibility_RelationSet *relation_set =
259 Accessibility_Accessible_getRelationSet (*obj, spi_ev ());
261 /* this looks hack-ish, but it's based on the CORBA C bindings spec */
262 n_relations = relation_set->_length;
263 relations = malloc (sizeof (AccessibleRelation *) * n_relations);
265 for (i=0; i<n_relations; ++i)
267 relations[i] = spi_object_add (relation_set->_buffer[i]);
269 relations[i] = CORBA_OBJECT_NIL;
275 * Accessible_getRole:
276 * @obj: a pointer to the #Accessible object on which to operate.
278 * Get the UI role of an #Accessible object.
280 * Returns: a UTF-8 string indicating the UI role of the #Accessible object.
284 Accessible_getRole (Accessible *obj)
286 char *retval = AccessibleRole_getName (
287 Accessibility_Accessible_getRole (*obj, spi_ev ()));
288 spi_check_ev (spi_ev (), "getRole");
293 * Accessible_getStateSet:
294 * @obj: a pointer to the #Accessible object on which to operate.
296 * Not Yet Implemented.
298 * Returns: a pointer to an #AccessibleStateSet representing the object's current state.
301 Accessible_getStateSet (Accessible *obj)
306 /* Interface query methods */
309 * Accessible_isAction:
310 * @obj: a pointer to the #Accessible instance to query.
312 * Query whether the specified #Accessible implements #AccessibleAction.
314 * Returns: #TRUE if @obj implements the #AccessibleAction interface,
318 Accessible_isAction (Accessible *obj)
320 Bonobo_Unknown iface =
321 Accessibility_Accessible_queryInterface (*obj,
322 "IDL:Accessibility/Action:1.0",
324 spi_warn_ev (spi_ev (), "isAction");
326 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
330 * Accessible_isComponent:
331 * @obj: a pointer to the #Accessible instance to query.
333 * Query whether the specified #Accessible implements #AccessibleComponent.
335 * Returns: #TRUE if @obj implements the #AccessibleComponent interface,
339 Accessible_isComponent (Accessible *obj)
341 Bonobo_Unknown iface =
342 Accessibility_Accessible_queryInterface (*obj,
343 "IDL:Accessibility/Component:1.0",
345 spi_warn_ev (spi_ev (), "isComponent");
347 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
351 * Accessible_isEditableText:
352 * @obj: a pointer to the #Accessible instance to query.
354 * Query whether the specified #Accessible implements #AccessibleEditableText.
356 * Returns: #TRUE if @obj implements the #AccessibleEditableText interface,
360 Accessible_isEditableText (Accessible *obj)
362 Bonobo_Unknown iface =
363 Accessibility_Accessible_queryInterface (*obj,
364 "IDL:Accessibility/EditableText:1.0",
366 spi_check_ev (spi_ev (), "isEditableText");
368 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
372 * Accessible_isHypertext:
373 * @obj: a pointer to the #Accessible instance to query.
375 * Query whether the specified #Accessible implements #AccessibleHypertext.
377 * Returns: #TRUE if @obj implements the #AccessibleHypertext interface,
381 Accessible_isHypertext (Accessible *obj)
383 Bonobo_Unknown iface =
384 Accessibility_Accessible_queryInterface (*obj,
385 "IDL:Accessibility/Hypertext:1.0",
388 spi_check_ev (spi_ev (), "isHypertext");
390 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
394 * Accessible_isImage:
395 * @obj: a pointer to the #Accessible instance to query.
397 * Query whether the specified #Accessible implements #AccessibleImage.
399 * Returns: #TRUE if @obj implements the #AccessibleImage interface,
403 Accessible_isImage (Accessible *obj)
405 Bonobo_Unknown iface =
406 Accessibility_Accessible_queryInterface (*obj,
407 "IDL:Accessibility/Image:1.0",
409 spi_check_ev (spi_ev (), "isImage");
411 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
415 * Accessible_isSelection:
416 * @obj: a pointer to the #Accessible instance to query.
418 * Query whether the specified #Accessible implements #AccessibleSelection.
420 * Returns: #TRUE if @obj implements the #AccessibleSelection interface,
424 Accessible_isSelection (Accessible *obj)
426 Bonobo_Unknown iface =
427 Accessibility_Accessible_queryInterface (*obj,
428 "IDL:Accessibility/Selection:1.0",
430 spi_warn_ev (spi_ev (), "isSelection");
432 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
437 * Accessible_isTable:
438 * @obj: a pointer to the #Accessible instance to query.
440 * Query whether the specified #Accessible implements #AccessibleTable.
442 * Returns: #TRUE if @obj implements the #AccessibleTable interface,
446 Accessible_isTable (Accessible *obj)
448 Bonobo_Unknown iface =
449 Accessibility_Accessible_queryInterface (*obj,
450 "IDL:Accessibility/Table:1.0",
452 spi_check_ev (spi_ev (), "isTable");
454 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
460 * @obj: a pointer to the #Accessible instance to query.
462 * Query whether the specified #Accessible implements #AccessibleText.
464 * Returns: #TRUE if @obj implements the #AccessibleText interface,
468 Accessible_isText (Accessible *obj)
470 Bonobo_Unknown iface =
471 Accessibility_Accessible_queryInterface (*obj,
472 "IDL:Accessibility/Text:1.0",
474 spi_warn_ev (spi_ev (), "isText");
476 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
480 * Accessible_isValue:
481 * @obj: a pointer to the #Accessible instance to query.
483 * Query whether the specified #Accessible implements #AccessibleValue.
485 * Returns: #TRUE if @obj implements the #AccessibleValue interface,
489 Accessible_isValue (Accessible *obj)
491 Bonobo_Unknown iface =
492 Accessibility_Accessible_queryInterface (*obj,
493 "IDL:Accessibility/Value:1.0",
495 spi_check_ev (spi_ev (), "isValue");
497 return (CORBA_Object_is_nil (iface, spi_ev ())) ? FALSE : TRUE;
501 * Accessible_getAction:
502 * @obj: a pointer to the #Accessible instance to query.
504 * Get the #AccessibleAction interface for an #Accessible.
506 * Returns: a pointer to an #AccessibleAction interface instance, or
507 * NULL if @obj does not implement #AccessibleAction.
510 Accessible_getAction (Accessible *obj)
512 Bonobo_Unknown iface =
513 Accessibility_Accessible_queryInterface (*obj,
514 "IDL:Accessibility/Action:1.0",
516 spi_check_ev (spi_ev (), "getAction");
518 return (AccessibleAction *) spi_object_add (iface);
522 * Accessible_getComponent:
523 * @obj: a pointer to the #Accessible instance to query.
525 * Get the #AccessibleComponent interface for an #Accessible.
527 * Returns: a pointer to an #AccessibleComponent interface instance, or
528 * NULL if @obj does not implement #AccessibleComponent.
530 AccessibleComponent *
531 Accessible_getComponent (Accessible *obj)
533 Bonobo_Unknown iface =
534 Accessibility_Accessible_queryInterface (*obj,
535 "IDL:Accessibility/Component:1.0",
537 spi_check_ev (spi_ev (), "getComponent");
539 return (AccessibleComponent *) spi_object_add (iface);
543 * Accessible_getEditableText:
544 * @obj: a pointer to the #Accessible instance to query.
546 * Get the #AccessibleEditableText interface for an #Accessible.
548 * Returns: a pointer to an #AccessibleEditableText interface instance, or
549 * NULL if @obj does not implement #AccessibleEditableText.
551 AccessibleEditableText *
552 Accessible_getEditableText (Accessible *obj)
554 Bonobo_Unknown iface =
555 Accessibility_Accessible_queryInterface (*obj,
556 "IDL:Accessibility/EditableText:1.0",
558 spi_check_ev (spi_ev (), "getEditableText");
560 return (AccessibleEditableText *) spi_object_add (iface);
566 * Accessible_getHypertext:
567 * @obj: a pointer to the #Accessible instance to query.
569 * Get the #AccessibleHypertext interface for an #Accessible.
571 * Returns: a pointer to an #AccessibleHypertext interface instance, or
572 * NULL if @obj does not implement #AccessibleHypertext.
574 AccessibleHypertext *
575 Accessible_getHypertext (Accessible *obj)
577 Bonobo_Unknown iface =
578 Accessibility_Accessible_queryInterface (*obj,
579 "IDL:Accessibility/Hypertext:1.0",
581 spi_check_ev (spi_ev (), "getHypertext");
583 return (AccessibleHypertext *) spi_object_add (iface);
589 * Accessible_getImage:
590 * @obj: a pointer to the #Accessible instance to query.
592 * Get the #AccessibleImage interface for an #Accessible.
594 * Returns: a pointer to an #AccessibleImage interface instance, or
595 * NULL if @obj does not implement #AccessibleImage.
598 Accessible_getImage (Accessible *obj)
600 Bonobo_Unknown iface =
601 Accessibility_Accessible_queryInterface (*obj,
602 "IDL:Accessibility/Image:1.0",
604 spi_check_ev (spi_ev (), "getImage");
606 return (AccessibleImage *) spi_object_add (iface);
612 * Accessible_getSelection:
613 * @obj: a pointer to the #Accessible instance to query.
615 * Get the #AccessibleSelection interface for an #Accessible.
617 * Returns: a pointer to an #AccessibleSelection interface instance, or
618 * NULL if @obj does not implement #AccessibleSelection.
620 AccessibleSelection *
621 Accessible_getSelection (Accessible *obj)
623 Bonobo_Unknown iface =
624 Accessibility_Accessible_queryInterface (*obj,
625 "IDL:Accessibility/Selection:1.0",
627 spi_warn_ev (spi_ev (), "getSelection");
629 return (AccessibleSelection *) spi_object_add (iface);
635 * Accessible_getTable:
636 * @obj: a pointer to the #Accessible instance to query.
638 * Get the #AccessibleTable interface for an #Accessible.
640 * Returns: a pointer to an #AccessibleTable interface instance, or
641 * NULL if @obj does not implement #AccessibleTable.
644 Accessible_getTable (Accessible *obj)
646 Bonobo_Unknown iface =
647 Accessibility_Accessible_queryInterface (*obj,
648 "IDL:Accessibility/Table:1.0",
650 spi_check_ev (spi_ev (), "getTable");
652 return (AccessibleTable *) spi_object_add (iface);
656 * Accessible_getText:
657 * @obj: a pointer to the #Accessible instance to query.
659 * Get the #AccessibleText interface for an #Accessible.
661 * Returns: a pointer to an #AccessibleText interface instance, or
662 * NULL if @obj does not implement #AccessibleText.
665 Accessible_getText (Accessible *obj)
667 Bonobo_Unknown iface =
668 Accessibility_Accessible_queryInterface (*obj,
669 "IDL:Accessibility/Text:1.0",
672 spi_check_ev (spi_ev (), "getText");
674 return (AccessibleText *) spi_object_add (iface);
680 * Accessible_getValue:
681 * @obj: a pointer to the #Accessible instance to query.
683 * Get the #AccessibleValue interface for an #Accessible.
685 * Returns: a pointer to an #AccessibleValue interface instance, or
686 * NULL if @obj does not implement #AccessibleValue.
689 Accessible_getValue (Accessible *obj)
691 Bonobo_Unknown iface =
692 Accessibility_Accessible_queryInterface (*obj,
693 "IDL:Accessibility/Value:1.0",
695 return (AccessibleValue *) spi_object_add (iface);
701 * Accessible_queryInterface:
702 * @obj: a pointer to the #Accessible instance to query.
703 * @interface_name: a UTF-8 character string specifiying the requested interface.
705 * Query an #Accessible object to for a named interface.
707 * Returns: an instance of the named interface object, if it is implemented
708 * by @obj, or NULL otherwise.
712 Accessible_queryInterface (Accessible *obj, char *interface_name)
714 GenericInterface iface;
715 iface = Accessibility_Accessible_queryInterface (*obj,
718 return spi_object_add (iface);
723 * AccessibleRelation_ref:
724 * @obj: a pointer to the #AccessibleRelation object on which to operate.
726 * Increment the reference count for an #AccessibleRelation object.
728 * Returns: (no return code implemented yet).
732 AccessibleRelation_ref (AccessibleRelation *obj)
734 Accessibility_Relation_ref (*obj, spi_ev ());
735 spi_check_ev (spi_ev (), "ref");
740 * AccessibleRelation_unref:
741 * @obj: a pointer to the #AccessibleRelation object on which to operate.
743 * Decrement the reference count for an #AccessibleRelation object.
745 * Returns: (no return code implemented yet).
749 AccessibleRelation_unref (AccessibleRelation *obj)
751 Accessibility_Relation_unref (*obj, spi_ev ());
752 spi_check_ev (spi_ev (), "unref");
757 * AccessibleRelation_getRelationType:
758 * @obj: a pointer to the #AccessibleRelation object to query.
760 * Get the type of relationship represented by an #AccessibleRelation.
762 * Returns: an #AccessibleRelationType indicating the type of relation
763 * encapsulated in this #AccessibleRelation object.
766 AccessibleRelationType
767 AccessibleRelation_getRelationType (AccessibleRelation *obj)
773 * AccessibleRelation_getNTargets:
774 * @obj: a pointer to the #AccessibleRelation object to query.
776 * Get the number of objects which this relationship has as its
777 * target objects (the subject is the #Accessible from which this
778 * #AccessibleRelation originated).
780 * Returns: a short integer indicating how many target objects which the
781 * originating #Accessible object has the #AccessibleRelation
785 AccessibleRelation_getNTargets (AccessibleRelation *obj)
791 * AccessibleRelation_getTarget:
792 * @obj: a pointer to the #AccessibleRelation object to query.
793 * @i: a (zero-index) integer indicating which (of possibly several) target is requested.
795 * Get the @i-th target of a specified #AccessibleRelation relationship.
797 * Returns: an #Accessible which is the @i-th object with which the
798 * originating #Accessible has relationship specified in the
799 * #AccessibleRelation object.
803 AccessibleRelation_getTarget (AccessibleRelation *obj, int i)
809 * AccessibleStateSet_ref:
810 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
812 * Increment the reference count for an #AccessibleStateSet object.
814 * Returns: (no return code implemented yet).
818 AccessibleStateSet_ref (AccessibleStateSet *obj)
820 /* Accessibility_StateSet_ref (*obj, spi_ev ()); */
821 spi_check_ev (spi_ev (), "ref");
826 * AccessibleStateSet_unref:
827 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
829 * Decrement the reference count for an #AccessibleStateSet object.
831 * Returns: (no return code implemented yet).
835 AccessibleStateSet_unref (AccessibleStateSet *obj)
837 /* Accessibility_StateSet_unref (*obj, spi_ev ()); */
838 spi_check_ev (spi_ev (), "unref");
844 * AccessibleStateSet_contains:
845 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
846 * @state: an #AccessibleState for which the specified #AccessibleStateSet
849 * Determine whether a given #AccessibleStateSet includes a given state; that is,
850 * whether @state is true for the stateset in question.
852 * Returns: #TRUE if @state is true/included in the given #AccessibleStateSet,
857 AccessibleStateSet_contains (AccessibleStateSet *obj,
858 AccessibleState state)
860 CORBA_boolean retval = Accessibility_StateSet_contains (*obj, state, spi_ev ());
861 spi_check_ev (spi_ev (), "contains");
862 return (boolean) retval;
866 * AccessibleStateSet_add:
867 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
868 * @state: an #AccessibleState to be added to the specified #AccessibleStateSet
870 * Add a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
871 * given state to #TRUE in the stateset.
875 AccessibleStateSet_add (AccessibleStateSet *obj,
876 AccessibleState state)
878 Accessibility_StateSet_add (*obj, state, spi_ev ());
879 spi_check_ev (spi_ev (), "contains");
884 * AccessibleStateSet_remove:
885 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
886 * @state: an #AccessibleState to be removed from the specified #AccessibleStateSet
888 * Remove a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
889 * given state to #FALSE in the stateset.)
893 AccessibleStateSet_remove (AccessibleStateSet *obj,
894 AccessibleState state)
896 Accessibility_StateSet_remove (*obj, state, spi_ev ());
897 spi_check_ev (spi_ev (), "contains");
901 * AccessibleStateSet_equals:
902 * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
903 * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
905 * Determine whether two instances of #AccessibleStateSet are equivalent (i.e.
906 * consist of the same #AccessibleStates). Useful for checking multiple
907 * state variables at once; construct the target state then compare against it.
909 * @see AccessibleStateSet_compare().
911 * Returns: #TRUE if the two #AccessibleStateSets are equivalent,
916 AccessibleStateSet_equals (AccessibleStateSet *obj,
917 AccessibleStateSet *obj2)
919 return Accessibility_StateSet_equals (*obj, *obj2, spi_ev ());
923 * AccessibleStateSet_compare:
924 * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
925 * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
926 * @differenceSet: a pointer to an array of #AccessibleStates, which is set when the
927 * fuction returns to point to an array of states representing the states which
928 * the two state sets do not have in common.
930 * Determine the differences between two instances of #AccessibleStateSet.
932 * @see AccessibleStateSet_equals().
934 * Returns: an #AccessibleStateSet object containing all states contained on one of
935 * the two sets but not the other.
939 AccessibleStateSet_compare (AccessibleStateSet *obj,
940 AccessibleStateSet *obj2,
941 AccessibleStateSet **differenceSet);
945 * AccessibleStateSet_isEmpty:
946 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
948 * Determine whether a given #AccessibleStateSet is the empty set.
950 * Returns: #TRUE if the given #AccessibleStateSet contains no (true) states,
955 AccessibleStateSet_isEmpty (AccessibleStateSet *obj)
958 /* return Accessibility_StateSet_isEmpty (*obj, spi_ev ());*/