gtk.accessible_mixin

Module for [Accessible] interface mixin

Templates 2

tmplAccessibleT()

[gtk.accessible.Accessible] is an interface for describing UI elements for Assistive Technologies.

Every accessible implementation has:

  • a “role”, represented by a value of the [gtk.types.AccessibleRole] enumeration
  • an “attribute”, represented by a set of [gtk.types.AccessibleState],

[gtk.types.AccessibleProperty] and [gtk.types.AccessibleRelation] values

The role cannot be changed after instantiating a [gtk.accessible.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 [gtk.widget.Widget] visibility changes, the [gtk.types.AccessibleState.Hidden] state will also change to reflect the [gtk.widget.Widget.visible] 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 [gtk.accessible.Accessible.setAccessibleParent] and updating the sibling by [gtk.accessible.Accessible.updateNextAccessibleSibling].

Functions
gtk.types.AccessibleRole accessibleRole()

Get accessibleRole property.

Returns

The accessible role of the given [gtk.accessible.Accessible] implementation.

The accessible role cannot be changed once set.

void accessibleRole(gtk.types.AccessibleRole propval)

Set accessibleRole property.

Parameters

propvalThe accessible role of the given [gtk.accessible.Accessible] implementation. The accessible role cannot be changed once set.
void announce(string message, gtk.types.AccessibleAnnouncementPriority priority)

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.

Parameters

messagethe string to announce
prioritythe priority of the announcement
gtk.accessible.Accessible getAccessibleParent()

Retrieves the accessible parent for an accessible object.

This function returns NULL for top level widgets.

Returns

the accessible parent
gtk.types.AccessibleRole getAccessibleRole()

Retrieves the accessible role of an accessible object.

Returns

the accessible role

Retrieves the accessible implementation for the given [gtk.accessible.Accessible].

Returns

the accessible implementation object
bool getBounds(out int x, out int y, out int width, out int height)

Queries the coordinates and dimensions of this accessible

This functionality can be overridden by [gtk.accessible.Accessible] implementations, e.g. to get the bounds from an ignored child widget.

Parameters

xthe x coordinate of the top left corner of the accessible
ythe y coordinate of the top left corner of the widget
widththe width of the accessible object
heightthe height of the accessible object

Returns

true if the bounds are valid, and false otherwise
gtk.accessible.Accessible getFirstAccessibleChild()

Retrieves the first accessible child of an accessible object.

Returns

the first accessible child
gtk.accessible.Accessible getNextAccessibleSibling()

Retrieves the next accessible sibling of an accessible object

Returns

the next accessible sibling
bool getPlatformState(gtk.types.AccessiblePlatformState state)

Query a platform state, such as focus.

See gtk_accessible_platform_changed().

This functionality can be overridden by [gtk.accessible.Accessible] implementations, e.g. to get platform state from an ignored child widget, as is the case for [gtk.text.Text] wrappers.

Parameters

stateplatform state to query

Returns

the value of state for the accessible
void resetProperty(gtk.types.AccessibleProperty property)

Resets the accessible property to its default value.

Parameters

propertya [gtk.types.AccessibleProperty]
void resetRelation(gtk.types.AccessibleRelation relation)

Resets the accessible relation to its default value.

Parameters

relationa [gtk.types.AccessibleRelation]
void resetState(gtk.types.AccessibleState state)

Resets the accessible state to its default value.

Parameters

statea [gtk.types.AccessibleState]
void setAccessibleParent(gtk.accessible.Accessible parent = null, gtk.accessible.Accessible nextSibling = null)

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 [gtk.accessible.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.

Parameters

parentthe parent accessible object
nextSiblingthe sibling accessible object
void updateNextAccessibleSibling(gtk.accessible.Accessible newSibling = null)

Updates the next accessible sibling of self.

That might be useful when a new child of a custom [gtk.accessible.Accessible] is created, and it needs to be linked to a previous child.

Parameters

newSiblingthe new next accessible sibling to set
void updateProperty(gtk.types.AccessibleProperty[] properties, gobject.value.Value[] values)

Updates an array of accessible properties.

This function should be called by [gtk.widget.Widget] types whenever an accessible property change must be communicated to assistive technologies.

This function is meant to be used by language bindings.

Parameters

propertiesan array of [gtk.types.AccessibleProperty]
valuesan array of GValues, one for each property
void updateRelation(gtk.types.AccessibleRelation[] relations, gobject.value.Value[] values)

Updates an array of accessible relations.

This function should be called by [gtk.widget.Widget] types whenever an accessible relation change must be communicated to assistive technologies.

This function is meant to be used by language bindings.

Parameters

relationsan array of [gtk.types.AccessibleRelation]
valuesan array of GValues, one for each relation
void updateState(gtk.types.AccessibleState[] states, gobject.value.Value[] values)

Updates an array of accessible states.

This function should be called by [gtk.widget.Widget] types whenever an accessible state change must be communicated to assistive technologies.

This function is meant to be used by language bindings.

Parameters

statesan array of [gtk.types.AccessibleState]
valuesan array of GValues, one for each state
tmplAccessibleGidBuilderT()
Functions
T accessibleRole(gtk.types.AccessibleRole propval)

Set accessibleRole property.

Parameters

propvalThe accessible role of the given [gtk.accessible.Accessible] implementation. The accessible role cannot be changed once set.

Returns

Builder instance for fluent chaining