X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=cspi%2Fspi_accessible.c;h=e5d3f7bc76b297cf075a06597caa1cce0a8cba94;hb=bd703dfccbb700770f4629e5b5a8af45c3a8dfc3;hp=cb75a78a7d68738a38d405e816e2ef8e3df0bf14;hpb=72d587fda7e8dda1632a4a8f4010c6262ffc31be;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/cspi/spi_accessible.c b/cspi/spi_accessible.c index cb75a78..e5d3f7b 100644 --- a/cspi/spi_accessible.c +++ b/cspi/spi_accessible.c @@ -1,121 +1,266 @@ -#define MAX_ROLES 100 +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include /* for malloc */ +#include +#include -static char *role_names [MAX_ROLES] = +static const char *role_names [] = { - " ", - "accelerator label", + "invalid", + "accel-label", "alert", "animation", "arrow", "calendar", "canvas", - "check box", - "menu item", - "color chooser", - "column header", - "combo box", - "date editor", - "desktop icon", - "desktop frame", + "check-box", + "check-menu-item", + "color-chooser", + "column-header", + "combo-box", + "date-editor", + "desktop-icon", + "desktop-frame", "dial", "dialog", - "directory pane", - "drawing area", - "file chooser", + "directory-pane", + "drawing-area", + "file-chooser", "filler", - "font chooser", + "font-chooser", "frame", - "glass pane", - "HTML container", + "glass-pane", + "html-container", "icon", "image", - "internal frame", + "internalframe", "label", - "layered pane", + "layered-pane", "list", - "list item", + "list-item", "menu", - "menubar", - "menu item", - "option pane", - "page tab", - "page tab list", + "menu-bar", + "menu-item", + "option-pane", + "page-tab", + "page-tab-list", "panel", - "password text", - "popup menu", - "progress bar", - "pushbutton", - "radiobutton", - "radio menu item", - "root pane", - "row header", - "scrollbar", - "scrollpane", + "password-text", + "popup-menu", + "progress-bar", + "push-button", + "radio-button", + "radio-menu-item", + "root-pane", + "row-header", + "scroll-bar", + "scroll-pane", "separator", "slider", - "split pane", - "spin button", - "status bar", + "spin-button", + "split-pane", + "statusbar", "table", - "table cell", - "table column header", - "table row header", - "tearoff menu item", + "table-cell", + "table-column-header", + "table-row-header", + "tear-off-menu-item", + "terminal", "text", - "toggle button", - "toolbar", - "tooltip", + "toggle-button", + "tool-bar", + "tool-tip", "tree", - " ", + "tree-table", + "unknown", "viewport", "window", + NULL, + "header", + "fooler", + "paragraph", + "ruler", + "application" }; -/* - * Returns a localizable string name for an AtkRole enumerated type. - */ -char* -Accessible_Role_getName (Accessibility_Role role) +#define MAX_ROLES (sizeof (role_names) / sizeof (char *)) + +static SPIBoolean +cspi_init_role_table (AccessibleRole *role_table) { - if (role < MAX_ROLES) return role_names [(int) role]; - else return ""; + int i; + for (i = 0; i < Accessibility_ROLE_LAST_DEFINED; ++i) + { + role_table [i] = SPI_ROLE_UNKNOWN; + } + role_table [Accessibility_ROLE_INVALID] = SPI_ROLE_INVALID; + role_table [Accessibility_ROLE_ACCELERATOR_LABEL] = SPI_ROLE_ACCEL_LABEL; + role_table [Accessibility_ROLE_ALERT] = SPI_ROLE_ALERT; + role_table [Accessibility_ROLE_ANIMATION] = SPI_ROLE_ANIMATION; + role_table [Accessibility_ROLE_ARROW] = SPI_ROLE_ARROW; + role_table [Accessibility_ROLE_CALENDAR] = SPI_ROLE_CALENDAR; + role_table [Accessibility_ROLE_CANVAS] = SPI_ROLE_CANVAS; + role_table [Accessibility_ROLE_CHECK_BOX] = SPI_ROLE_CHECK_BOX; + role_table [Accessibility_ROLE_CHECK_MENU_ITEM] = SPI_ROLE_CHECK_MENU_ITEM; + role_table [Accessibility_ROLE_COLOR_CHOOSER] = SPI_ROLE_COLOR_CHOOSER; + role_table [Accessibility_ROLE_COLUMN_HEADER] = SPI_ROLE_COLUMN_HEADER; + role_table [Accessibility_ROLE_COMBO_BOX] = SPI_ROLE_COMBO_BOX; + role_table [Accessibility_ROLE_DATE_EDITOR] = SPI_ROLE_DATE_EDITOR; + role_table [Accessibility_ROLE_DESKTOP_ICON] = SPI_ROLE_DESKTOP_ICON; + role_table [Accessibility_ROLE_DESKTOP_FRAME] = SPI_ROLE_DESKTOP_FRAME; + role_table [Accessibility_ROLE_DIAL] = SPI_ROLE_DIAL; + role_table [Accessibility_ROLE_DIALOG] = SPI_ROLE_DIALOG; + role_table [Accessibility_ROLE_DIRECTORY_PANE] = SPI_ROLE_DIRECTORY_PANE; + role_table [Accessibility_ROLE_DRAWING_AREA] = SPI_ROLE_DRAWING_AREA; + role_table [Accessibility_ROLE_FILE_CHOOSER] = SPI_ROLE_FILE_CHOOSER; + role_table [Accessibility_ROLE_FILLER] = SPI_ROLE_FILLER; + role_table [Accessibility_ROLE_FONT_CHOOSER] = SPI_ROLE_FONT_CHOOSER; + role_table [Accessibility_ROLE_FRAME] = SPI_ROLE_FRAME; + role_table [Accessibility_ROLE_GLASS_PANE] = SPI_ROLE_GLASS_PANE; + role_table [Accessibility_ROLE_HTML_CONTAINER] = SPI_ROLE_HTML_CONTAINER; + role_table [Accessibility_ROLE_ICON] = SPI_ROLE_ICON; + role_table [Accessibility_ROLE_IMAGE] = SPI_ROLE_IMAGE; + role_table [Accessibility_ROLE_INTERNAL_FRAME] = SPI_ROLE_INTERNAL_FRAME; + role_table [Accessibility_ROLE_LABEL] = SPI_ROLE_LABEL; + role_table [Accessibility_ROLE_LAYERED_PANE] = SPI_ROLE_LAYERED_PANE; + role_table [Accessibility_ROLE_LIST] = SPI_ROLE_LIST; + role_table [Accessibility_ROLE_LIST_ITEM] = SPI_ROLE_LIST_ITEM; + role_table [Accessibility_ROLE_MENU] = SPI_ROLE_MENU; + role_table [Accessibility_ROLE_MENU_BAR] = SPI_ROLE_MENU_BAR; + role_table [Accessibility_ROLE_MENU_ITEM] = SPI_ROLE_MENU_ITEM; + role_table [Accessibility_ROLE_OPTION_PANE] = SPI_ROLE_OPTION_PANE; + role_table [Accessibility_ROLE_PAGE_TAB] = SPI_ROLE_PAGE_TAB; + role_table [Accessibility_ROLE_PAGE_TAB_LIST] = SPI_ROLE_PAGE_TAB_LIST; + role_table [Accessibility_ROLE_PANEL] = SPI_ROLE_PANEL; + role_table [Accessibility_ROLE_PASSWORD_TEXT] = SPI_ROLE_PASSWORD_TEXT; + role_table [Accessibility_ROLE_POPUP_MENU] = SPI_ROLE_POPUP_MENU; + role_table [Accessibility_ROLE_PROGRESS_BAR] = SPI_ROLE_PROGRESS_BAR; + role_table [Accessibility_ROLE_PUSH_BUTTON] = SPI_ROLE_PUSH_BUTTON; + role_table [Accessibility_ROLE_RADIO_BUTTON] = SPI_ROLE_RADIO_BUTTON; + role_table [Accessibility_ROLE_RADIO_MENU_ITEM] = SPI_ROLE_RADIO_MENU_ITEM; + role_table [Accessibility_ROLE_ROOT_PANE] = SPI_ROLE_ROOT_PANE; + role_table [Accessibility_ROLE_ROW_HEADER] = SPI_ROLE_ROW_HEADER; + role_table [Accessibility_ROLE_SCROLL_BAR] = SPI_ROLE_SCROLL_BAR; + role_table [Accessibility_ROLE_SCROLL_PANE] = SPI_ROLE_SCROLL_PANE; + role_table [Accessibility_ROLE_SEPARATOR] = SPI_ROLE_SEPARATOR; + role_table [Accessibility_ROLE_SLIDER] = SPI_ROLE_SLIDER; + role_table [Accessibility_ROLE_SPIN_BUTTON] = SPI_ROLE_SPIN_BUTTON; + role_table [Accessibility_ROLE_SPLIT_PANE] = SPI_ROLE_SPLIT_PANE; + role_table [Accessibility_ROLE_STATUS_BAR] = SPI_ROLE_STATUS_BAR; + role_table [Accessibility_ROLE_TABLE] = SPI_ROLE_TABLE; + role_table [Accessibility_ROLE_TABLE_CELL] = SPI_ROLE_TABLE_CELL; + role_table[Accessibility_ROLE_TABLE_COLUMN_HEADER] = SPI_ROLE_TABLE_COLUMN_HEADER; + role_table[Accessibility_ROLE_TABLE_ROW_HEADER] = SPI_ROLE_TABLE_ROW_HEADER; + role_table [Accessibility_ROLE_TEAROFF_MENU_ITEM] = SPI_ROLE_TEAROFF_MENU_ITEM; + role_table[Accessibility_ROLE_TERMINAL] = SPI_ROLE_TERMINAL; + role_table [Accessibility_ROLE_TEXT] = SPI_ROLE_TEXT; + role_table [Accessibility_ROLE_TOGGLE_BUTTON] = SPI_ROLE_TOGGLE_BUTTON; + role_table [Accessibility_ROLE_TOOL_BAR] = SPI_ROLE_TOOL_BAR; + role_table [Accessibility_ROLE_TOOL_TIP] = SPI_ROLE_TOOL_TIP; + role_table [Accessibility_ROLE_TREE] = SPI_ROLE_TREE; + role_table [Accessibility_ROLE_TREE_TABLE] = SPI_ROLE_TREE_TABLE; + role_table [Accessibility_ROLE_VIEWPORT] = SPI_ROLE_VIEWPORT; + role_table [Accessibility_ROLE_WINDOW] = SPI_ROLE_WINDOW; + role_table [Accessibility_ROLE_EXTENDED] = SPI_ROLE_EXTENDED; + role_table [Accessibility_ROLE_HEADER] = SPI_ROLE_HEADER; + role_table [Accessibility_ROLE_FOOTER] = SPI_ROLE_FOOTER; + role_table [Accessibility_ROLE_PARAGRAPH] = SPI_ROLE_PARAGRAPH; + role_table [Accessibility_ROLE_RULER] = SPI_ROLE_RULER; + role_table [Accessibility_ROLE_APPLICATION] = SPI_ROLE_APPLICATION; + role_table [Accessibility_ROLE_AUTOCOMPLETE] = SPI_ROLE_AUTOCOMPLETE; + role_table [Accessibility_ROLE_EDITBAR] = SPI_ROLE_EDITBAR; + role_table [Accessibility_ROLE_EMBEDDED] = SPI_ROLE_EMBEDDED; + + return TRUE; } +static AccessibleRole +cspi_role_from_spi_role (Accessibility_Role role) +{ + /* array is sized according to IDL roles because IDL roles are the index */ + static AccessibleRole cspi_role_table [Accessibility_ROLE_LAST_DEFINED]; + static SPIBoolean is_initialized = FALSE; + AccessibleRole cspi_role; + if (!is_initialized) + { + is_initialized = cspi_init_role_table (cspi_role_table); + } + if (role >= 0 && role < Accessibility_ROLE_LAST_DEFINED) + { + cspi_role = cspi_role_table [role]; + } + else + { + cspi_role = SPI_ROLE_EXTENDED; + } + return cspi_role; +} +/** + * AccessibleRole_getName: + * @role: an #AccessibleRole object to query. + * + * Get a localizeable string that indicates the name of an #AccessibleRole. + * DEPRECATED. + * + * Returns: a localizable string name for an #AccessibleRole enumerated type. + **/ +char * +AccessibleRole_getName (AccessibleRole role) +{ + if (role < MAX_ROLES && role_names [(int) role]) + { + return CORBA_string_dup (role_names [(int) role]); + } + else + { + return CORBA_string_dup (""); + } +} /** * Accessible_ref: * @obj: a pointer to the #Accessible object on which to operate. * * Increment the reference count for an #Accessible object. - * - * Returns: (no return code implemented yet). - * **/ -int +void Accessible_ref (Accessible *obj) { - Accessibility_Accessible_ref (*obj, &ev); - spi_check_ev (&ev, "ref"); - return 0; + cspi_object_ref (obj); } - /** * Accessible_unref: * @obj: a pointer to the #Accessible object on which to operate. * * Decrement the reference count for an #Accessible object. - * - * Returns: (no return code implemented yet). - * **/ -int +void Accessible_unref (Accessible *obj) { - Accessibility_Accessible_unref (*obj, &ev); - spi_check_ev (&ev, "unref"); - return 0; + cspi_object_unref (obj); } /** @@ -125,15 +270,19 @@ Accessible_unref (Accessible *obj) * Get the name of an #Accessible object. * * Returns: a UTF-8 string indicating the name of the #Accessible object. - * + * or NULL on exception **/ char * Accessible_getName (Accessible *obj) { - char *retval = - (char *) - Accessibility_Accessible__get_name (*obj, &ev); - spi_check_ev (&ev, "getName"); + char *retval; + + cspi_return_val_if_fail (obj != NULL, NULL); + + retval = Accessibility_Accessible__get_name (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getName", NULL); + return retval; } @@ -144,14 +293,20 @@ Accessible_getName (Accessible *obj) * Get the description of an #Accessible object. * * Returns: a UTF-8 string describing the #Accessible object. - * + * or NULL on exception **/ char * Accessible_getDescription (Accessible *obj) { - char *retval = (char *) - Accessibility_Accessible__get_description (*obj, &ev); - spi_check_ev (&ev, "getDescription"); + char *retval; + + cspi_return_val_if_fail (obj != NULL, NULL); + + retval = Accessibility_Accessible__get_description (CSPI_OBJREF (obj), + cspi_ev ()); + + cspi_return_val_if_ev ("getDescription", NULL); + return retval; } @@ -168,84 +323,132 @@ Accessible_getDescription (Accessible *obj) Accessible * Accessible_getParent (Accessible *obj) { - Accessible *retval = - Obj_Add (Accessibility_Accessible__get_parent (*obj, &ev)); - spi_check_ev (&ev, "getParent"); + Accessible *retval; + + cspi_return_val_if_fail (obj != NULL, NULL); + + retval = cspi_object_add ( + Accessibility_Accessible__get_parent (CSPI_OBJREF (obj), + cspi_ev ())); + + cspi_return_val_if_ev ("getParent", NULL); + return retval; } /** * Accessible_getChildCount: - * * @obj: a pointer to the #Accessible object on which to operate. * * Get the number of children contained by an #Accessible object. * * Returns: a #long indicating the number of #Accessible children - * contained by an #Accessible object. + * contained by an #Accessible object. or -1 on exception * **/ long Accessible_getChildCount (Accessible *obj) { - long retval = (long) Accessibility_Accessible__get_childCount (*obj, &ev); - spi_check_ev (&ev, "getChildCount"); + long retval; + + cspi_return_val_if_fail (obj != NULL, -1); + + retval = Accessibility_Accessible__get_childCount (CSPI_OBJREF (obj), + cspi_ev ()); + + cspi_return_val_if_ev ("getChildCount", -1); + return retval; } /** * Accessible_getChildAtIndex: - * * @obj: a pointer to the #Accessible object on which to operate. * @childIndex: a #long indicating which child is specified. * * Get the #Accessible child of an #Accessible object at a given index. * * Returns: a pointer to the #Accessible child object at index - * @childIndex. - * + * @childIndex. or NULL on exception **/ Accessible * Accessible_getChildAtIndex (Accessible *obj, - long childIndex) + long int childIndex) { - Accessible *retval = Obj_Add (Accessibility_Accessible_getChildAtIndex (*obj, childIndex, &ev)); - spi_check_ev (&ev, "getChildAtIndex"); + Accessible *retval; + + cspi_return_val_if_fail (obj != NULL, NULL); + + retval = cspi_object_add ( + Accessibility_Accessible_getChildAtIndex (CSPI_OBJREF (obj), + childIndex, cspi_ev ())); + + cspi_return_val_if_ev ("getChildAtIndex", NULL); return retval; } /** * Accessible_getIndexInParent: - * * @obj: a pointer to the #Accessible object on which to operate. * * Get the index of an #Accessible object in its containing #Accessible. * * Returns: a #long indicating the index of the #Accessible object * in its parent (i.e. containing) #Accessible instance, - * or -1 if @obj has no containing parent. - * + * or -1 if @obj has no containing parent or on exception. **/ long Accessible_getIndexInParent (Accessible *obj) { - long retval = (long) Accessibility_Accessible_getIndexInParent (*obj, &ev); - spi_check_ev (&ev, "getIndexInParent"); + long retval; + + cspi_return_val_if_fail (obj != NULL, -1); + + retval = Accessibility_Accessible_getIndexInParent (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getIndexInparent", -1); return retval; } /** * Accessible_getRelationSet: + * @obj: a pointer to the #Accessible object on which to operate. * - * Not Yet Implemented. - * - * Returns: a pointer to an array of #AccessibleRelations. + * Get the set of #AccessibleRelation objects which describe this #Accessible object's + * relationships with other #Accessible objects. * + * Returns: an array of #AccessibleRelation pointers. or NULL on exception **/ AccessibleRelation ** Accessible_getRelationSet (Accessible *obj) { - return NULL; + int i; + int n_relations; + AccessibleRelation **relations; + Accessibility_RelationSet *relation_set; + + cspi_return_val_if_fail (obj != NULL, NULL); + + g_assert (!cspi_exception ()); + + relation_set = + Accessibility_Accessible_getRelationSet (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getRelationSet", NULL); + + n_relations = relation_set->_length; + relations = malloc (sizeof (AccessibleRelation *) * (n_relations + 1)); + + for (i = 0; i < n_relations; ++i) + { + relations[i] = cspi_object_add (CORBA_Object_duplicate ( + relation_set->_buffer[i], cspi_ev ())); + } + relations[i] = NULL; + + CORBA_free (relation_set); + + return relations; } /** @@ -253,30 +456,108 @@ Accessible_getRelationSet (Accessible *obj) * @obj: a pointer to the #Accessible object on which to operate. * * Get the UI role of an #Accessible object. + * A UTF-8 string describing this role can be obtained via Accessible_getRoleName (). * - * Returns: a UTF-8 string indicating the UI role of the #Accessible object. + * Returns: the #AccessibleRole of the object. * **/ -char * +AccessibleRole Accessible_getRole (Accessible *obj) { - char *retval = Accessible_Role_getName ( - Accessibility_Accessible_getRole (*obj, &ev)); - spi_check_ev (&ev, "getRole"); + Accessibility_Role retval; + + cspi_return_val_if_fail (obj != NULL, SPI_ROLE_INVALID); + + retval = + Accessibility_Accessible_getRole (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getRole", SPI_ROLE_INVALID); + + return cspi_role_from_spi_role (retval); +} + +/** + * Accessible_getRoleName: + * @obj: a pointer to the #Accessible object on which to operate. + * + * Get a UTF-8 string describing the role this object plays in the UI. + * This method will return useful values for roles that fall outside the + * enumeration used in Accessible_getRole (). + * + * Returns: a UTF-8 string specifying the role of this #Accessible object. + * + **/ +char * +Accessible_getRoleName (Accessible *obj) +{ + char *retval; + + cspi_return_val_if_fail (obj != NULL, CORBA_string_dup ("invalid")); + + retval = + Accessibility_Accessible_getRoleName (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getRoleName", CORBA_string_dup ("invalid")); + return retval; } /** - * Accessible_getStateSet: + * Accessible_getLocalizedRoleName: + * @obj: a pointer to the #Accessible object on which to operate. * - * Not Yet Implemented. + * Get a UTF-8 string describing the (localized) role this object plays in the UI. + * This method will return useful values for roles that fall outside the + * enumeration used in Accessible_getRole (). + * + * Returns: a UTF-8 string specifying the role of this #Accessible object. + * + **/ +char * +Accessible_getLocalizedRoleName (Accessible *obj) +{ + char *retval; + + cspi_return_val_if_fail (obj != NULL, CORBA_string_dup ("invalid")); + + retval = + Accessibility_Accessible_getLocalizedRoleName (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getLocalizedRoleName", CORBA_string_dup ("invalid")); + + return retval; +} + +/** + * Accessible_getStateSet: + * @obj: a pointer to the #Accessible object on which to operate. * * Returns: a pointer to an #AccessibleStateSet representing the object's current state. **/ AccessibleStateSet * Accessible_getStateSet (Accessible *obj) { - return NULL; + AccessibleStateSet *retval; + Accessibility_StateSet corba_stateset; + Accessibility_StateSeq *corba_seq; + + cspi_return_val_if_fail (obj != NULL, NULL); + + corba_stateset = Accessibility_Accessible_getState ( + CSPI_OBJREF (obj), cspi_ev ()); + cspi_return_val_if_ev ("getState", NULL); + + cspi_return_val_if_fail (corba_stateset != CORBA_OBJECT_NIL, NULL); + cspi_return_val_if_fail (cspi_ping (corba_stateset), NULL); + corba_seq = Accessibility_StateSet_getStates (corba_stateset, cspi_ev ()); + cspi_return_val_if_ev ("getState", NULL); + + retval = spi_state_set_cache_new (corba_seq); + + CORBA_free (corba_seq); + cspi_release_unref (corba_stateset); + + return retval; } /* Interface query methods */ @@ -286,21 +567,31 @@ Accessible_getStateSet (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleAction. - * Not Yet Implemented. * * Returns: #TRUE if @obj implements the #AccessibleAction interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isAction (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Action:1.0", - &ev); - spi_warn_ev (&ev, "isAction"); + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Action:1.0"); +} - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; +/** + * Accessible_isApplication: + * @obj: a pointer to the #Accessible instance to query. + * + * Query whether the specified #Accessible implements #AccessibleApplication. + * + * Returns: #TRUE if @obj implements the #AccessibleApplication interface, + * #FALSE otherwise. + **/ +SPIBoolean +Accessible_isApplication (Accessible *obj) +{ + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Application:1.0"); } /** @@ -312,16 +603,11 @@ Accessible_isAction (Accessible *obj) * Returns: #TRUE if @obj implements the #AccessibleComponent interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isComponent (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Component:1.0", - &ev); - spi_warn_ev (&ev, "isComponent"); - - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Component:1.0"); } /** @@ -329,21 +615,15 @@ Accessible_isComponent (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleEditableText. - * Not Yet Implemented. * * Returns: #TRUE if @obj implements the #AccessibleEditableText interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isEditableText (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/EditableText:1.0", - &ev); - spi_check_ev (&ev, "isEditableText"); - - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; + return cspi_accessible_is_a (obj, + "IDL:Accessibility/EditableText:1.0"); } /** @@ -351,22 +631,15 @@ Accessible_isEditableText (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleHypertext. - * Not Yet Implemented. * * Returns: #TRUE if @obj implements the #AccessibleHypertext interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isHypertext (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Hypertext:1.0", - &ev); - - spi_check_ev (&ev, "isHypertext"); - - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Hypertext:1.0"); } /** @@ -374,21 +647,15 @@ Accessible_isHypertext (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleImage. - * Not Yet Implemented. * * Returns: #TRUE if @obj implements the #AccessibleImage interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isImage (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Image:1.0", - &ev); - spi_check_ev (&ev, "isImage"); - - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Image:1.0"); } /** @@ -396,22 +663,15 @@ Accessible_isImage (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleSelection. - * Not Yet Implemented. * * Returns: #TRUE if @obj implements the #AccessibleSelection interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isSelection (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Selection:1.0", - &ev); - spi_warn_ev (&ev, "isSelection"); - - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; - + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Selection:1.0"); } /** @@ -419,22 +679,32 @@ Accessible_isSelection (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleTable. - * Not Yet Implemented. * * Returns: #TRUE if @obj implements the #AccessibleTable interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isTable (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Table:1.0", - &ev); - spi_check_ev (&ev, "isTable"); - - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Table:1.0"); +} +/** + * Accessible_isStreamableContent: + * @obj: a pointer to the #Accessible instance to query. + * + * Query whether the specified #Accessible implements + * #AccessibleStreamableContent. + * + * Returns: #TRUE if @obj implements the #AccessibleStreamableContent interface, + * #FALSE otherwise. +**/ +SPIBoolean +Accessible_isStreamableContent (Accessible *obj) +{ + return cspi_accessible_is_a (obj, + "IDL:Accessibility/StreamableContent:1.0"); } /** @@ -442,21 +712,15 @@ Accessible_isTable (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleText. - * Not Yet Implemented. * * Returns: #TRUE if @obj implements the #AccessibleText interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isText (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Text:1.0", - &ev); - spi_warn_ev (&ev, "isText"); - - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Text:1.0"); } /** @@ -468,34 +732,43 @@ Accessible_isText (Accessible *obj) * Returns: #TRUE if @obj implements the #AccessibleValue interface, * #FALSE otherwise. **/ -boolean +SPIBoolean Accessible_isValue (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Value:1.0", - &ev); - spi_check_ev (&ev, "isValue"); + return cspi_accessible_is_a (obj, + "IDL:Accessibility/Value:1.0"); +} - return (CORBA_Object_is_nil (iface, &ev)) ? FALSE : TRUE; +/** + * Accessible_getApplication: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleApplication interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleApplication interface instance, or + * NULL if @obj does not implement #AccessibleApplication. + **/ +AccessibleApplication * +Accessible_getApplication (Accessible *obj) +{ + return (AccessibleApplication *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Application:1.0"); } /** * Accessible_getAction: + * @obj: a pointer to the #Accessible instance to query. * + * Get the #AccessibleAction interface for an #Accessible. * + * Returns: a pointer to an #AccessibleAction interface instance, or + * NULL if @obj does not implement #AccessibleAction. **/ AccessibleAction * Accessible_getAction (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Action:1.0", - &ev); - spi_check_ev (&ev, "getAction"); - - return (AccessibleAction *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleAction *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Action:1.0"); } /** @@ -510,113 +783,146 @@ Accessible_getAction (Accessible *obj) AccessibleComponent * Accessible_getComponent (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Component:1.0", - &ev); - spi_check_ev (&ev, "getComponent"); - - return (AccessibleComponent *) ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleComponent *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Component:1.0"); } +/** + * Accessible_getEditableText: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleEditableText interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleEditableText interface instance, or + * NULL if @obj does not implement #AccessibleEditableText. + **/ AccessibleEditableText * Accessible_getEditableText (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/EditableText:1.0", - &ev); - spi_check_ev (&ev, "getEditableText"); - - return (AccessibleEditableText *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleEditableText *) Accessible_queryInterface ( + obj, "IDL:Accessibility/EditableText:1.0"); } +/** + * Accessible_getHypertext: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleHypertext interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleHypertext interface instance, or + * NULL if @obj does not implement #AccessibleHypertext. + **/ AccessibleHypertext * Accessible_getHypertext (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Hypertext:1.0", - &ev); - spi_check_ev (&ev, "getHypertext"); - - return (AccessibleHypertext *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleHypertext *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Hypertext:1.0"); } +/** + * Accessible_getImage: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleImage interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleImage interface instance, or + * NULL if @obj does not implement #AccessibleImage. + **/ AccessibleImage * Accessible_getImage (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Image:1.0", - &ev); - spi_check_ev (&ev, "getImage"); - - return (AccessibleImage *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleImage *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Image:1.0"); } +/** + * Accessible_getSelection: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleSelection interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleSelection interface instance, or + * NULL if @obj does not implement #AccessibleSelection. + **/ AccessibleSelection * Accessible_getSelection (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Selection:1.0", - &ev); - spi_warn_ev (&ev, "getSelection"); - - return (AccessibleSelection *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleSelection *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Selection:1.0"); } +/** + * Accessible_getStreamableContent: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleStreamableContent interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleStreamableContent interface instance, or + * NULL if @obj does not implement #AccessibleStreamableContent. + **/ +AccessibleStreamableContent * +Accessible_getStreamableContent (Accessible *obj) +{ + return (AccessibleStreamableContent *) Accessible_queryInterface ( + obj, "IDL:Accessibility/StreamableContent:1.0"); +} + +/** + * Accessible_getTable: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleTable interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleTable interface instance, or + * NULL if @obj does not implement #AccessibleTable. + **/ AccessibleTable * Accessible_getTable (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Table:1.0", - &ev); - spi_check_ev (&ev, "getTable"); - - return (AccessibleTable *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleTable *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Table:1.0"); } +/** + * Accessible_getText: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleText interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleText interface instance, or + * NULL if @obj does not implement #AccessibleText. + **/ AccessibleText * Accessible_getText (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Text:1.0", - &ev); - - spi_check_ev (&ev, "getText"); - - return (AccessibleText *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleText *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Text:1.0"); } +/** + * Accessible_getValue: + * @obj: a pointer to the #Accessible instance to query. + * + * Get the #AccessibleValue interface for an #Accessible. + * + * Returns: a pointer to an #AccessibleValue interface instance, or + * NULL if @obj does not implement #AccessibleValue. + **/ AccessibleValue * Accessible_getValue (Accessible *obj) { - Bonobo_Unknown iface = - Accessibility_Accessible_queryInterface (*obj, - "IDL:Accessibility/Value:1.0", - &ev); - return (AccessibleValue *) - ((CORBA_Object_is_nil (iface, &ev)) ? 0 : Obj_Add (iface)); + return (AccessibleValue *) Accessible_queryInterface ( + obj, "IDL:Accessibility/Value:1.0"); } @@ -632,13 +938,374 @@ Accessible_getValue (Accessible *obj) * by @obj, or NULL otherwise. * **/ -GenericInterface * -Accessible_queryInterface (Accessible *obj, char *interface_name) +AccessibleUnknown * +Accessible_queryInterface (Accessible *obj, + const char *interface_name) +{ + Bonobo_Unknown iface; + + if (!obj) + { + return NULL; + } + + iface = Accessibility_Accessible_queryInterface (CSPI_OBJREF (obj), + interface_name, + cspi_ev ()); + + + cspi_return_val_if_ev ("queryInterface", NULL); + + /* + * FIXME: we need to be fairly sure that references are going + * to mach up if we are going to expose QueryInterface, ie. we + * can't allow people to do: + * b = a.qi ("b"); b.unref, b.unref to release a's reference. + * this should be no real problem though for this level of API + * user. + */ + + return cspi_object_add (iface); +} + + +/** + * AccessibleRelation_ref: + * @obj: a pointer to the #AccessibleRelation object on which to operate. + * + * Increment the reference count for an #AccessibleRelation object. + * + **/ +void +AccessibleRelation_ref (AccessibleRelation *obj) +{ + cspi_object_ref (obj); +} + +/** + * AccessibleRelation_unref: + * @obj: a pointer to the #AccessibleRelation object on which to operate. + * + * Decrement the reference count for an #AccessibleRelation object. + * + **/ +void +AccessibleRelation_unref (AccessibleRelation *obj) +{ + cspi_object_unref (obj); +} + +static SPIBoolean +cspi_init_relation_type_table (AccessibleRelationType *relation_type_table) +{ + int i; + for (i = 0; i < Accessibility_RELATION_LAST_DEFINED; ++i) + { + relation_type_table [i] = SPI_RELATION_NULL; + } + relation_type_table [Accessibility_RELATION_NULL] = SPI_RELATION_NULL; + relation_type_table [Accessibility_RELATION_LABEL_FOR] = SPI_RELATION_LABEL_FOR; + relation_type_table [Accessibility_RELATION_LABELLED_BY] = SPI_RELATION_LABELED_BY; + relation_type_table [Accessibility_RELATION_CONTROLLER_FOR] = SPI_RELATION_CONTROLLER_FOR; + relation_type_table [Accessibility_RELATION_CONTROLLED_BY] = SPI_RELATION_CONTROLLED_BY; + relation_type_table [Accessibility_RELATION_MEMBER_OF] = SPI_RELATION_MEMBER_OF; + relation_type_table [Accessibility_RELATION_TOOLTIP_FOR] = SPI_RELATION_NULL; + relation_type_table [Accessibility_RELATION_NODE_CHILD_OF] = SPI_RELATION_NODE_CHILD_OF; + relation_type_table [Accessibility_RELATION_EXTENDED] = SPI_RELATION_EXTENDED; + relation_type_table [Accessibility_RELATION_FLOWS_TO] = SPI_RELATION_FLOWS_TO; + relation_type_table [Accessibility_RELATION_FLOWS_FROM] = SPI_RELATION_FLOWS_FROM; + relation_type_table [Accessibility_RELATION_SUBWINDOW_OF] = SPI_RELATION_SUBWINDOW_OF; + relation_type_table [Accessibility_RELATION_EMBEDS] = SPI_RELATION_EMBEDS; + relation_type_table [Accessibility_RELATION_EMBEDDED_BY] = SPI_RELATION_EMBEDDED_BY; + relation_type_table [Accessibility_RELATION_POPUP_FOR] = SPI_RELATION_POPUP_FOR; + return TRUE; +} + +static AccessibleRelationType +cspi_relation_type_from_spi_relation_type (Accessibility_RelationType type) +{ + /* array is sized according to IDL RelationType because IDL RelationTypes are the index */ + static AccessibleRelationType cspi_relation_type_table [Accessibility_RELATION_LAST_DEFINED]; + static SPIBoolean is_initialized = FALSE; + AccessibleRelationType cspi_type; + if (!is_initialized) + { + is_initialized = cspi_init_relation_type_table (cspi_relation_type_table); + } + if (type >= 0 && type < Accessibility_RELATION_LAST_DEFINED) + { + cspi_type = cspi_relation_type_table [type]; + } + else + { + cspi_type = SPI_RELATION_NULL; + } + return cspi_type; +} +/** + * AccessibleRelation_getRelationType: + * @obj: a pointer to the #AccessibleRelation object to query. + * + * Get the type of relationship represented by an #AccessibleRelation. + * + * Returns: an #AccessibleRelationType indicating the type of relation + * encapsulated in this #AccessibleRelation object. + * + **/ +AccessibleRelationType +AccessibleRelation_getRelationType (AccessibleRelation *obj) +{ + Accessibility_RelationType retval; + + cspi_return_val_if_fail (obj, SPI_RELATION_NULL); + retval = + Accessibility_Relation_getRelationType (CSPI_OBJREF (obj), cspi_ev()); + cspi_return_val_if_ev ("getRelationType", SPI_RELATION_NULL); + return cspi_relation_type_from_spi_relation_type (retval); +} + +/** + * AccessibleRelation_getNTargets: + * @obj: a pointer to the #AccessibleRelation object to query. + * + * Get the number of objects which this relationship has as its + * target objects (the subject is the #Accessible from which this + * #AccessibleRelation originated). + * + * Returns: a short integer indicating how many target objects which the + * originating #Accessible object has the #AccessibleRelation + * relationship with. + **/ +int +AccessibleRelation_getNTargets (AccessibleRelation *obj) { - GenericInterface iface; - iface = Accessibility_Accessible_queryInterface (*obj, - interface_name, - &ev); - return (iface != NULL) ? Obj_Add (iface) : NULL; + int retval; + + cspi_return_val_if_fail (obj, -1); + retval = Accessibility_Relation_getNTargets (CSPI_OBJREF (obj), cspi_ev()); + cspi_return_val_if_ev ("getNTargets", -1); + return retval; } +/** + * AccessibleRelation_getTarget: + * @obj: a pointer to the #AccessibleRelation object to query. + * @i: a (zero-index) integer indicating which (of possibly several) target is requested. + * + * Get the @i-th target of a specified #AccessibleRelation relationship. + * + * Returns: an #Accessible which is the @i-th object with which the + * originating #Accessible has relationship specified in the + * #AccessibleRelation object. + * + **/ +Accessible * +AccessibleRelation_getTarget (AccessibleRelation *obj, int i) +{ + Accessible *retval; + + cspi_return_val_if_fail (obj, NULL); + + retval = cspi_object_add ( + Accessibility_Relation_getTarget (CSPI_OBJREF(obj), + i, cspi_ev())); + cspi_return_val_if_ev ("getTarget", NULL); + return retval; +} + +/** + * AccessibleStateSet_ref: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * + * Increment the reference count for an #AccessibleStateSet object. + * + **/ +void +AccessibleStateSet_ref (AccessibleStateSet *obj) +{ + spi_state_set_cache_ref (obj); +} + +/** + * AccessibleStateSet_unref: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * + * Decrement the reference count for an #AccessibleStateSet object. + * + **/ +void +AccessibleStateSet_unref (AccessibleStateSet *obj) +{ + spi_state_set_cache_unref (obj); +} + +static Accessibility_StateType +spi_state_to_corba (AccessibleState state) +{ +#define MAP_STATE(a) \ + case SPI_STATE_##a: \ + return Accessibility_STATE_##a + + switch (state) + { + MAP_STATE (INVALID); + MAP_STATE (ACTIVE); + MAP_STATE (ARMED); + MAP_STATE (BUSY); + MAP_STATE (CHECKED); + MAP_STATE (DEFUNCT); + MAP_STATE (EDITABLE); + MAP_STATE (ENABLED); + MAP_STATE (EXPANDABLE); + MAP_STATE (EXPANDED); + MAP_STATE (FOCUSABLE); + MAP_STATE (FOCUSED); + MAP_STATE (HORIZONTAL); + MAP_STATE (ICONIFIED); + MAP_STATE (MODAL); + MAP_STATE (MULTI_LINE); + MAP_STATE (MULTISELECTABLE); + MAP_STATE (OPAQUE); + MAP_STATE (PRESSED); + MAP_STATE (RESIZABLE); + MAP_STATE (SELECTABLE); + MAP_STATE (SELECTED); + MAP_STATE (SENSITIVE); + MAP_STATE (SHOWING); + MAP_STATE (SINGLE_LINE); + MAP_STATE (STALE); + MAP_STATE (TRANSIENT); + MAP_STATE (VERTICAL); + MAP_STATE (VISIBLE); + MAP_STATE (MANAGES_DESCENDANTS); + MAP_STATE (INDETERMINATE); + default: + return Accessibility_STATE_INVALID; + } +#undef MAP_STATE +} + +/** + * AccessibleStateSet_contains: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * @state: an #AccessibleState for which the specified #AccessibleStateSet + * will be queried. + * + * Determine whether a given #AccessibleStateSet includes a given state; that is, + * whether @state is true for the stateset in question. + * + * Returns: #TRUE if @state is true/included in the given #AccessibleStateSet, + * otherwise #FALSE. + * + **/ +SPIBoolean +AccessibleStateSet_contains (AccessibleStateSet *obj, + AccessibleState state) +{ + return spi_state_set_cache_contains (obj, spi_state_to_corba (state)); +} + +/** + * AccessibleStateSet_add: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * @state: an #AccessibleState to be added to the specified #AccessibleStateSet + * + * Add a particular #AccessibleState to an #AccessibleStateSet (i.e. set the + * given state to #TRUE in the stateset. + * + **/ +void +AccessibleStateSet_add (AccessibleStateSet *obj, + AccessibleState state) +{ + spi_state_set_cache_add (obj, spi_state_to_corba (state)); +} + +/** + * AccessibleStateSet_remove: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * @state: an #AccessibleState to be removed from the specified #AccessibleStateSet + * + * Remove a particular #AccessibleState to an #AccessibleStateSet (i.e. set the + * given state to #FALSE in the stateset.) + * + **/ +void +AccessibleStateSet_remove (AccessibleStateSet *obj, + AccessibleState state) +{ + spi_state_set_cache_remove (obj, spi_state_to_corba (state)); +} + +/** + * AccessibleStateSet_equals: + * @obj: a pointer to the first #AccessibleStateSet object on which to operate. + * @obj2: a pointer to the second #AccessibleStateSet object on which to operate. + * + * Determine whether two instances of #AccessibleStateSet are equivalent (i.e. + * consist of the same #AccessibleStates). Useful for checking multiple + * state variables at once; construct the target state then compare against it. + * + * @see AccessibleStateSet_compare(). + * + * Returns: #TRUE if the two #AccessibleStateSets are equivalent, + * otherwise #FALSE. + * + **/ +SPIBoolean +AccessibleStateSet_equals (AccessibleStateSet *obj, + AccessibleStateSet *obj2) +{ + SPIBoolean eq; + AtkStateSet *cmp; + + if (obj == obj2) + { + return TRUE; + } + + cmp = spi_state_set_cache_xor (obj, obj2); + eq = spi_state_set_cache_is_empty (cmp); + spi_state_set_cache_unref (cmp); + + return eq; +} + +/** + * AccessibleStateSet_compare: + * @obj: a pointer to the first #AccessibleStateSet object on which to operate. + * @obj2: a pointer to the second #AccessibleStateSet object on which to operate. + * + * Determine the differences between two instances of #AccessibleStateSet. + * Not Yet Implemented. + *. + * @see AccessibleStateSet_equals(). + * + * Returns: an #AccessibleStateSet object containing all states contained on one of + * the two sets but not the other. + * + **/ +AccessibleStateSet * +AccessibleStateSet_compare (AccessibleStateSet *obj, + AccessibleStateSet *obj2) +{ + return spi_state_set_cache_xor (obj, obj2); +} + +/** + * AccessibleStateSet_isEmpty: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * + * Determine whether a given #AccessibleStateSet is the empty set. + * + * Returns: #TRUE if the given #AccessibleStateSet contains no (true) states, + * otherwise #FALSE. + * + **/ +SPIBoolean +AccessibleStateSet_isEmpty (AccessibleStateSet *obj) +{ + return spi_state_set_cache_is_empty (obj); +} + +