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 | |
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')
-rw-r--r-- | atk/Makefile.am | 1 | ||||
-rwxr-xr-x | atk/atk.h | 1 | ||||
-rwxr-xr-x | atk/atkaction.c | 26 | ||||
-rwxr-xr-x | atk/atkaction.h | 8 | ||||
-rwxr-xr-x | atk/atkobject.c | 91 | ||||
-rwxr-xr-x | atk/atkobject.h | 21 | ||||
-rwxr-xr-x | atk/atkrelation.h | 27 | ||||
-rwxr-xr-x | atk/atkrelationtype.h | 64 | ||||
-rwxr-xr-x | atk/atkstate.h | 4 | ||||
-rwxr-xr-x | atk/atktext.c | 9 | ||||
-rwxr-xr-x | atk/atktext.h | 3 |
11 files changed, 225 insertions, 30 deletions
diff --git a/atk/Makefile.am b/atk/Makefile.am index 9d7ddc6..9e35747 100644 --- a/atk/Makefile.am +++ b/atk/Makefile.am @@ -98,6 +98,7 @@ atk_headers = \ atkimage.h \ atkregistry.h \ atkrelation.h \ + atkrelationtype.h \ atkrelationset.h \ atkselection.h \ atkstate.h \ @@ -35,6 +35,7 @@ #include <atk/atkregistry.h> #include <atk/atkrelation.h> #include <atk/atkrelationset.h> +#include <atk/atkrelationtype.h> #include <atk/atkselection.h> #include <atk/atkstate.h> #include <atk/atkstateset.h> diff --git a/atk/atkaction.c b/atk/atkaction.c index 201243c..d612758 100755 --- a/atk/atkaction.c +++ b/atk/atkaction.c @@ -144,6 +144,32 @@ atk_action_get_name (AtkAction *obj, } /** + * atk_action_get_localized_name: + * @action: a #GObject instance that implements AtkActionIface + * @i: the action index corresponding to the action to be performed + * + * Returns the localized name of the specified action of the object. + * + * Returns a name string, or %NULL + * if @action does not implement this interface. + **/ +G_CONST_RETURN gchar* +atk_action_get_localized_name (AtkAction *obj, + gint i) +{ + AtkActionIface *iface; + + g_return_val_if_fail (ATK_IS_ACTION (obj), NULL); + + iface = ATK_ACTION_GET_IFACE (obj); + + if (iface->get_localized_name) + return (iface->get_localized_name) (obj, i); + else + return NULL; +} + +/** * atk_action_get_keybinding: * @action: a #GObject instance that implements AtkActionIface * @i: the action index corresponding to the action to be performed diff --git a/atk/atkaction.h b/atk/atkaction.h index 1ecdc9c..8dfee9f 100755 --- a/atk/atkaction.h +++ b/atk/atkaction.h @@ -62,8 +62,8 @@ struct _AtkActionIface gboolean (*set_description) (AtkAction *action, gint i, const gchar *desc); - - AtkFunction pad1; + G_CONST_RETURN gchar* (*get_localized_name)(AtkAction *action, + gint i); AtkFunction pad2; }; @@ -93,6 +93,10 @@ gboolean atk_action_set_description (AtkAction *action, gint i, const gchar *desc); +/* NEW in ATK 1.1: */ + +G_CONST_RETURN gchar* atk_action_get_localized_name (AtkAction *action, + gint i); /* * Additional GObject properties exported by AtkAction: 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; +} diff --git a/atk/atkobject.h b/atk/atkobject.h index fa84790..27e181e 100755 --- a/atk/atkobject.h +++ b/atk/atkobject.h @@ -26,6 +26,7 @@ extern "C" { #include <glib-object.h> #include <atk/atkstate.h> +#include <atk/atkrelationtype.h> /* * AtkObject represents the minimum information all accessible objects @@ -107,7 +108,11 @@ extern "C" { *@ATK_ROLE_TREE_TABLE: An object capable of expanding and collapsing rows as well as showing multiple columns of data *@ATK_ROLE_UNKNOWN: The object contains some Accessible information, but its role is not known *@ATK_ROLE_VIEWPORT: An object usually used in a scroll pane - *@ATK_ROLE_WINDOW: A top level window with no title or border + *@ATK_ROLE_WINDOW: A top level window with no title or border. + *@ATK_ROLE_HEADER: An object that serves as a document header. + *@ATK_ROLE_FOOTER: An object that serves as a document footer. + *@ATK_ROLE_PARAGRAPH: An object which is contains a paragraph of text content. + *@ATK_ROLE_RULER: An object which describes margins and tab stops, etc. for text objects which it controls (should have CONTROLLER_FOR relation to such). *@ATK_ROLE_LAST_DEFINED: not a valid role, used for finding end of enumeration * *Describes the role of an object @@ -183,6 +188,10 @@ typedef enum ATK_ROLE_UNKNOWN, ATK_ROLE_VIEWPORT, ATK_ROLE_WINDOW, + ATK_ROLE_HEADER, + ATK_ROLE_FOOTER, + ATK_ROLE_PARAGRAPH, + ATK_ROLE_RULER, ATK_ROLE_LAST_DEFINED } AtkRole; @@ -458,6 +467,16 @@ G_CONST_RETURN gchar* atk_role_get_name (AtkRole role); AtkRole atk_role_for_name (const gchar *name); +/* NEW in 1.1: convenience API */ +gboolean atk_object_add_relationship (AtkObject *object, + AtkRelationType relationship, + AtkObject *target); +gboolean atk_object_remove_relationship (AtkObject *object, + AtkRelationType relationship, + AtkObject *target); +G_CONST_RETURN gchar* atk_role_get_localized_name (AtkRole role); + + /* * Note: the properties which are registered with the GType * property registry, for type ATK_TYPE_OBJECT, are as follows: diff --git a/atk/atkrelation.h b/atk/atkrelation.h index ae02889..3e89702 100755 --- a/atk/atkrelation.h +++ b/atk/atkrelation.h @@ -25,6 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include <glib-object.h> +#include <atk/atkrelationtype.h> /* * An AtkRelation describes a relation between the object and one or more @@ -32,31 +33,6 @@ extern "C" { * are defined as an AtkRelationSet, which is a set of AtkRelations. */ -/** - *AtkRelationType: - *@ATK_RELATION_NULL: - *@ATK_RELATION_CONTROLLED_BY: Indicates an object controlled by one or more target objects. - *@ATK_RELATION_CONTROLLER_FOR: Indicates an object is an controller for one or more target objects. - *@ATK_RELATION_LABEL_FOR: Indicates an object is a label for one or more target objects. - *@ATK_RELATION_LABELLED_BY: Indicates an object is labelled by one or more target objects. - *@ATK_RELATION_MEMBER_OF: Indicates an object is a member of a group of one or more target objects. - *@ATK_RELATION_NODE_CHILD_OF: Indicates an object is a cell in a treetable which is displayed because a cell in the same column is expanded and identifies that cell. - *@ATK_RELATION_LAST_DEFINED: - * - *Describes the type of the relation - **/ -typedef enum -{ - ATK_RELATION_NULL = 0, - ATK_RELATION_CONTROLLED_BY, - ATK_RELATION_CONTROLLER_FOR, - ATK_RELATION_LABEL_FOR, - ATK_RELATION_LABELLED_BY, - ATK_RELATION_MEMBER_OF, - ATK_RELATION_NODE_CHILD_OF, - ATK_RELATION_LAST_DEFINED -} AtkRelationType; - #define ATK_TYPE_RELATION (atk_relation_get_type ()) #define ATK_RELATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_RELATION, AtkRelation)) #define ATK_RELATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_RELATION, AtkRelationClass)) @@ -67,7 +43,6 @@ typedef enum typedef struct _AtkRelation AtkRelation; typedef struct _AtkRelationClass AtkRelationClass; - struct _AtkRelation { GObject parent; diff --git a/atk/atkrelationtype.h b/atk/atkrelationtype.h new file mode 100755 index 0000000..798d7c7 --- /dev/null +++ b/atk/atkrelationtype.h @@ -0,0 +1,64 @@ +/* ATK - Accessibility Toolkit + * Copyright 2002 Sun Microsystems 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. + */ + +#ifndef __ATK_RELATION_TYPE_H__ +#define __ATK_RELATION_TYPE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + *AtkRelationType: + *@ATK_RELATION_NULL: + *@ATK_RELATION_CONTROLLED_BY: Indicates an object controlled by one or more target objects. + *@ATK_RELATION_CONTROLLER_FOR: Indicates an object is an controller for one or more target objects. + *@ATK_RELATION_LABEL_FOR: Indicates an object is a label for one or more target objects. + *@ATK_RELATION_LABELLED_BY: Indicates an object is labelled by one or more target objects. + *@ATK_RELATION_MEMBER_OF: Indicates an object is a member of a group of one or more target objects. + *@ATK_RELATION_NODE_CHILD_OF: Indicates an object is a cell in a treetable which is displayed because a cell in the same column is expanded and identifies that cell. + *@ATK_RELATION_FLOWS_TO: Indicates that the object has content that flows logically to another + * AtkObject in a sequential way, (for instance text-flow). + *@ATK_RELATION_FLOWS_FROM: Indicates that the object has content that flows logically from + * another AtkObject in a sequential way, (for instance text-flow). + *@ATK_RELATION_SUBWINDOW_OF: [not sure about this one, ask peter] + *@ATK_RELATION_LAST_DEFINED: + * + *Describes the type of the relation + **/ +typedef enum +{ + ATK_RELATION_NULL = 0, + ATK_RELATION_CONTROLLED_BY, + ATK_RELATION_CONTROLLER_FOR, + ATK_RELATION_LABEL_FOR, + ATK_RELATION_LABELLED_BY, + ATK_RELATION_MEMBER_OF, + ATK_RELATION_NODE_CHILD_OF, + ATK_RELATION_FLOWS_TO, + ATK_RELATION_FLOWS_FROM, + ATK_RELATION_SUBWINDOW_OF, /* not sure about this one, ask Peter */ + ATK_RELATION_LAST_DEFINED +} AtkRelationType; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __ATK_RELATION_TYPE_H__ */ diff --git a/atk/atkstate.h b/atk/atkstate.h index ed11a44..5e7dc74 100755 --- a/atk/atkstate.h +++ b/atk/atkstate.h @@ -57,6 +57,9 @@ extern "C" { *@ATK_STATE_TRANSIENT: Indicates this object is transient *@ATK_STATE_VERTICAL: Indicates the orientation of this object is vertical *@ATK_STATE_VISIBLE: Indicates this object is visible + *@ATK_STATE_MANAGES_DESCENDANTS: Indicates that "active-descendant-changed" event + * is sent when children become 'active' (i.e. are selected or navigated to onscreen). + * Used to prevent need to enumerate all children in very large containers, like tables. *@ATK_STATE_LAST_DEFINED: Not a valid role, used for finding end of enumeration * *The possible types of states of an object @@ -92,6 +95,7 @@ typedef enum ATK_STATE_TRANSIENT, ATK_STATE_VERTICAL, ATK_STATE_VISIBLE, + ATK_STATE_MANAGES_DESCENDANTS, ATK_STATE_LAST_DEFINED } AtkStateType; diff --git a/atk/atktext.c b/atk/atktext.c index e5eb50a..06bd940 100755 --- a/atk/atktext.c +++ b/atk/atktext.c @@ -29,6 +29,7 @@ enum { TEXT_CHANGED, TEXT_CARET_MOVED, TEXT_SELECTION_CHANGED, + TEXT_ATTRIBUTES_CHANGED, LAST_SIGNAL }; @@ -129,6 +130,14 @@ atk_text_base_init (gpointer *g_class) (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + atk_text_signals[TEXT_ATTRIBUTES_CHANGED] = + g_signal_new ("text_attributes_changed", + ATK_TYPE_TEXT, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AtkTextIface, text_attributes_changed), + (GSignalAccumulator) NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); initialized = TRUE; diff --git a/atk/atktext.h b/atk/atktext.h index 5c667c1..533af6c 100755 --- a/atk/atktext.h +++ b/atk/atktext.h @@ -227,7 +227,8 @@ struct _AtkTextIface gint location); void (* text_selection_changed) (AtkText *text); - AtkFunction pad1; + void (* text_attributes_changed) (AtkText *text); + AtkFunction pad2; AtkFunction pad3; AtkFunction pad4; |