From 2878d33d08f8bb787300226f053804a50b0fa3eb Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Tue, 12 Jul 2011 13:23:02 -0500 Subject: Add some functions from IA2 Add atk_component_get_group_position, atk_component_scroll_to, atk_text_scroll_substring_to, and atk_text_scroll_substring_to_point --- atk/atkcomponent.c | 71 +++++++++++++++++++++++++++++++++++++++++++++ atk/atkcomponent.h | 16 +++++++++- atk/atktext.c | 65 +++++++++++++++++++++++++++++++++++++++++ atk/atktext.h | 48 ++++++++++++++++++++---------- atk/atkutil.h | 70 ++++++++++++++++++++++++++++++++++++++++++++ docs/atk-sections.txt | 5 ++++ docs/tmpl/atkcomponent.sgml | 21 ++++++++++++++ docs/tmpl/atkobject.sgml | 13 +++++++++ docs/tmpl/atktext.sgml | 26 +++++++++++++++++ docs/tmpl/atkutil.sgml | 13 +++++++++ 10 files changed, 332 insertions(+), 16 deletions(-) diff --git a/atk/atkcomponent.c b/atk/atkcomponent.c index 46e80c8..35e155e 100755 --- a/atk/atkcomponent.c +++ b/atk/atkcomponent.c @@ -401,6 +401,52 @@ atk_component_get_alpha (AtkComponent *component) return (gdouble) 1.0; } +/** + * atk_component_get_group_position: + * @component: an #AtkComponent + * @group_level: (out): the group's level of nesting. 1 based, 0 indicates + * that this value is not applicable. + * @similar_items: (out): the total number of items in this group, including + * the item being queried. 1 based, 0 indicates that this value is not + * applicable. + * + * Returns grouping information. + * Used for tree items, list items, tab panel labels, radio buttons, etc. + * Also used for collections of non-text objects. + * + * Note: This method is meant to describe the nature of an object's + * containment structure. It's exposed by trees, tree grids, nested lists, + * nested menus, but not headings, which uses the level object attribute. It + * is also exposed by radio buttons (with groupLevel == 0). This is normally + * not implemented on a combo box to describe the nature of its contents. + * Normally an AT will get that information from its child list object. + * However, in some cases when non-edit combo boxes are not able to be + * structured such that the list is a child of the combo box, this method is + * implemented on the combo box itself. ATs can use this interface if a child + * list is not found. + * + * Returns: an index into the objects in the current group (this is not an + * index into all the objects at the same group level. 1 based, 0 indicates + * that this value is not applicable. + * + * Since: 3.0 + **/ +gint +atk_component_get_group_position (AtkComponent *component, + gint *group_level, + gint *similar_items) +{ + AtkComponentIface *iface = NULL; + g_return_val_if_fail (ATK_IS_COMPONENT (component), -1); + + iface = ATK_COMPONENT_GET_IFACE (component); + + if (iface->get_group_position) + return (iface->get_group_position) (component, group_level, similar_items); + else + return -1; +} + /** * atk_component_grab_focus: * @component: an #AtkComponent @@ -423,6 +469,31 @@ atk_component_grab_focus (AtkComponent *component) return FALSE; } +/** + * atk_component_scroll_to: + * @component: an #AtkComponent + * @scroll_type: a #AtkScrollType describing the type of scrolling desired + * + * Makes an object visible on the screen. + * + * Returns: %TRUE if successful, %FALSE otherwise. + * + * Since: 3.0 + **/ +gboolean +atk_component_scroll_to (AtkComponent *component, AtkScrollType scroll_type) +{ + AtkComponentIface *iface = NULL; + g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE); + + iface = ATK_COMPONENT_GET_IFACE (component); + + if (iface->scroll_to) + return (iface->scroll_to) (component, scroll_type); + else + return FALSE; +} + /** * atk_component_set_extents: * @component: an #AtkComponent diff --git a/atk/atkcomponent.h b/atk/atkcomponent.h index cf6dc9f..4cab538 100755 --- a/atk/atkcomponent.h +++ b/atk/atkcomponent.h @@ -110,13 +110,22 @@ struct _AtkComponentIface AtkLayer (* get_layer) (AtkComponent *component); gint (* get_mdi_zorder) (AtkComponent *component); + gdouble (* get_alpha) (AtkComponent *component); + + gboolean (* scroll_to) (AtkComponent *component, + AtkScrollType scroll_type); + + gint (*get_group_position) (AtkComponent *component, + gint *group_level, + gint *similar_items); /* * signal handlers */ void (* bounds_changed) (AtkComponent *component, AtkRectangle *bounds); - gdouble (* get_alpha) (AtkComponent *component); + + gpointer _padding_dummy[16]; }; GType atk_component_get_type (void); @@ -165,6 +174,11 @@ gboolean atk_component_set_size (AtkComponent *com gint width, gint height); gdouble atk_component_get_alpha (AtkComponent *component); +gboolean atk_component_scroll_to (AtkComponent *component, + AtkScrollType scroll_type); +gint atk_component_get_group_position (AtkComponent *component, + gint *group_level, + gint *similar_items); G_END_DECLS diff --git a/atk/atktext.c b/atk/atktext.c index a1e90de..f006822 100755 --- a/atk/atktext.c +++ b/atk/atktext.c @@ -1036,6 +1036,71 @@ atk_text_get_bounded_ranges (AtkText *text, return NULL; } +/** + * atk_text_scroll_substring_to: + * @text: an #AtkText + * @start_index: the start index of the string that should be scrolled + * @end_index: the end index of the string that should be scrolled + * @scroll_type: the type of scrolling desired + * + * Makes a specific part of a string visible on screen. + * + * Returns: %TRUE if success, %FALSE otherwise. + * + * Since: 3.0 + **/ +gboolean +atk_text_scroll_substring_to (AtkText *text, + gint start_index, + gint end_index, + AtkScrollType scroll_type) +{ + AtkTextIface *iface; + + g_return_val_if_fail (ATK_IS_TEXT (text), FALSE); + iface = ATK_TEXT_GET_IFACE (text); + + if (iface->scroll_substring_to) + return (*(iface->scroll_substring_to)) (text, start_index, end_index, scroll_type); + else + return FALSE; +} + +/** + * atk_text_scroll_substring_to_point: + * @text: an #AtkText + * @start_index: the start index of the string that should be scrolled + * @end_index: the end index of the string that should be scrolled + * @x: the X coordinate to which the string should be scrolled + * @y: the Y coordinate to which the string should be scrolled + * @coord_type: Specify whether coordinates are relative to the screen or widget window. + * + * Moves the top left of a substring to a specified location. + * + * Returns: %TRUE if success, %FALSE otherwise. + * + * Since: 3.0 + **/ +gboolean +atk_text_scroll_substring_to_point (AtkText *text, + gint start_index, + gint end_index, + gint x, + gint y, + AtkCoordType coord_type) +{ + AtkTextIface *iface; + + g_return_val_if_fail (ATK_IS_TEXT (text), FALSE); + + iface = ATK_TEXT_GET_IFACE (text); + + if (iface->scroll_substring_to_point) + return (*(iface->scroll_substring_to_point)) (text, start_index, end_index, x, y, coord_type); + else + return FALSE; +} + /** * atk_attribute_set_free: * @attrib_set: The #AtkAttributeSet to free diff --git a/atk/atktext.h b/atk/atktext.h index 81ad312..413482f 100755 --- a/atk/atktext.h +++ b/atk/atktext.h @@ -250,6 +250,27 @@ struct _AtkTextIface gint end_offset); gboolean (* set_caret_offset) (AtkText *text, gint offset); + void (* get_range_extents) (AtkText *text, + gint start_offset, + gint end_offset, + AtkCoordType coord_type, + AtkTextRectangle *rect); + AtkTextRange** (* get_bounded_ranges) (AtkText *text, + AtkTextRectangle *rect, + AtkCoordType coord_type, + AtkTextClipType x_clip_type, + AtkTextClipType y_clip_type); + gboolean (*scroll_substring_to) (AtkText *text, + gint start_index, + gint end_index, + AtkScrollType scroll_type); + gboolean (*scroll_substring_to_point) (AtkText *text, + gint start_index, + gint end_index, + gint x, + gint y, + AtkCoordType coord_type); + /* * signal handlers @@ -263,21 +284,7 @@ struct _AtkTextIface void (* text_attributes_changed) (AtkText *text); - - void (* get_range_extents) (AtkText *text, - gint start_offset, - gint end_offset, - AtkCoordType coord_type, - AtkTextRectangle *rect); - - AtkTextRange** (* get_bounded_ranges) (AtkText *text, - AtkTextRectangle *rect, - AtkCoordType coord_type, - AtkTextClipType x_clip_type, - AtkTextClipType y_clip_type); - - - AtkFunction pad4; + gpointer _padding_dummy[16]; }; GType atk_text_get_type (void); @@ -355,6 +362,17 @@ AtkTextRange** atk_text_get_bounded_ranges (AtkText *tex AtkCoordType coord_type, AtkTextClipType x_clip_type, AtkTextClipType y_clip_type); +gboolean atk_text_scroll_substring_to (AtkText *text, + gint start_index, + gint end_index, + AtkScrollType scroll_type); +gboolean atk_text_scroll_substring_to_point (AtkText *text, + gint start_index, + gint end_index, + gint x, + gint y, + AtkCoordType coord_type); + void atk_text_free_ranges (AtkTextRange **ranges); void atk_attribute_set_free (AtkAttributeSet *attrib_set); const gchar* atk_text_attribute_get_name (AtkTextAttribute attr); diff --git a/atk/atkutil.h b/atk/atkutil.h index 20eddc8..2ca4edf 100755 --- a/atk/atkutil.h +++ b/atk/atkutil.h @@ -166,6 +166,76 @@ typedef enum { ATK_XY_WINDOW }AtkCoordType; +/** + *AtkScrollType: + *@ATK_SCROLL_TYPE_TOP_LEFT: Scroll the top left corner of the object or + * substring such that the top left corner (and as much as possible of the + * rest of the object or substring) is within the top level window. In cases + * where the entire object or substring fits within the top level window, + * the placement of the object or substring is dependent on the application. + * For example, the object or substring may be scrolled to the closest edge, + * the furthest edge, or midway between those two edges. In cases where + * there is a hierarchy of nested scrollable controls, more than one control + * may have to be scrolled. + *@ATK_SCROLL_TYPE_BOTTOM_RIGHT: Scroll the bottom right corner of the + * object or substring such that the bottom right corner (and as much as + * possible of the rest of the object or substring) is within the top + * level window. In cases where the entire object or substring fits within + * the top level window, the placement of the object or substring is dependent + * on the application. For example, the object or substring may be scrolled + * to the closest edge, the furthest edge, or midway between those two edges. + * In cases where there is a hierarchy of nested scrollable controls, more + * than one control may have to be scrolled. + *@ATK_SCROLL_TYPE_TOP_EDGE: Scroll the top edge of the object or substring + * such that the top edge (and as much as possible of the rest of the object + * or substring) is within the top level window. In cases where the entire + * object or substring fits within the top level window, the placement of the + * object or substring is dependent on the application. For example, the + * object or substring may be scrolled to the closest edge, the furthest edge, + * or midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be scrolled. + *@ATK_SCROLL_TYPE_BOTTOM_EDGE: Scroll the bottom edge of the object or + * substring such that the bottom edge (and as much as possible of the rest of + * the object or substring) is within the top level window. In cases where the + * entire object or substring fits within the top level window, the placement + * of the object or substring is dependent on the application. For example, the + * object or substring may be scrolled to the closest edge, the furthest edge, + * or midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be scrolled. + *@ATK_SCROLL_TYPE_LEFT_EDGE: Scroll the left edge of the object or substring + * such that the left edge (and as much as possible of the rest of the object + * or substring) is within the top level window. In cases where the entire + * object or substring fits within the top level window, the placement of the + * object or substring is dependent on the application. For example, the + * object or substring may be scrolled to the closest edge, the furthest edge, + * or midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be scrolled. + *@ATK_SCROLL_TYPE_RIGHT_EDGE: Scroll the right edge of the object or + * substring such that the right edge (and as much as possible of the rest of + * the object or substring) is within the top level window. In cases where the + * entire object or substring fits within the top level window, the placement + * of the object or substring is dependent on the application. For example, the + * object or substring may be scrolled to the closest edge, the furthest edge, + * or midway between those two edges. In cases where there is a hierarchy of + * nested scrollable controls, more than one control may have to be scrolled. + *@ATK_SCROLL_TYPE_ANYWHERE: Scroll the object or substring such that as much + * as possible of the object or substring is within the top level window. The + * placement of the object is dependent on the application. For example, the + * object or substring may be scrolled to to closest edge, the furthest edge, or midway between those two edges. + * + * Values defining where to place an object or substring on the screen. + **/ +typedef enum +{ + ATK_SCROLL_TYPE_TOP_LEFT, + ATK_SCROLL_TYPE_BOTTOM_RIGHT, + ATK_SCROLL_TYPE_TOP_EDGE, + ATK_SCROLL_TYPE_BOTTOM_EDGE, + ATK_SCROLL_TYPE_LEFT_EDGE, + ATK_SCROLL_TYPE_RIGHT_EDGE, + ATK_SCROLL_TYPE_ANYWHERE +} AtkScrollType; + /* * Adds the specified function to the list of functions to be called * when an object receives focus. diff --git a/docs/atk-sections.txt b/docs/atk-sections.txt index a2b2ced..862267c 100644 --- a/docs/atk-sections.txt +++ b/docs/atk-sections.txt @@ -28,10 +28,12 @@ atk_component_get_extents atk_component_get_layer atk_component_get_mdi_zorder atk_component_get_position +atk_component_get_group_position atk_component_get_size atk_component_grab_focus atk_component_ref_accessible_at_point atk_component_remove_focus_handler +atk_component_scroll_to atk_component_set_extents atk_component_set_position atk_component_set_size @@ -416,6 +418,8 @@ atk_text_get_n_selections atk_text_get_selection atk_text_add_selection atk_text_remove_selection +atk_text_scroll_substring_to +atk_text_scroll_substring_to_point atk_text_set_selection atk_text_set_caret_offset atk_attribute_set_free @@ -531,6 +535,7 @@ ATK_STREAMABLE_CONTENT_GET_IFACE AtkUtil AtkUtil AtkCoordType +AtkScrollType atk_add_focus_tracker atk_remove_focus_tracker atk_focus_tracker_init diff --git a/docs/tmpl/atkcomponent.sgml b/docs/tmpl/atkcomponent.sgml index df7a84a..11daa52 100644 --- a/docs/tmpl/atkcomponent.sgml +++ b/docs/tmpl/atkcomponent.sgml @@ -111,6 +111,17 @@ a component changes. @coord_type: + + + + + +@component: +@group_level: +@similar_items: +@Returns: + + @@ -151,6 +162,16 @@ a component changes. @handler_id: + + + + + +@component: +@scroll_type: +@Returns: + + diff --git a/docs/tmpl/atkobject.sgml b/docs/tmpl/atkobject.sgml index 9d6aa88..cae9677 100644 --- a/docs/tmpl/atkobject.sgml +++ b/docs/tmpl/atkobject.sgml @@ -285,6 +285,19 @@ the object changed. @ATK_ROLE_FORM: @ATK_ROLE_LINK: @ATK_ROLE_INPUT_METHOD_WINDOW: +@ATK_ROLE_TABLE_ROW: +@ATK_ROLE_TREE_ITEM: +@ATK_ROLE_DOCUMENT_SPREADSHEET: +@ATK_ROLE_DOCUMENT_PRESENTATION: +@ATK_ROLE_DOCUMENT_TEXT: +@ATK_ROLE_DOCUMENT_WEB: +@ATK_ROLE_DOCUMENT_EMAIL: +@ATK_ROLE_COMMENT: +@ATK_ROLE_LIST_BOX: +@ATK_ROLE_GROUPING: +@ATK_ROLE_IMAGE_MAP: +@ATK_ROLE_NOTIFICATION: +@ATK_ROLE_INFO_BAR: @ATK_ROLE_LAST_DEFINED: diff --git a/docs/tmpl/atktext.sgml b/docs/tmpl/atktext.sgml index af3360e..b20507c 100644 --- a/docs/tmpl/atktext.sgml +++ b/docs/tmpl/atktext.sgml @@ -405,6 +405,32 @@ an object which implements AtkText changes. @Returns: + + + + + +@text: +@start_index: +@end_index: +@scroll_type: +@Returns: + + + + + + + +@text: +@start_index: +@end_index: +@x: +@y: +@coord_type: +@Returns: + + diff --git a/docs/tmpl/atkutil.sgml b/docs/tmpl/atkutil.sgml index 6331d36..ae5487a 100644 --- a/docs/tmpl/atkutil.sgml +++ b/docs/tmpl/atkutil.sgml @@ -36,6 +36,19 @@ The AtkUtil struct does not contain any fields. @ATK_XY_SCREEN: @ATK_XY_WINDOW: + + + + + +@ATK_SCROLL_TYPE_TOP_LEFT: +@ATK_SCROLL_TYPE_BOTTOM_RIGHT: +@ATK_SCROLL_TYPE_TOP_EDGE: +@ATK_SCROLL_TYPE_BOTTOM_EDGE: +@ATK_SCROLL_TYPE_LEFT_EDGE: +@ATK_SCROLL_TYPE_RIGHT_EDGE: +@ATK_SCROLL_TYPE_ANYWHERE: + -- cgit v1.2.1