Gnome::Gtk4::R-Accessible
Description
Gnome::Gtk4::R-Accessible is an interface for describing UI elements for Assistive Technologies.
Every accessible implementation has:
a “role”, represented by a value of the
enumeration AccessibleRole from Gnome::Gtk4::T-enums
enumerationan “attribute”, represented by a set of
enumeration AccessibleState from Gnome::Gtk4::T-enums
,enumeration AccessibleProperty from Gnome::Gtk4::T-enums
andenumeration AccessibleRelation from Gnome::Gtk4::T-enums
values
The role cannot be changed after instantiating a Gnome::Gtk4::R-Accessible implementation.
The attributes are updated every time a UI element's state changes in a way that should be reflected by assistive technologies. For instance, if a Gnome::Gtk4::Widget visibility changes, the GTK_ACCESSIBLE_STATE_HIDDEN
state will also change to reflect the visible defined in Gnome::Gtk4::Widget property.
Every accessible implementation is part of a tree of accessible objects. Normally, this tree corresponds to the widget tree, but can be customized by reimplementing the [vfunc $Gtk
.Accessible.get_accessible_parent], [vfunc $Gtk
.Accessible.get_first_accessible_child] and [vfunc $Gtk
.Accessible.get_next_accessible_sibling] virtual functions. Note that you can not create a top-level accessible object as of now, which means that you must always have a parent accessible object. Also note that when an accessible object does not correspond to a widget, and it has children, whose implementation you don't control, it is necessary to ensure the correct shape of the a11y tree by calling .set-accessible-parent()
and updating the sibling by .update-next-accessible-sibling()
.
Methods
announce
Requests the user's screen reader to announce the given message.
This kind of notification is useful for messages that either have only a visual representation or that are not exposed visually at all, e.g. a notification about a successful operation.
Also, by using this API, you can ensure that the message does not interrupts the user's current screen reader output.
method announce ( Str $message, GtkAccessibleAnnouncementPriority $priority )
$message; the string to announce.
$priority; the priority of the announcement.
get-accessible-parent
Retrieves the accessible parent for an accessible object.
This function returns undefined for top level widgets.
method get-accessible-parent (--> N-Object )
Return value; the accessible parent.
get-accessible-role
Retrieves the accessible role of an accessible object.
method get-accessible-role (--> GtkAccessibleRole )
Return value; the accessible role.
get-at-context
Retrieves the accessible implementation for the given Gnome::Gtk4::R-Accessible.
method get-at-context (--> N-Object )
Return value; the accessible implementation object.
get-bounds
Queries the coordinates and dimensions of this accessible
This functionality can be overridden by Gnome::Gtk4::R-Accessible implementations, e.g. to get the bounds from an ignored child widget.
method get-bounds ( Array[Int] $x, Array[Int] $y, Array[Int] $width, Array[Int] $height --> Bool )
$x; (transfer ownership: full) the x coordinate of the top left corner of the accessible.
$y; (transfer ownership: full) the y coordinate of the top left corner of the widget.
$width; (transfer ownership: full) the width of the accessible object.
$height; (transfer ownership: full) the height of the accessible object.
Return value; true if the bounds are valid, and false otherwise.
get-first-accessible-child
Retrieves the first accessible child of an accessible object.
method get-first-accessible-child (--> N-Object )
Return value; the first accessible child.
get-next-accessible-sibling
Retrieves the next accessible sibling of an accessible object
method get-next-accessible-sibling (--> N-Object )
Return value; the next accessible sibling.
get-platform-state
Query a platform state, such as focus.
See .platform-changed()
.
This functionality can be overridden by Gnome::Gtk4::R-Accessible implementations, e.g. to get platform state from an ignored child widget, as is the case for Gnome::Gtk4::Text wrappers.
method get-platform-state ( GtkAccessiblePlatformState $state --> Bool )
$state; platform state to query.
Return value; the value of $state
for the accessible.
reset-property
Resets the accessible $property
to its default value.
method reset-property ( GtkAccessibleProperty $property )
$property; a
enumeration GtkAccessibleProperty defined in Gnome::Gtk4::T-enums
.
reset-relation
Resets the accessible $relation
to its default value.
method reset-relation ( GtkAccessibleRelation $relation )
$relation; a
enumeration GtkAccessibleRelation defined in Gnome::Gtk4::T-enums
.
reset-state
Resets the accessible $state
to its default value.
method reset-state ( GtkAccessibleState $state )
$state; a
enumeration GtkAccessibleState defined in Gnome::Gtk4::T-enums
.
set-accessible-parent
Sets the parent and sibling of an accessible object.
This function is meant to be used by accessible implementations that are not part of the widget hierarchy, and but act as a logical bridge between widgets. For instance, if a widget creates an object that holds metadata for each child, and you want that object to implement the Gnome::Gtk4::R-Accessible interface, you will use this function to ensure that the parent of each child widget is the metadata object, and the parent of each metadata object is the container widget.
method set-accessible-parent ( N-Object() $parent, N-Object() $next-sibling )
$parent; the parent accessible object.
$next-sibling; the sibling accessible object.
update-next-accessible-sibling
Updates the next accessible sibling of $self
.
That might be useful when a new child of a custom Gnome::Gtk4::R-Accessible is created, and it needs to be linked to a previous child.
method update-next-accessible-sibling ( N-Object() $new-sibling )
$new-sibling; the new next accessible sibling to set.
update-property This function is not yet available
Updates a list of accessible properties.
See the enumeration AccessibleProperty from Gnome::Gtk4::T-enums
documentation for the value types of accessible properties.
This function should be called by Gnome::Gtk4::Widget types whenever an accessible property change must be communicated to assistive technologies.
Example:
method update-property ( GtkAccessibleProperty $first-property, … )
$first-property; the first
enumeration GtkAccessibleProperty defined in Gnome::Gtk4::T-enums
.…; …. Note that each argument must be specified as a type followed by its value!
update-property-value
Updates an array of accessible properties.
This function should be called by Gnome::Gtk4::Widget types whenever an accessible property change must be communicated to assistive technologies.
This function is meant to be used by language bindings.
method update-property-value ( Int() $n-properties, GtkAccessibleProperty $properties, N-Object $values )
$n-properties; the number of accessible properties to set.
$properties; an array of
enumeration GtkAccessibleProperty defined in Gnome::Gtk4::T-enums
.$values; an array of GValues, one for each property
update-relation This function is not yet available
Updates a list of accessible relations.
This function should be called by Gnome::Gtk4::Widget types whenever an accessible relation change must be communicated to assistive technologies.
If the enumeration AccessibleRelation from Gnome::Gtk4::T-enums
requires a list of references, you should pass each reference individually, followed by undefined, e.g.
method update-relation ( GtkAccessibleRelation $first-relation, … )
$first-relation; the first
enumeration GtkAccessibleRelation defined in Gnome::Gtk4::T-enums
.…; …. Note that each argument must be specified as a type followed by its value!
update-relation-value
Updates an array of accessible relations.
This function should be called by Gnome::Gtk4::Widget types whenever an accessible relation change must be communicated to assistive technologies.
This function is meant to be used by language bindings.
method update-relation-value ( Int() $n-relations, GtkAccessibleRelation $relations, N-Object $values )
$n-relations; the number of accessible relations to set.
$relations; an array of
enumeration GtkAccessibleRelation defined in Gnome::Gtk4::T-enums
.$values; an array of GValues, one for each relation
update-state This function is not yet available
Updates a list of accessible states. See the enumeration AccessibleState from Gnome::Gtk4::T-enums
documentation for the value types of accessible states.
This function should be called by Gnome::Gtk4::Widget types whenever an accessible state change must be communicated to assistive technologies.
Example:
method update-state ( GtkAccessibleState $first-state, … )
$first-state; the first
enumeration GtkAccessibleState defined in Gnome::Gtk4::T-enums
.…; …. Note that each argument must be specified as a type followed by its value!
update-state-value
Updates an array of accessible states.
This function should be called by Gnome::Gtk4::Widget types whenever an accessible state change must be communicated to assistive technologies.
This function is meant to be used by language bindings.
method update-state-value ( Int() $n-states, GtkAccessibleState $states, N-Object $values )
$n-states; the number of accessible states to set.
$states; an array of
enumeration GtkAccessibleState defined in Gnome::Gtk4::T-enums
.$values; an array of GValues, one for each state