1 #include <stdlib.h> /* for malloc */
2 #include <cspi/spi-private.h>
4 static const char *role_names [] =
62 "table column header",
78 #define MAX_ROLES (sizeof (role_names) / sizeof (char *))
81 cspi_init_role_table (AccessibleRole *role_table)
84 for (i = 0; i < Accessibility_ROLE_LAST_DEFINED; ++i)
86 role_table [i] = SPI_ROLE_UNKNOWN;
88 role_table [Accessibility_ROLE_INVALID] = SPI_ROLE_INVALID;
89 role_table [Accessibility_ROLE_ACCELERATOR_LABEL] = SPI_ROLE_ACCEL_LABEL;
90 role_table [Accessibility_ROLE_ALERT] = SPI_ROLE_ALERT;
91 role_table [Accessibility_ROLE_ANIMATION] = SPI_ROLE_ANIMATION;
92 role_table [Accessibility_ROLE_ARROW] = SPI_ROLE_ARROW;
93 role_table [Accessibility_ROLE_CALENDAR] = SPI_ROLE_CALENDAR;
94 role_table [Accessibility_ROLE_CANVAS] = SPI_ROLE_CANVAS;
95 role_table [Accessibility_ROLE_CHECK_BOX] = SPI_ROLE_CHECK_BOX;
96 role_table [Accessibility_ROLE_CHECK_MENU_ITEM] = SPI_ROLE_CHECK_MENU_ITEM;
97 role_table [Accessibility_ROLE_COLOR_CHOOSER] = SPI_ROLE_COLOR_CHOOSER;
98 role_table [Accessibility_ROLE_COLUMN_HEADER] = SPI_ROLE_COLUMN_HEADER;
99 role_table [Accessibility_ROLE_COMBO_BOX] = SPI_ROLE_COMBO_BOX;
100 role_table [Accessibility_ROLE_DATE_EDITOR] = SPI_ROLE_DATE_EDITOR;
101 role_table [Accessibility_ROLE_DESKTOP_ICON] = SPI_ROLE_DESKTOP_ICON;
102 role_table [Accessibility_ROLE_DESKTOP_FRAME] = SPI_ROLE_DESKTOP_FRAME;
103 role_table [Accessibility_ROLE_DIAL] = SPI_ROLE_DIAL;
104 role_table [Accessibility_ROLE_DIALOG] = SPI_ROLE_DIALOG;
105 role_table [Accessibility_ROLE_DIRECTORY_PANE] = SPI_ROLE_DIRECTORY_PANE;
106 role_table[Accessibility_ROLE_DRAWING_AREA] = SPI_ROLE_DRAWING_AREA;
107 role_table [Accessibility_ROLE_FILE_CHOOSER] = SPI_ROLE_FILE_CHOOSER;
108 role_table [Accessibility_ROLE_FILLER] = SPI_ROLE_FILLER;
109 role_table [Accessibility_ROLE_FONT_CHOOSER] = SPI_ROLE_FONT_CHOOSER;
110 role_table [Accessibility_ROLE_FRAME] = SPI_ROLE_FRAME;
111 role_table [Accessibility_ROLE_GLASS_PANE] = SPI_ROLE_GLASS_PANE;
112 role_table [Accessibility_ROLE_HTML_CONTAINER] = SPI_ROLE_HTML_CONTAINER;
113 role_table [Accessibility_ROLE_ICON] = SPI_ROLE_ICON;
114 role_table [Accessibility_ROLE_IMAGE] = SPI_ROLE_IMAGE;
115 role_table [Accessibility_ROLE_INTERNAL_FRAME] = SPI_ROLE_INTERNAL_FRAME;
116 role_table [Accessibility_ROLE_LABEL] = SPI_ROLE_LABEL;
117 role_table [Accessibility_ROLE_LAYERED_PANE] = SPI_ROLE_LAYERED_PANE;
118 role_table [Accessibility_ROLE_LIST] = SPI_ROLE_LIST;
119 role_table [Accessibility_ROLE_LIST_ITEM] = SPI_ROLE_LIST_ITEM;
120 role_table [Accessibility_ROLE_MENU] = SPI_ROLE_MENU;
121 role_table [Accessibility_ROLE_MENU_BAR] = SPI_ROLE_MENU_BAR;
122 role_table [Accessibility_ROLE_MENU_ITEM] = SPI_ROLE_MENU_ITEM;
123 role_table [Accessibility_ROLE_OPTION_PANE] = SPI_ROLE_OPTION_PANE;
124 role_table [Accessibility_ROLE_PAGE_TAB] = SPI_ROLE_PAGE_TAB;
125 role_table [Accessibility_ROLE_PAGE_TAB_LIST] = SPI_ROLE_PAGE_TAB_LIST;
126 role_table [Accessibility_ROLE_PANEL] = SPI_ROLE_PANEL;
127 role_table [Accessibility_ROLE_PASSWORD_TEXT] = SPI_ROLE_PASSWORD_TEXT;
128 role_table [Accessibility_ROLE_POPUP_MENU] = SPI_ROLE_POPUP_MENU;
129 role_table [Accessibility_ROLE_PROGRESS_BAR] = SPI_ROLE_PROGRESS_BAR;
130 role_table [Accessibility_ROLE_PUSH_BUTTON] = SPI_ROLE_PUSH_BUTTON;
131 role_table [Accessibility_ROLE_RADIO_BUTTON] = SPI_ROLE_RADIO_BUTTON;
132 role_table [Accessibility_ROLE_RADIO_MENU_ITEM] = SPI_ROLE_RADIO_MENU_ITEM;
133 role_table [Accessibility_ROLE_ROOT_PANE] = SPI_ROLE_ROOT_PANE;
134 role_table [Accessibility_ROLE_ROW_HEADER] = SPI_ROLE_ROW_HEADER;
135 role_table [Accessibility_ROLE_SCROLL_BAR] = SPI_ROLE_SCROLL_BAR;
136 role_table [Accessibility_ROLE_SCROLL_PANE] = SPI_ROLE_SCROLL_PANE;
137 role_table [Accessibility_ROLE_SEPARATOR] = SPI_ROLE_SEPARATOR;
138 role_table [Accessibility_ROLE_SLIDER] = SPI_ROLE_SLIDER;
139 role_table [Accessibility_ROLE_SPIN_BUTTON] = SPI_ROLE_SPIN_BUTTON;
140 role_table [Accessibility_ROLE_SPLIT_PANE] = SPI_ROLE_SPLIT_PANE;
141 role_table [Accessibility_ROLE_STATUS_BAR] = SPI_ROLE_STATUS_BAR;
142 role_table [Accessibility_ROLE_TABLE] = SPI_ROLE_TABLE;
143 role_table [Accessibility_ROLE_TABLE_CELL] = SPI_ROLE_TABLE_CELL;
144 role_table[Accessibility_ROLE_TABLE_COLUMN_HEADER] = SPI_ROLE_TABLE_COLUMN_HEADER;
145 role_table[Accessibility_ROLE_TABLE_ROW_HEADER] = SPI_ROLE_TABLE_ROW_HEADER;
146 role_table [Accessibility_ROLE_TEAROFF_MENU_ITEM] = SPI_ROLE_TEAROFF_MENU_ITEM;
147 role_table[Accessibility_ROLE_TERMINAL] = SPI_ROLE_TERMINAL;
148 role_table [Accessibility_ROLE_TEXT] = SPI_ROLE_TEXT;
149 role_table [Accessibility_ROLE_TOGGLE_BUTTON] = SPI_ROLE_TOGGLE_BUTTON;
150 role_table [Accessibility_ROLE_TOOL_BAR] = SPI_ROLE_TOOL_BAR;
151 role_table [Accessibility_ROLE_TOOL_TIP] = SPI_ROLE_TOOL_TIP;
152 role_table [Accessibility_ROLE_TREE] = SPI_ROLE_TREE;
153 role_table [Accessibility_ROLE_TREE_TABLE] = SPI_ROLE_TREE_TABLE;
154 role_table [Accessibility_ROLE_VIEWPORT] = SPI_ROLE_VIEWPORT;
155 role_table [Accessibility_ROLE_WINDOW] = SPI_ROLE_WINDOW;
156 role_table [Accessibility_ROLE_EXTENDED] = SPI_ROLE_EXTENDED;
157 role_table [Accessibility_ROLE_LAST_DEFINED] = SPI_ROLE_EXTENDED;
162 static AccessibleRole
163 cspi_role_from_spi_role (Accessibility_Role role)
165 /* array is sized according to IDL roles because IDL roles are the index */
166 static AccessibleRole cspi_role_table [Accessibility_ROLE_LAST_DEFINED];
167 static SPIBoolean is_initialized = FALSE;
168 AccessibleRole cspi_role;
171 is_initialized = cspi_init_role_table (cspi_role_table);
173 if (role >= 0 && role < Accessibility_ROLE_LAST_DEFINED)
175 cspi_role = cspi_role_table [role];
179 cspi_role = SPI_ROLE_EXTENDED;
185 init_state_table (Accessibility_StateType *state_table)
189 for (i = 0; i < Accessibility_STATE_LAST_DEFINED; i++)
190 state_table[i] = SPI_STATE_INVALID;
192 state_table[SPI_STATE_ACTIVE] = Accessibility_STATE_ACTIVE;
193 state_table[SPI_STATE_ARMED] = Accessibility_STATE_ARMED;
194 state_table[SPI_STATE_BUSY] = Accessibility_STATE_BUSY;
195 state_table[SPI_STATE_CHECKED] = Accessibility_STATE_CHECKED;
196 state_table[SPI_STATE_DEFUNCT] = Accessibility_STATE_DEFUNCT;
197 state_table[SPI_STATE_EDITABLE] = Accessibility_STATE_EDITABLE;
198 state_table[SPI_STATE_ENABLED] = Accessibility_STATE_ENABLED;
199 state_table[SPI_STATE_EXPANDABLE] = Accessibility_STATE_EXPANDABLE;
200 state_table[SPI_STATE_EXPANDED] = Accessibility_STATE_EXPANDED;
201 state_table[SPI_STATE_FOCUSABLE] = Accessibility_STATE_FOCUSABLE;
202 state_table[SPI_STATE_FOCUSED] = Accessibility_STATE_FOCUSED;
203 state_table[SPI_STATE_HORIZONTAL] = Accessibility_STATE_HORIZONTAL;
204 state_table[SPI_STATE_ICONIFIED] = Accessibility_STATE_ICONIFIED;
205 state_table[SPI_STATE_MODAL] = Accessibility_STATE_MODAL;
206 state_table[SPI_STATE_MULTI_LINE] = Accessibility_STATE_MULTI_LINE;
207 state_table[SPI_STATE_MULTISELECTABLE] = Accessibility_STATE_MULTISELECTABLE;
208 state_table[SPI_STATE_OPAQUE] = Accessibility_STATE_OPAQUE;
209 state_table[SPI_STATE_PRESSED] = Accessibility_STATE_PRESSED;
210 state_table[SPI_STATE_RESIZABLE] = Accessibility_STATE_RESIZABLE;
211 state_table[SPI_STATE_SELECTABLE] = Accessibility_STATE_SELECTABLE;
212 state_table[SPI_STATE_SELECTED] = Accessibility_STATE_SELECTED;
213 state_table[SPI_STATE_SENSITIVE] = Accessibility_STATE_SENSITIVE;
214 state_table[SPI_STATE_SHOWING] = Accessibility_STATE_SHOWING;
215 state_table[SPI_STATE_SINGLE_LINE] = Accessibility_STATE_SINGLE_LINE;
216 state_table[SPI_STATE_STALE] = Accessibility_STATE_STALE;
217 state_table[SPI_STATE_TRANSIENT] = Accessibility_STATE_TRANSIENT;
218 state_table[SPI_STATE_VERTICAL] = Accessibility_STATE_VERTICAL;
219 state_table[SPI_STATE_VISIBLE] = Accessibility_STATE_VISIBLE;
226 static Accessibility_StateType
227 spi_state_type_from_accessible_state (AccessibleState type)
229 static Accessibility_StateType state_table[Accessibility_STATE_LAST_DEFINED];
230 static SPIBoolean table_initialized = FALSE;
231 Accessibility_StateType rv;
233 if (!table_initialized)
234 table_initialized = init_state_table (state_table);
235 if (type > SPI_STATE_INVALID && type < SPI_STATE_LAST_DEFINED)
236 rv = state_table[type];
238 rv = Accessibility_STATE_INVALID;
246 * AccessibleRole_getName:
247 * @role: an #AccessibleRole object to query.
249 * Get a localizeable string that indicates the name of an #AccessibleRole.
250 * <em>DEPRECATED.</em>
252 * Returns: a localizable string name for an #AccessibleRole enumerated type.
255 AccessibleRole_getName (AccessibleRole role)
257 if (role < MAX_ROLES)
259 return CORBA_string_dup (role_names [(int) role]);
263 return g_strdup ("");
269 * @obj: a pointer to the #Accessible object on which to operate.
271 * Increment the reference count for an #Accessible object.
274 Accessible_ref (Accessible *obj)
276 cspi_object_ref (obj);
281 * @obj: a pointer to the #Accessible object on which to operate.
283 * Decrement the reference count for an #Accessible object.
286 Accessible_unref (Accessible *obj)
288 cspi_object_unref (obj);
292 * Accessible_getName:
293 * @obj: a pointer to the #Accessible object on which to operate.
295 * Get the name of an #Accessible object.
297 * Returns: a UTF-8 string indicating the name of the #Accessible object.
298 * or NULL on exception
301 Accessible_getName (Accessible *obj)
305 cspi_return_val_if_fail (obj != NULL, NULL);
308 Accessibility_Accessible__get_name (CSPI_OBJREF (obj), cspi_ev ());
310 cspi_return_val_if_ev ("getName", NULL);
316 * Accessible_getDescription:
317 * @obj: a pointer to the #Accessible object on which to operate.
319 * Get the description of an #Accessible object.
321 * Returns: a UTF-8 string describing the #Accessible object.
322 * or NULL on exception
325 Accessible_getDescription (Accessible *obj)
329 cspi_return_val_if_fail (obj != NULL, NULL);
332 Accessibility_Accessible__get_description (CSPI_OBJREF (obj),
335 cspi_return_val_if_ev ("getDescription", NULL);
341 * Accessible_getParent:
342 * @obj: a pointer to the #Accessible object to query.
344 * Get an #Accessible object's parent container.
346 * Returns: a pointer tothe #Accessible object which contains the given
347 * #Accessible instance, or NULL if the @obj has no parent container.
351 Accessible_getParent (Accessible *obj)
355 cspi_return_val_if_fail (obj != NULL, NULL);
357 retval = cspi_object_add (
358 Accessibility_Accessible__get_parent (CSPI_OBJREF (obj),
361 cspi_return_val_if_ev ("getParent", NULL);
367 * Accessible_getChildCount:
368 * @obj: a pointer to the #Accessible object on which to operate.
370 * Get the number of children contained by an #Accessible object.
372 * Returns: a #long indicating the number of #Accessible children
373 * contained by an #Accessible object. or -1 on exception
377 Accessible_getChildCount (Accessible *obj)
381 cspi_return_val_if_fail (obj != NULL, -1);
384 Accessibility_Accessible__get_childCount (CSPI_OBJREF (obj),
387 cspi_return_val_if_ev ("getChildCount", -1);
393 * Accessible_getChildAtIndex:
394 * @obj: a pointer to the #Accessible object on which to operate.
395 * @childIndex: a #long indicating which child is specified.
397 * Get the #Accessible child of an #Accessible object at a given index.
399 * Returns: a pointer to the #Accessible child object at index
400 * @childIndex. or NULL on exception
403 Accessible_getChildAtIndex (Accessible *obj,
408 cspi_return_val_if_fail (obj != NULL, NULL);
410 retval = cspi_object_add (
411 Accessibility_Accessible_getChildAtIndex (CSPI_OBJREF (obj),
412 childIndex, cspi_ev ()));
418 * Accessible_getIndexInParent:
419 * @obj: a pointer to the #Accessible object on which to operate.
421 * Get the index of an #Accessible object in its containing #Accessible.
423 * Returns: a #long indicating the index of the #Accessible object
424 * in its parent (i.e. containing) #Accessible instance,
425 * or -1 if @obj has no containing parent or on exception.
428 Accessible_getIndexInParent (Accessible *obj)
432 cspi_return_val_if_fail (obj != NULL, -1);
435 Accessibility_Accessible_getIndexInParent (CSPI_OBJREF (obj), cspi_ev ());
437 cspi_return_val_if_ev ("getIndexInparent", -1);
442 * Accessible_getRelationSet:
443 * @obj: a pointer to the #Accessible object on which to operate.
445 * Get the set of #AccessibleRelation objects which describe this #Accessible object's
446 * relationships with other #Accessible objects.
448 * Returns: an array of #AccessibleRelation pointers. or NULL on exception
450 AccessibleRelation **
451 Accessible_getRelationSet (Accessible *obj)
455 AccessibleRelation **relations;
456 Accessibility_RelationSet *relation_set;
458 cspi_return_val_if_fail (obj != NULL, NULL);
461 Accessibility_Accessible_getRelationSet (CSPI_OBJREF (obj), cspi_ev ());
463 cspi_return_val_if_ev ("getRelationSet", NULL);
465 n_relations = relation_set->_length;
466 relations = malloc (sizeof (AccessibleRelation *) * (n_relations + 1));
468 for (i = 0; i < n_relations; ++i)
470 relations[i] = cspi_object_add (CORBA_Object_duplicate (
471 relation_set->_buffer[i], cspi_ev ()));
475 CORBA_free (relation_set);
481 * Accessible_getRole:
482 * @obj: a pointer to the #Accessible object on which to operate.
484 * Get the UI role of an #Accessible object.
485 * A UTF-8 string describing this role can be obtained via Accessible_getRoleName ().
487 * Returns: the #AccessibleRole of the object.
491 Accessible_getRole (Accessible *obj)
493 AccessibleRole retval;
495 cspi_return_val_if_fail (obj != NULL, SPI_ROLE_INVALID);
498 Accessibility_Accessible_getRole (CSPI_OBJREF (obj), cspi_ev ());
500 cspi_return_val_if_ev ("getRole", SPI_ROLE_INVALID);
502 return cspi_role_from_spi_role (retval);
506 * Accessible_getRoleName:
507 * @obj: a pointer to the #Accessible object on which to operate.
509 * Get a UTF-8 string describing the role this object plays in the UI.
510 * This method will return useful values for roles that fall outside the
511 * enumeration used in Accessible_getRole ().
513 * Returns: a UTF-8 string specifying the role of this #Accessible object.
517 Accessible_getRoleName (Accessible *obj)
521 cspi_return_val_if_fail (obj != NULL, CORBA_string_dup ("invalid"));
524 Accessibility_Accessible_getRoleName (CSPI_OBJREF (obj), cspi_ev ());
526 cspi_return_val_if_ev ("getRoleName", CORBA_string_dup ("invalid"));
532 * Accessible_getStateSet:
533 * @obj: a pointer to the #Accessible object on which to operate.
535 * Not Yet Implemented.
537 * Returns: a pointer to an #AccessibleStateSet representing the object's current state.
540 Accessible_getStateSet (Accessible *obj)
542 AccessibleStateSet *retval;
544 cspi_return_val_if_fail (obj != NULL, NULL);
546 retval = cspi_object_add (
547 Accessibility_Accessible_getState (CSPI_OBJREF (obj),
553 /* Interface query methods */
556 * Accessible_isAction:
557 * @obj: a pointer to the #Accessible instance to query.
559 * Query whether the specified #Accessible implements #AccessibleAction.
561 * Returns: #TRUE if @obj implements the #AccessibleAction interface,
565 Accessible_isAction (Accessible *obj)
567 return cspi_accessible_is_a (obj,
568 "IDL:Accessibility/Action:1.0");
572 * Accessible_isApplication:
573 * @obj: a pointer to the #Accessible instance to query.
575 * Query whether the specified #Accessible implements #AccessibleApplication.
577 * Returns: #TRUE if @obj implements the #AccessibleApplication interface,
581 Accessible_isApplication (Accessible *obj)
583 return cspi_accessible_is_a (obj,
584 "IDL:Accessibility/Application:1.0");
588 * Accessible_isComponent:
589 * @obj: a pointer to the #Accessible instance to query.
591 * Query whether the specified #Accessible implements #AccessibleComponent.
593 * Returns: #TRUE if @obj implements the #AccessibleComponent interface,
597 Accessible_isComponent (Accessible *obj)
599 return cspi_accessible_is_a (obj,
600 "IDL:Accessibility/Component:1.0");
604 * Accessible_isEditableText:
605 * @obj: a pointer to the #Accessible instance to query.
607 * Query whether the specified #Accessible implements #AccessibleEditableText.
609 * Returns: #TRUE if @obj implements the #AccessibleEditableText interface,
613 Accessible_isEditableText (Accessible *obj)
615 return cspi_accessible_is_a (obj,
616 "IDL:Accessibility/EditableText:1.0");
620 * Accessible_isHypertext:
621 * @obj: a pointer to the #Accessible instance to query.
623 * Query whether the specified #Accessible implements #AccessibleHypertext.
625 * Returns: #TRUE if @obj implements the #AccessibleHypertext interface,
629 Accessible_isHypertext (Accessible *obj)
631 return cspi_accessible_is_a (obj,
632 "IDL:Accessibility/Hypertext:1.0");
636 * Accessible_isImage:
637 * @obj: a pointer to the #Accessible instance to query.
639 * Query whether the specified #Accessible implements #AccessibleImage.
641 * Returns: #TRUE if @obj implements the #AccessibleImage interface,
645 Accessible_isImage (Accessible *obj)
647 return cspi_accessible_is_a (obj,
648 "IDL:Accessibility/Image:1.0");
652 * Accessible_isSelection:
653 * @obj: a pointer to the #Accessible instance to query.
655 * Query whether the specified #Accessible implements #AccessibleSelection.
657 * Returns: #TRUE if @obj implements the #AccessibleSelection interface,
661 Accessible_isSelection (Accessible *obj)
663 return cspi_accessible_is_a (obj,
664 "IDL:Accessibility/Selection:1.0");
668 * Accessible_isTable:
669 * @obj: a pointer to the #Accessible instance to query.
671 * Query whether the specified #Accessible implements #AccessibleTable.
673 * Returns: #TRUE if @obj implements the #AccessibleTable interface,
677 Accessible_isTable (Accessible *obj)
679 return cspi_accessible_is_a (obj,
680 "IDL:Accessibility/Table:1.0");
684 * Accessible_isStreamableContent:
685 * @obj: a pointer to the #Accessible instance to query.
687 * Query whether the specified #Accessible implements
688 * #AccessibleStreamableContent.
690 * Returns: #TRUE if @obj implements the #AccessibleStreamableContent interface,
694 Accessible_isStreamableContent (Accessible *obj)
696 return cspi_accessible_is_a (obj,
697 "IDL:Accessibility/StreamableContent:1.0");
702 * @obj: a pointer to the #Accessible instance to query.
704 * Query whether the specified #Accessible implements #AccessibleText.
706 * Returns: #TRUE if @obj implements the #AccessibleText interface,
710 Accessible_isText (Accessible *obj)
712 return cspi_accessible_is_a (obj,
713 "IDL:Accessibility/Text:1.0");
717 * Accessible_isValue:
718 * @obj: a pointer to the #Accessible instance to query.
720 * Query whether the specified #Accessible implements #AccessibleValue.
722 * Returns: #TRUE if @obj implements the #AccessibleValue interface,
726 Accessible_isValue (Accessible *obj)
728 return cspi_accessible_is_a (obj,
729 "IDL:Accessibility/Value:1.0");
733 * Accessible_getApplication:
734 * @obj: a pointer to the #Accessible instance to query.
736 * Get the #AccessibleApplication interface for an #Accessible.
738 * Returns: a pointer to an #AccessibleApplication interface instance, or
739 * NULL if @obj does not implement #AccessibleApplication.
741 AccessibleApplication *
742 Accessible_getApplication (Accessible *obj)
744 return (AccessibleApplication *) Accessible_queryInterface (
745 obj, "IDL:Accessibility/Application:1.0");
749 * Accessible_getAction:
750 * @obj: a pointer to the #Accessible instance to query.
752 * Get the #AccessibleAction interface for an #Accessible.
754 * Returns: a pointer to an #AccessibleAction interface instance, or
755 * NULL if @obj does not implement #AccessibleAction.
758 Accessible_getAction (Accessible *obj)
760 return (AccessibleAction *) Accessible_queryInterface (
761 obj, "IDL:Accessibility/Action:1.0");
765 * Accessible_getComponent:
766 * @obj: a pointer to the #Accessible instance to query.
768 * Get the #AccessibleComponent interface for an #Accessible.
770 * Returns: a pointer to an #AccessibleComponent interface instance, or
771 * NULL if @obj does not implement #AccessibleComponent.
773 AccessibleComponent *
774 Accessible_getComponent (Accessible *obj)
776 return (AccessibleComponent *) Accessible_queryInterface (
777 obj, "IDL:Accessibility/Component:1.0");
781 * Accessible_getEditableText:
782 * @obj: a pointer to the #Accessible instance to query.
784 * Get the #AccessibleEditableText interface for an #Accessible.
786 * Returns: a pointer to an #AccessibleEditableText interface instance, or
787 * NULL if @obj does not implement #AccessibleEditableText.
789 AccessibleEditableText *
790 Accessible_getEditableText (Accessible *obj)
792 return (AccessibleEditableText *) Accessible_queryInterface (
793 obj, "IDL:Accessibility/EditableText:1.0");
799 * Accessible_getHypertext:
800 * @obj: a pointer to the #Accessible instance to query.
802 * Get the #AccessibleHypertext interface for an #Accessible.
804 * Returns: a pointer to an #AccessibleHypertext interface instance, or
805 * NULL if @obj does not implement #AccessibleHypertext.
807 AccessibleHypertext *
808 Accessible_getHypertext (Accessible *obj)
810 return (AccessibleHypertext *) Accessible_queryInterface (
811 obj, "IDL:Accessibility/Hypertext:1.0");
817 * Accessible_getImage:
818 * @obj: a pointer to the #Accessible instance to query.
820 * Get the #AccessibleImage interface for an #Accessible.
822 * Returns: a pointer to an #AccessibleImage interface instance, or
823 * NULL if @obj does not implement #AccessibleImage.
826 Accessible_getImage (Accessible *obj)
828 return (AccessibleImage *) Accessible_queryInterface (
829 obj, "IDL:Accessibility/Image:1.0");
835 * Accessible_getSelection:
836 * @obj: a pointer to the #Accessible instance to query.
838 * Get the #AccessibleSelection interface for an #Accessible.
840 * Returns: a pointer to an #AccessibleSelection interface instance, or
841 * NULL if @obj does not implement #AccessibleSelection.
843 AccessibleSelection *
844 Accessible_getSelection (Accessible *obj)
846 return (AccessibleSelection *) Accessible_queryInterface (
847 obj, "IDL:Accessibility/Selection:1.0");
853 * Accessible_getStreamableContent:
854 * @obj: a pointer to the #Accessible instance to query.
856 * Get the #AccessibleStreamableContent interface for an #Accessible.
858 * Returns: a pointer to an #AccessibleStreamableContent interface instance, or
859 * NULL if @obj does not implement #AccessibleStreamableContent.
861 AccessibleStreamableContent *
862 Accessible_getStreamableContent (Accessible *obj)
864 return (AccessibleStreamableContent *) Accessible_queryInterface (
865 obj, "IDL:Accessibility/StreamableContent:1.0");
869 * Accessible_getTable:
870 * @obj: a pointer to the #Accessible instance to query.
872 * Get the #AccessibleTable interface for an #Accessible.
874 * Returns: a pointer to an #AccessibleTable interface instance, or
875 * NULL if @obj does not implement #AccessibleTable.
878 Accessible_getTable (Accessible *obj)
880 return (AccessibleTable *) Accessible_queryInterface (
881 obj, "IDL:Accessibility/Table:1.0");
885 * Accessible_getText:
886 * @obj: a pointer to the #Accessible instance to query.
888 * Get the #AccessibleText interface for an #Accessible.
890 * Returns: a pointer to an #AccessibleText interface instance, or
891 * NULL if @obj does not implement #AccessibleText.
894 Accessible_getText (Accessible *obj)
896 return (AccessibleText *) Accessible_queryInterface (
897 obj, "IDL:Accessibility/Text:1.0");
903 * Accessible_getValue:
904 * @obj: a pointer to the #Accessible instance to query.
906 * Get the #AccessibleValue interface for an #Accessible.
908 * Returns: a pointer to an #AccessibleValue interface instance, or
909 * NULL if @obj does not implement #AccessibleValue.
912 Accessible_getValue (Accessible *obj)
914 return (AccessibleValue *) Accessible_queryInterface (
915 obj, "IDL:Accessibility/Value:1.0");
921 * Accessible_queryInterface:
922 * @obj: a pointer to the #Accessible instance to query.
923 * @interface_name: a UTF-8 character string specifiying the requested interface.
925 * Query an #Accessible object to for a named interface.
927 * Returns: an instance of the named interface object, if it is implemented
928 * by @obj, or NULL otherwise.
932 Accessible_queryInterface (Accessible *obj,
933 const char *interface_name)
935 Bonobo_Unknown iface;
942 iface = Accessibility_Accessible_queryInterface (CSPI_OBJREF (obj),
947 cspi_return_val_if_ev ("queryInterface", NULL);
950 * FIXME: we need to be fairly sure that references are going
951 * to mach up if we are going to expose QueryInterface, ie. we
952 * can't allow people to do:
953 * b = a.qi ("b"); b.unref, b.unref to release a's reference.
954 * this should be no real problem though for this level of API
958 return cspi_object_add (iface);
963 * AccessibleRelation_ref:
964 * @obj: a pointer to the #AccessibleRelation object on which to operate.
966 * Increment the reference count for an #AccessibleRelation object.
970 AccessibleRelation_ref (AccessibleRelation *obj)
972 cspi_object_ref (obj);
976 * AccessibleRelation_unref:
977 * @obj: a pointer to the #AccessibleRelation object on which to operate.
979 * Decrement the reference count for an #AccessibleRelation object.
983 AccessibleRelation_unref (AccessibleRelation *obj)
985 cspi_object_unref (obj);
989 * AccessibleRelation_getRelationType:
990 * @obj: a pointer to the #AccessibleRelation object to query.
992 * Get the type of relationship represented by an #AccessibleRelation.
994 * Returns: an #AccessibleRelationType indicating the type of relation
995 * encapsulated in this #AccessibleRelation object.
998 AccessibleRelationType
999 AccessibleRelation_getRelationType (AccessibleRelation *obj)
1001 AccessibleRelationType retval;
1003 cspi_return_val_if_fail (obj, SPI_RELATION_NULL);
1005 Accessibility_Relation_getRelationType (CSPI_OBJREF (obj), cspi_ev());
1006 cspi_return_val_if_ev ("getRelationType", SPI_RELATION_NULL);
1011 * AccessibleRelation_getNTargets:
1012 * @obj: a pointer to the #AccessibleRelation object to query.
1014 * Get the number of objects which this relationship has as its
1015 * target objects (the subject is the #Accessible from which this
1016 * #AccessibleRelation originated).
1018 * Returns: a short integer indicating how many target objects which the
1019 * originating #Accessible object has the #AccessibleRelation
1020 * relationship with.
1023 AccessibleRelation_getNTargets (AccessibleRelation *obj)
1027 cspi_return_val_if_fail (obj, -1);
1029 Accessibility_Relation_getNTargets (CSPI_OBJREF (obj), cspi_ev());
1030 cspi_return_val_if_ev ("getNTargets", -1);
1035 * AccessibleRelation_getTarget:
1036 * @obj: a pointer to the #AccessibleRelation object to query.
1037 * @i: a (zero-index) integer indicating which (of possibly several) target is requested.
1039 * Get the @i-th target of a specified #AccessibleRelation relationship.
1041 * Returns: an #Accessible which is the @i-th object with which the
1042 * originating #Accessible has relationship specified in the
1043 * #AccessibleRelation object.
1047 AccessibleRelation_getTarget (AccessibleRelation *obj, int i)
1051 cspi_return_val_if_fail (obj, NULL);
1053 retval = cspi_object_add (
1054 Accessibility_Relation_getTarget (CSPI_OBJREF(obj),
1055 (CORBA_short) i, cspi_ev()));
1056 cspi_return_val_if_ev ("getTarget", NULL);
1061 * AccessibleStateSet_ref:
1062 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
1064 * Increment the reference count for an #AccessibleStateSet object.
1068 AccessibleStateSet_ref (AccessibleStateSet *obj)
1070 cspi_object_ref (obj);
1074 * AccessibleStateSet_unref:
1075 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
1077 * Decrement the reference count for an #AccessibleStateSet object.
1081 AccessibleStateSet_unref (AccessibleStateSet *obj)
1083 cspi_object_unref (obj);
1087 * AccessibleStateSet_contains:
1088 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
1089 * @state: an #AccessibleState for which the specified #AccessibleStateSet
1092 * Determine whether a given #AccessibleStateSet includes a given state; that is,
1093 * whether @state is true for the stateset in question.
1095 * Returns: #TRUE if @state is true/included in the given #AccessibleStateSet,
1100 AccessibleStateSet_contains (AccessibleStateSet *obj,
1101 AccessibleState state)
1103 CORBA_boolean retval;
1104 Accessibility_StateType spi_state;
1106 cspi_return_val_if_fail (obj != NULL, FALSE);
1108 spi_state = spi_state_type_from_accessible_state (state);
1109 retval = Accessibility_StateSet_contains (CSPI_OBJREF (obj),
1110 spi_state, cspi_ev ());
1112 cspi_return_val_if_ev ("contains", FALSE);
1114 return (SPIBoolean) retval;
1118 * AccessibleStateSet_add:
1119 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
1120 * @state: an #AccessibleState to be added to the specified #AccessibleStateSet
1122 * Add a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
1123 * given state to #TRUE in the stateset.
1127 AccessibleStateSet_add (AccessibleStateSet *obj,
1128 AccessibleState state)
1130 Accessibility_StateType spi_state;
1132 cspi_return_if_fail (obj != NULL);
1134 spi_state = spi_state_type_from_accessible_state (state);
1135 Accessibility_StateSet_add (CSPI_OBJREF (obj), spi_state, cspi_ev ());
1136 cspi_check_ev ("add");
1140 * AccessibleStateSet_remove:
1141 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
1142 * @state: an #AccessibleState to be removed from the specified #AccessibleStateSet
1144 * Remove a particular #AccessibleState to an #AccessibleStateSet (i.e. set the
1145 * given state to #FALSE in the stateset.)
1149 AccessibleStateSet_remove (AccessibleStateSet *obj,
1150 AccessibleState state)
1152 Accessibility_StateType spi_state;
1154 cspi_return_if_fail (obj != NULL);
1156 spi_state = spi_state_type_from_accessible_state (state);
1157 Accessibility_StateSet_remove (CSPI_OBJREF (obj), spi_state, cspi_ev ());
1158 cspi_check_ev ("remove");
1162 * AccessibleStateSet_equals:
1163 * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
1164 * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
1166 * Determine whether two instances of #AccessibleStateSet are equivalent (i.e.
1167 * consist of the same #AccessibleStates). Useful for checking multiple
1168 * state variables at once; construct the target state then compare against it.
1170 * @see AccessibleStateSet_compare().
1172 * Returns: #TRUE if the two #AccessibleStateSets are equivalent,
1177 AccessibleStateSet_equals (AccessibleStateSet *obj,
1178 AccessibleStateSet *obj2)
1185 cspi_return_val_if_fail (obj != NULL, FALSE);
1186 cspi_return_val_if_fail (obj2 != NULL, FALSE);
1188 return Accessibility_StateSet_equals (CSPI_OBJREF (obj),
1189 CSPI_OBJREF (obj2), cspi_ev ());
1193 * AccessibleStateSet_compare:
1194 * @obj: a pointer to the first #AccessibleStateSet object on which to operate.
1195 * @obj2: a pointer to the second #AccessibleStateSet object on which to operate.
1197 * Determine the differences between two instances of #AccessibleStateSet.
1198 * Not Yet Implemented.
1200 * @see AccessibleStateSet_equals().
1202 * Returns: an #AccessibleStateSet object containing all states contained on one of
1203 * the two sets but not the other.
1206 AccessibleStateSet *
1207 AccessibleStateSet_compare (AccessibleStateSet *obj,
1208 AccessibleStateSet *obj2)
1210 Accessibility_StateSet retval;
1212 cspi_return_val_if_fail (obj != NULL, NULL);
1213 cspi_return_val_if_fail (obj2 != NULL, NULL);
1214 retval = Accessibility_StateSet_compare (CSPI_OBJREF(obj), CSPI_OBJREF(obj2), cspi_ev ());
1219 * AccessibleStateSet_isEmpty:
1220 * @obj: a pointer to the #AccessibleStateSet object on which to operate.
1222 * Determine whether a given #AccessibleStateSet is the empty set.
1224 * Returns: #TRUE if the given #AccessibleStateSet contains no (true) states,
1229 AccessibleStateSet_isEmpty (AccessibleStateSet *obj)
1231 CORBA_boolean retval;
1233 cspi_return_val_if_fail (obj != NULL, FALSE);
1234 retval = Accessibility_StateSet_isEmpty (CSPI_OBJREF (obj), cspi_ev ());
1235 return (SPIBoolean) retval;