static const char *role_names [] =
{
"<invalid>",
+ "accelerator label",
"alert",
+ "animation",
+ "arrow",
+ "calendar",
"canvas",
"check box",
"color chooser",
"column header",
"combo box",
+ "date editor",
"desktop icon",
"desktop frame",
"dialog",
"file chooser",
"filler",
"focus traversable",
+ "font chooser",
"frame",
"glass pane",
"HTML container",
"icon",
+ "image",
"internal frame",
"label",
"layered pane",
"progress bar",
"pushbutton",
"radiobutton",
+ "radio menu item",
"root pane",
"row header",
"scrollbar",
"scrollpane",
"separator",
"slider",
+ "spin button",
"split pane",
+ "status bar",
"table",
"table cell",
"table column header",
"table row header",
+ "tearoff menu item",
"text",
"toggle button",
"toolbar",
"viewport",
"window",
- /* 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 *))
+static AccessibleRole
+cspi_role_from_spi_role (Accessibility_Role role)
+{
+ return role; /* FIXME: need to compare, equivalence not guaranteed */
+}
+
/**
* AccessibleRole_getName:
* @role: an #AccessibleRole object to query.
*
* Get a localizeable string that indicates the name of an #AccessibleRole.
+ * Currently broken, do not use.
*
* Returns: a localizable string name for an #AccessibleRole enumerated type.
**/
-const char *
+char *
AccessibleRole_getName (AccessibleRole role)
{
if (role < MAX_ROLES)
{
- return role_names [(int) role];
+ return g_strdup (role_names [(int) role]);
}
else
{
- return "";
+ return g_strdup ("");
}
- /*
- * TODO: replace with implementation linked to ATK, which
- * now supports Role/Name mapping
- */
}
/**
* @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).
- *
**/
void
Accessible_ref (Accessible *obj)
* @obj: a pointer to the #Accessible object on which to operate.
*
* Decrement the reference count for an #Accessible object.
- *
**/
void
Accessible_unref (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.
*
**/
-const char *
+AccessibleRole
Accessible_getRole (Accessible *obj)
{
- const char *retval;
+ AccessibleRole retval;
- cspi_return_val_if_fail (obj != NULL, NULL);
+ cspi_return_val_if_fail (obj != NULL, SPI_ROLE_INVALID);
+
+ retval =
+ Accessibility_Accessible_getRole (CSPI_OBJREF (obj), cspi_ev ());
- retval = AccessibleRole_getName (
- Accessibility_Accessible_getRole (CSPI_OBJREF (obj), cspi_ev ()));
+ cspi_return_val_if_ev ("getRole", SPI_ROLE_INVALID);
- cspi_return_val_if_ev ("getRole", NULL);
+ 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;
}
* by @obj, or NULL otherwise.
*
**/
-GenericInterface *
+AccessibleUnknown *
Accessible_queryInterface (Accessible *obj,
const char *interface_name)
{
*
* Increment the reference count for an #AccessibleRelation object.
*
- * Returns: (no return code implemented yet).
**/
void
AccessibleRelation_ref (AccessibleRelation *obj)
*
* Decrement the reference count for an #AccessibleRelation object.
*
- * Returns: (no return code implemented yet).
**/
void
AccessibleRelation_unref (AccessibleRelation *obj)
*
* Increment the reference count for an #AccessibleStateSet object.
*
- * Returns: (no return code implemented yet).
- *
**/
void
AccessibleStateSet_ref (AccessibleStateSet *obj)
*
* Decrement the reference count for an #AccessibleStateSet object.
*
- * Returns: (no return code implemented yet).
- *
**/
void
AccessibleStateSet_unref (AccessibleStateSet *obj)