X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git;a=blobdiff_plain;f=cspi%2Fspi_accessible.c;h=ca366c15b2e77eb505286efd37e2d8e89ba56447;hp=f418ba15dba0f4b525578982515ef8af1b21940f;hb=d35cd400a36b0f1393c17ce47015bf753327ccae;hpb=7ff7c0d0b863f7346f21e03b6d170e8c7c6f9878 diff --git a/cspi/spi_accessible.c b/cspi/spi_accessible.c index f418ba1..ca366c1 100644 --- a/cspi/spi_accessible.c +++ b/cspi/spi_accessible.c @@ -1,34 +1,26 @@ -#define MAX_ROLES 100 +#include /* for malloc */ +#include -static char *role_names [MAX_ROLES] = +static const char *role_names [] = { - " ", - "accelerator label", + "", "alert", - "animation", - "arrow", - "calendar", "canvas", "check box", - "menu item", "color chooser", "column header", "combo box", - "date editor", "desktop icon", "desktop frame", - "dial", "dialog", "directory pane", - "drawing area", "file chooser", "filler", - "font chooser", + "focus traversable", "frame", "glass pane", "HTML container", "icon", - "image", "internal frame", "label", "layered pane", @@ -46,7 +38,6 @@ static char *role_names [MAX_ROLES] = "progress bar", "pushbutton", "radiobutton", - "radio menu item", "root pane", "row header", "scrollbar", @@ -54,34 +45,62 @@ static char *role_names [MAX_ROLES] = "separator", "slider", "split pane", - "spin button", - "status bar", "table", "table cell", "table column header", "table row header", - "tearoff menu item", "text", "toggle button", "toolbar", "tooltip", "tree", - " ", + "", "viewport", "window", -}; -/* - * Returns a localizable string name for an AtkRole enumerated type. - */ -char* -Accessible_Role_getName (Accessibility_Role role) -{ - if (role < MAX_ROLES) return role_names [(int) role]; - else return ""; -} + /* These have no equivalent AccessibleRole enum values */ + "accelerator label", + "animation", + "arrow", + "calendar", + "menu item", + "date editor", + "dial", + "drawing area", + "font chooser", + "image", + "radio menu item", + "tearoff menu item", + "spin button", + "status bar", +}; +#define MAX_ROLES (sizeof (role_names) / sizeof (char *)) +/** + * AccessibleRole_getName: + * @role: an #AccessibleRole object to query. + * + * Get a localizeable string that indicates the name of an #AccessibleRole. + * + * Returns: a localizable string name for an #AccessibleRole enumerated type. + **/ +const char * +AccessibleRole_getName (AccessibleRole role) +{ + if (role < MAX_ROLES) + { + return role_names [(int) role]; + } + else + { + return ""; + } + /* + * TODO: replace with implementation linked to ATK, which + * now supports Role/Name mapping + */ +} /** * Accessible_ref: @@ -92,30 +111,23 @@ Accessible_Role_getName (Accessibility_Role role) * 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 +137,20 @@ 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 = (char *) + Accessibility_Accessible__get_name (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getName", NULL); + return retval; } @@ -144,14 +161,21 @@ 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 = (char *) + Accessibility_Accessible__get_description (CSPI_OBJREF (obj), + cspi_ev ()); + + cspi_return_val_if_ev ("getDescription", NULL); + return retval; } @@ -168,84 +192,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 = (long) + 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 ())); + 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 = (long) + 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); + + relation_set = + Accessibility_Accessible_getRelationSet (CSPI_OBJREF (obj), cspi_ev ()); + + cspi_return_val_if_ev ("getRelationSet", NULL); + + /* this looks hack-ish, but it's based on the CORBA C bindings spec */ + n_relations = relation_set->_length; + relations = malloc (sizeof (AccessibleRelation *) * n_relations); + + for (i = 0; i < n_relations; ++i) + { + relations[i] = cspi_object_add (CORBA_Object_duplicate ( + relation_set->_buffer[i], cspi_ev ())); + } + relations[i] = CORBA_OBJECT_NIL; + + CORBA_free (relation_set); + + return relations; } /** @@ -257,17 +329,24 @@ Accessible_getRelationSet (Accessible *obj) * Returns: a UTF-8 string indicating the UI role of the #Accessible object. * **/ -char * +const char * Accessible_getRole (Accessible *obj) { - char *retval = Accessible_Role_getName ( - Accessibility_Accessible_getRole (*obj, &ev)); - spi_check_ev (&ev, "getRole"); + const char *retval; + + cspi_return_val_if_fail (obj != NULL, NULL); + + retval = AccessibleRole_getName ( + Accessibility_Accessible_getRole (CSPI_OBJREF (obj), cspi_ev ())); + + cspi_return_val_if_ev ("getRole", NULL); + return retval; } /** * Accessible_getStateSet: + * @obj: a pointer to the #Accessible object on which to operate. * * Not Yet Implemented. * @@ -286,21 +365,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 +401,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 +413,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 +429,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,44 +445,31 @@ 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"); } /** - * Accessible_isSelection: + * Accessible_isSelection: * @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 +477,15 @@ 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"); } /** @@ -442,21 +493,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"); } /** @@ -464,40 +509,47 @@ Accessible_isText (Accessible *obj) * @obj: a pointer to the #Accessible instance to query. * * Query whether the specified #Accessible implements #AccessibleValue. - * Not Yet Implemented. * * 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. * - * Not Yet Implemented. + * 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"); } /** @@ -512,113 +564,130 @@ 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_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"); } @@ -635,12 +704,286 @@ Accessible_getValue (Accessible *obj) * **/ GenericInterface * -Accessible_queryInterface (Accessible *obj, char *interface_name) +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. + * + * Returns: (no return code implemented yet). + **/ +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. + * + * Returns: (no return code implemented yet). + **/ +void +AccessibleRelation_unref (AccessibleRelation *obj) +{ + cspi_object_unref (obj); +} + +/** + * 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) +{ + cspi_return_val_if_fail (obj != NULL, -1); + return 0; +} + +/** + * 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) +{ + cspi_return_val_if_fail (obj != NULL, -1); + return 0; +} + +/** + * 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) +{ + cspi_return_val_if_fail (obj != NULL, NULL); + return NULL; +} + +/** + * AccessibleStateSet_ref: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * + * Increment the reference count for an #AccessibleStateSet object. + * + * Returns: (no return code implemented yet). + * + **/ +void +AccessibleStateSet_ref (AccessibleStateSet *obj) { - GenericInterface iface; - iface = Accessibility_Accessible_queryInterface (*obj, - interface_name, - &ev); - return (iface != NULL) ? Obj_Add (iface) : NULL; + cspi_object_ref (obj); } +/** + * AccessibleStateSet_unref: + * @obj: a pointer to the #AccessibleStateSet object on which to operate. + * + * Decrement the reference count for an #AccessibleStateSet object. + * + * Returns: (no return code implemented yet). + * + **/ +void +AccessibleStateSet_unref (AccessibleStateSet *obj) +{ + cspi_object_unref (obj); +} + +/** + * 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) +{ + CORBA_boolean retval; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + retval = Accessibility_StateSet_contains (CSPI_OBJREF (obj), + state, cspi_ev ()); + + cspi_return_val_if_ev ("contains", FALSE); + + return (SPIBoolean) retval; +} + +/** + * 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) +{ + cspi_return_if_fail (obj != NULL); + + Accessibility_StateSet_add (CSPI_OBJREF (obj), state, cspi_ev ()); + cspi_check_ev ("add"); +} + +/** + * 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) +{ + cspi_return_if_fail (obj != NULL); + + Accessibility_StateSet_remove (CSPI_OBJREF (obj), state, cspi_ev ()); + cspi_check_ev ("remove"); +} + +/** + * 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) +{ + if (obj == obj2) + { + return TRUE; + } + + cspi_return_val_if_fail (obj != NULL, FALSE); + cspi_return_val_if_fail (obj2 != NULL, FALSE); + + return Accessibility_StateSet_equals (CSPI_OBJREF (obj), + CSPI_OBJREF (obj2), cspi_ev ()); +} + +/** + * 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) +{ + cspi_return_val_if_fail (obj != NULL, NULL); + cspi_return_val_if_fail (obj2 != NULL, NULL); + return NULL; +} + +/** + * 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) +{ + cspi_return_val_if_fail (obj != NULL, FALSE); + return TRUE; + /* return Accessibility_StateSet_isEmpty (CSPI_OBJREF (obj), cspi_ev ());*/ +} + +