diff options
author | Padraig O'Briain <padraigo@src.gnome.org> | 2002-10-30 09:42:30 +0000 |
---|---|---|
committer | Padraig O'Briain <padraigo@src.gnome.org> | 2002-10-30 09:42:30 +0000 |
commit | 3cc3023a48d1dea633aa141bf25cf07c31200121 (patch) | |
tree | 40d3f0ffa636df9d1abd0e1a09975ba0330959ae /atk/atkobject.c | |
parent | db59cabaac06c79f770b580a349a97d5762a3930 (diff) | |
download | atk-3cc3023a48d1dea633aa141bf25cf07c31200121.tar.gz |
Add reference to atk/atkrelationtype.h
* atk/Makefile.am, atk/atk.h: Add reference to atk/atkrelationtype.h
* atk/atkaction.[ch]: Add atk_action_get_localized_name.
* atk/atkobject.[ch]: Add atk_role_get_localized_name,
atk_object_add_relationship and atk_object_remove_relationship
Add new roles ATK_ROLE_HEADER, ATK_ROLE_FOOTER, ATK_ROLE_PARAGRAPH
and ATK_ROLE_RULER
* atk/atkrelation.h: Move definition of AtkRelationType to
atk/relationtype.h
* atk/atkstate.h: Add new state ATK_STATE_MANAGES_DESCENDANTS
* atk/atktext.[ch]: Add text-attributes-changed signal.
* docs/atk-sections.txt, docs/tmpl/atkaction.sgml: Add new functions.
* docs/tmpl/atkobject.sgml: Add new functions and new roles.
* docs/tmpl/atkrelation.sgml: Add new relations
* docs/tmpl/atkstate.sgml: Add new state
* docs/tmpl/atktext.sgml: Add new signal
* tests/testrelation.c: Add tests for new relationship functions.
Diffstat (limited to 'atk/atkobject.c')
-rwxr-xr-x | atk/atkobject.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/atk/atkobject.c b/atk/atkobject.c index bb2b110..2d0d023 100755 --- a/atk/atkobject.c +++ b/atk/atkobject.c @@ -1142,6 +1142,23 @@ atk_role_get_name (AtkRole role) } /** + * atk_role_get_localized_name: + * @role: The #AtkRole whose localized name is required + * + * Gets the localized description string describing the #Roleype @role. + * + * Returns: the localized string describing the AtkRole + **/ +G_CONST_RETURN gchar* +atk_role_get_localized_name (AtkRole role) +{ + G_CONST_RETURN gchar *name; + + name = atk_role_get_name (role); + return name; +} + +/** * atk_role_for_name: * @name: a string which is the (non-localized) name of an ATK role. * @@ -1193,3 +1210,77 @@ atk_role_for_name (const gchar *name) return role; } + +/** + * atk_object_add_relationship: + * @object: The #AtkObject to which an AtkRelation is to be added. + * @relationship: The #AtkRelationType of the relation + * @target: The #AtkObject which is to be the target of the relation. + * + * Adds a relationship of the specified type with the specified target. + * + * Returns TRUE if the relationship is added. + **/ +gboolean +atk_object_add_relationship (AtkObject *object, + AtkRelationType relationship, + AtkObject *target) +{ + AtkObject *array[1]; + AtkRelation *relation; + + g_return_val_if_fail (ATK_IS_OBJECT (object), FALSE); + g_return_val_if_fail (ATK_IS_OBJECT (target), FALSE); + + array[0] = target; + relation = atk_relation_new (array, 1, relationship); + atk_relation_set_add (object->relation_set, relation); + g_object_unref (relation); + + return TRUE; +} + +/** + * atk_object_remove_relationship: + * @object: The #AtkObject from which an AtkRelation is to be removed. + * @relationship: The #AtkRelationType of the relation + * @target: The #AtkObject which is the target of the relation to be removed. + * + * Removes a relationship of the specified type with the specified target. + * + * Returns TRUE if the relationship is removed. + **/ +gboolean +atk_object_remove_relationship (AtkObject *object, + AtkRelationType relationship, + AtkObject *target) +{ + gint n_relations, i; + gboolean ret = FALSE; + AtkRelation *relation; + + g_return_val_if_fail (ATK_IS_OBJECT (object), FALSE); + g_return_val_if_fail (ATK_IS_OBJECT (target), FALSE); + + n_relations = atk_relation_set_get_n_relations (object->relation_set); + for (i = 0; i < n_relations; i++) + { + relation = atk_relation_set_get_relation (object->relation_set, i); + if (atk_relation_get_relation_type (relation) == relationship) + { + GPtrArray *array; + gint j; + + array = atk_relation_get_target (relation); + + if (g_ptr_array_index (array, 0) == target) + { + atk_relation_set_remove (object->relation_set, relation); + ret = TRUE; + break; + } + } + } + + return ret; +} |