diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-01-30 19:14:14 +0100 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2018-05-16 19:38:06 -0500 |
commit | 737c9853b681fb20fda79b32ed92cda96b381dd0 (patch) | |
tree | c1393d2be82920fd370bbdde89f0abb3dc243df9 | |
parent | d7f47c99d093ba91eb18523e14b23bde1794f5bc (diff) | |
download | at-spi2-core-737c9853b681fb20fda79b32ed92cda96b381dd0.tar.gz |
Add ScrollTo and ScrollToPoint component interfaces
-rw-r--r-- | atspi/atspi-component.c | 56 | ||||
-rw-r--r-- | atspi/atspi-component.h | 4 | ||||
-rw-r--r-- | atspi/atspi-constants.h | 46 | ||||
-rw-r--r-- | doc/libatspi/libatspi-sections.txt | 4 | ||||
-rw-r--r-- | doc/libatspi/tmpl/atspi-constants.sgml | 21 | ||||
-rw-r--r-- | idl/component.didl | 41 | ||||
-rw-r--r-- | xml/Component.xml | 10 |
7 files changed, 179 insertions, 3 deletions
diff --git a/atspi/atspi-component.c b/atspi/atspi-component.c index 0ab552b8..d485dba5 100644 --- a/atspi/atspi-component.c +++ b/atspi/atspi-component.c @@ -412,6 +412,62 @@ atspi_component_set_size (AtspiComponent *obj, return ret; } +/** + * atspi_component_scroll_to: + * @obj: a pointer to the #AtspiComponent object on which to operate. + * @type: a #AtspiScrollType indicating where the object should be placed on the + * screen. + * + * Scrolls whatever container of the #AtspiComponent object so it becomes + * visible on the screen. + * + * Returns: #TRUE if successful, #FALSE otherwise. + **/ +gboolean +atspi_component_scroll_to (AtspiComponent *obj, + AtspiScrollType type, + GError **error) +{ + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_component, + "ScrollTo", error, "u=>b", type, &retval); + + return retval; +} + +/** + * atspi_component_scroll_to_point: + * @obj: a pointer to the #AtspiComponent object on which to operate. + * @coords: a #AtspiCoordType indicating whether the coordinates are relative to + * the screen, to the window, or to the parent object. + * @x: the x coordinate of the point to reach + * @y: the y coordinate of the point to reach + * + * Scrolls whatever container of the #AtspiComponent object so it becomes + * visible on the screen at a given position. + * + * Returns: #TRUE if successful, #FALSE otherwise. + **/ +gboolean +atspi_component_scroll_to_point (AtspiComponent *obj, + AtspiCoordType coords, + gint x, + gint y, + GError **error) +{ + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_component, + "ScrollToPoint", error, "uii=>b", coords, x, y, &retval); + + return retval; +} + static void atspi_component_base_init (AtspiComponent *klass) { diff --git a/atspi/atspi-component.h b/atspi/atspi-component.h index dd3455a5..ffc720b2 100644 --- a/atspi/atspi-component.h +++ b/atspi/atspi-component.h @@ -107,6 +107,10 @@ gboolean atspi_component_set_position (AtspiComponent *obj, gint x, gint y, Atsp gboolean atspi_component_set_size (AtspiComponent *obj, gint width, gint height, GError **error); +gboolean atspi_component_scroll_to (AtspiComponent *obj, AtspiScrollType type, GError **error); + +gboolean atspi_component_scroll_to_point (AtspiComponent *obj, AtspiCoordType type, gint x, gint y, GError **error); + G_END_DECLS #endif /* _ATSPI_COMPONENT_H_ */ diff --git a/atspi/atspi-constants.h b/atspi/atspi-constants.h index 1604f596..6fc7ce0a 100644 --- a/atspi/atspi-constants.h +++ b/atspi/atspi-constants.h @@ -53,6 +53,8 @@ Accessibility::StateType\n Accessibility::Event\n Accessibility::EventDetails \n + Accessibility::ScrollType \n + Accessibility::CoordType \n \section Registry Accessibility also includes Accessibility::Registry, @@ -124,8 +126,10 @@ typedef enum { /** * AtspiCoordType: * @ATSPI_COORD_TYPE_SCREEN: Specifies xy coordinates relative to the screen. - * @ATSPI_COORD_TYPE_WINDOW: Specifies xy coordinates relative to the widget's + * @ATSPI_COORD_TYPE_WINDOW: Specifies xy coordinates relative to the widget's * top-level window. + * @ATSPI_COORD_TYPE_PARENT: Specifies xy coordinates relative to the widget's + * immediate parent. * * Enumeration used by #AtspiComponent, #AtspiImage, and #AtspiText interfaces * to specify whether coordinates are relative to the window or the screen. @@ -134,6 +138,7 @@ typedef enum { typedef enum { ATSPI_COORD_TYPE_SCREEN, ATSPI_COORD_TYPE_WINDOW, + ATSPI_COORD_TYPE_PARENT, } AtspiCoordType; /** @@ -141,7 +146,7 @@ typedef enum { * * One higher than the highest valid value of #AtspiCoordType. **/ -#define ATSPI_COORD_TYPE_COUNT (1+1) +#define ATSPI_COORD_TYPE_COUNT (2+1) /** * AtspiCollectionSortOrder: @@ -1383,6 +1388,43 @@ typedef enum ATSPI_CACHE_UNDEFINED = 0x40000000, } AtspiCache; +/** + * AtspiScrollType: + * @ATSPI_SCROLL_TOP_LEFT: Scroll the object to the top left corner of the + * window. + * @ATSPI_SCROLL_BOTTOM_RIGHT: Scroll the object to the bottom right corner of + * the window. + * @ATSPI_SCROLL_TOP_EDGE: Scroll the object to the top edge of the window. + * @ATSPI_SCROLL_BOTTOM_EDGE: Scroll the object to the bottom edge of the + * window. + * @ATSPI_SCROLL_LEFT_EDGE: Scroll the object to the left edge of the + * window. + * @ATSPI_SCROLL_RIGHT_EDGE: Scroll the object to the right edge of the + * window. + * @ATSPI_SCROLL_ANYWHERE: Scroll the object to application-dependent position + * on the window. + * + * Enumeration used by interface #AtspiAccessible to specify where an + * #AtspiAccessible object should be placed on the screen when using scroll_to. + * + */ +typedef enum { + ATSPI_SCROLL_TOP_LEFT, + ATSPI_SCROLL_BOTTOM_RIGHT, + ATSPI_SCROLL_TOP_EDGE, + ATSPI_SCROLL_BOTTOM_EDGE, + ATSPI_SCROLL_LEFT_EDGE, + ATSPI_SCROLL_RIGHT_EDGE, + ATSPI_SCROLL_ANYWHERE +} AtspiScrollType; + +/** + * ATSPI_SCROLLTYPE_COUNT: + * + * One higher than the highest valid value of #AtspiScrollType. + */ +#define ATSPI_SCROLLTYPE_COUNT (6+1) + #define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry" #define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry" #define ATSPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry" diff --git a/doc/libatspi/libatspi-sections.txt b/doc/libatspi/libatspi-sections.txt index 78abe767..e5ef6bba 100644 --- a/doc/libatspi/libatspi-sections.txt +++ b/doc/libatspi/libatspi-sections.txt @@ -441,6 +441,8 @@ atspi_component_get_layer atspi_component_get_mdi_z_order atspi_component_grab_focus atspi_component_get_alpha +atspi_component_scroll_to +atspi_component_scroll_to_point <SUBSECTION Standard> ATSPI_COMPONENT ATSPI_IS_COMPONENT @@ -524,6 +526,8 @@ AtspiRelationType ATSPI_RELATIONTYPE_COUNT AtspiRole ATSPI_ROLE_COUNT +AtspiScrollType +ATSPI_SCROLLTYPE_COUNT </SECTION> <SECTION> diff --git a/doc/libatspi/tmpl/atspi-constants.sgml b/doc/libatspi/tmpl/atspi-constants.sgml index 87638735..24bb07f0 100644 --- a/doc/libatspi/tmpl/atspi-constants.sgml +++ b/doc/libatspi/tmpl/atspi-constants.sgml @@ -39,6 +39,26 @@ Constant definitions needed by multiple interfaces. +<!-- ##### ENUM AtspiScrollType ##### --> +<para> + +</para> + +@ATSPI_SCROLL_TOP_LEFT: +@ATSPI_SCROLL_BOTTOM_RIGHT: +@ATSPI_SCROLL_TOP_EDGE: +@ATSPI_SCROLL_BOTTOM_EDGE: +@ATSPI_SCROLL_LEFT_EDGE: +@ATSPI_SCROLL_RIGHT_EDGE: +@ATSPI_SCROLL_ANYWHERE: + +<!-- ##### MACRO ATSPI_SCROLLTYPE_COUNT ##### --> +<para> + +</para> + + + <!-- ##### ENUM AtspiCoordType ##### --> <para> @@ -46,6 +66,7 @@ Constant definitions needed by multiple interfaces. @ATSPI_COORD_TYPE_SCREEN: @ATSPI_COORD_TYPE_WINDOW: +@ATSPI_COORD_TYPE_PARENT: <!-- ##### MACRO ATSPI_COORD_TYPE_COUNT ##### --> <para> diff --git a/idl/component.didl b/idl/component.didl index aa40e78f..31cfbf0f 100644 --- a/idl/component.didl +++ b/idl/component.didl @@ -54,7 +54,30 @@ interface org.freestandards.atspi.Component { LAYER_WINDOW, LAYER_LAST_DEFINED } - + + /* + Describes where the object should be placed on the window. + */ + enum uint32 ScrollType { + SCROLL_TOP_LEFT = 0, + SCROLL_BOTTOM_RIGHT, + SCROLL_TOP_EDGE, + SCROLL_BOTTOM_EDGE, + SCROLL_LEFT_EDGE, + SCROLL_RIGHT_EDGE, + SCROLL_ANYWHERE + } + + /* + Specifies whether the coordinates are relative to the screen, to the + window, or to the parent object. + */ + enum uint32 CoordType { + COORD_TYPE_SCREEN = 0, + COORD_TYPE_WINDOW, + COORD_TYPE_PARENT + } + /* True if the specified point lies within the components bounding box. */ @@ -136,4 +159,20 @@ interface org.freestandards.atspi.Component { method GetAlpha reply { double alpha; } + + /* + Scroll this object so it becomes visible on the screen. + */ + method ScrollTo { + ScrollType type; + } + + /* + Scroll this object so it becomes visible on the screen at a given position. + */ + method ScrollToPoint { + CoordType type; + int32 x; + int32 y; + } } diff --git a/xml/Component.xml b/xml/Component.xml index c67dde94..c1258d27 100644 --- a/xml/Component.xml +++ b/xml/Component.xml @@ -72,5 +72,15 @@ <arg direction="out" type="b"/> </method> + <method name="ScrollTo"> + <arg direction="in" name="type" type="u"/> + </method> + + <method name="ScrollToPoint"> + <arg direction="in" name="type" type="u"/> + <arg direction="in" name="x" type="i"/> + <arg direction="in" name="y" type="i"/> + </method> + </interface> </node> |