Gtk.Accessible

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible

Implementations:

Gtk.StackPage, Gtk.Widget

Methods

get_accessible_parent ()

get_accessible_role ()

get_at_context ()

get_bounds ()

get_first_accessible_child ()

get_next_accessible_sibling ()

get_platform_state (state)

reset_property (property)

reset_relation (relation)

reset_state (state)

set_accessible_parent (parent, next_sibling)

update_next_accessible_sibling (new_sibling)

update_property (properties, values)

update_relation (relations, values)

update_state (states, values)

Virtual Methods

do_get_accessible_parent ()

do_get_at_context ()

do_get_bounds ()

do_get_first_accessible_child ()

do_get_next_accessible_sibling ()

do_get_platform_state (state)

Properties

Name

Type

Flags

Short Description

accessible-role

Gtk.AccessibleRole

r/w

Signals

None

Fields

None

Class Details

class Gtk.Accessible
Bases:

GObject.GInterface

Structure:

Gtk.AccessibleInterface

GtkAccessible is an interface for describing UI elements for Assistive Technologies.

Every accessible implementation has:

  • a “role”, represented by a value of the [enum`Gtk`.AccessibleRole] enumeration

  • an “attribute”, represented by a set of [enum`Gtk`.AccessibleState], [enum`Gtk`.AccessibleProperty] and [enum`Gtk`.AccessibleRelation] values

The role cannot be changed after instantiating a GtkAccessible 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 GtkWidget visibility changes, the Gtk.AccessibleState.HIDDEN state will also change to reflect the [property`Gtk`.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 [method`Gtk`.Accessible.set_accessible_parent] and updating the sibling by [method`Gtk`.Accessible.update_next_accessible_sibling].

get_accessible_parent()[source]
Returns:

the accessible parent

Return type:

Gtk.Accessible or None

Retrieves the accessible parent for an accessible object.

This function returns NULL for top level widgets.

New in version 4.10.

get_accessible_role()[source]
Returns:

the accessible role

Return type:

Gtk.AccessibleRole

Retrieves the accessible role of an accessible object.

get_at_context()[source]
Returns:

the accessible implementation object

Return type:

Gtk.ATContext

Retrieves the accessible implementation for the given GtkAccessible.

New in version 4.10.

get_bounds()[source]
Returns:

true if the bounds are valid, and false otherwise

x:

the x coordinate of the top left corner of the accessible

y:

the y coordinate of the top left corner of the widget

width:

the width of the accessible object

height:

the height of the accessible object

Return type:

(bool, x: int, y: int, width: int, height: int)

Queries the coordinates and dimensions of this accessible

This functionality can be overridden by GtkAccessible implementations, e.g. to get the bounds from an ignored child widget.

New in version 4.10.

get_first_accessible_child()[source]
Returns:

the first accessible child

Return type:

Gtk.Accessible or None

Retrieves the first accessible child of an accessible object.

New in version 4.10.

get_next_accessible_sibling()[source]
Returns:

the next accessible sibling

Return type:

Gtk.Accessible or None

Retrieves the next accessible sibling of an accessible object

New in version 4.10.

get_platform_state(state)[source]
Parameters:

state (Gtk.AccessiblePlatformState) – platform state to query

Returns:

the value of state for the accessible

Return type:

bool

Query a platform state, such as focus.

See gtk_accessible_platform_changed().

This functionality can be overridden by GtkAccessible implementations, e.g. to get platform state from an ignored child widget, as is the case for GtkText wrappers.

New in version 4.10.

reset_property(property)[source]
Parameters:

property (Gtk.AccessibleProperty) – a GtkAccessibleProperty

Resets the accessible property to its default value.

reset_relation(relation)[source]
Parameters:

relation (Gtk.AccessibleRelation) – a GtkAccessibleRelation

Resets the accessible relation to its default value.

reset_state(state)[source]
Parameters:

state (Gtk.AccessibleState) – a GtkAccessibleState

Resets the accessible state to its default value.

set_accessible_parent(parent, next_sibling)[source]
Parameters:

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 GtkAccessible 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.

New in version 4.10.

update_next_accessible_sibling(new_sibling)[source]
Parameters:

new_sibling (Gtk.Accessible or None) – the new next accessible sibling to set

Updates the next accessible sibling of self.

That might be useful when a new child of a custom GtkAccessible is created, and it needs to be linked to a previous child.

New in version 4.10.

update_property(properties, values)[source]
Parameters:

Updates an array of accessible properties.

This function should be called by GtkWidget types whenever an accessible property change must be communicated to assistive technologies.

This function is meant to be used by language bindings.

update_relation(relations, values)[source]
Parameters:

Updates an array of accessible relations.

This function should be called by GtkWidget types whenever an accessible relation change must be communicated to assistive technologies.

This function is meant to be used by language bindings.

update_state(states, values)[source]
Parameters:

Updates an array of accessible states.

This function should be called by GtkWidget types whenever an accessible state change must be communicated to assistive technologies.

This function is meant to be used by language bindings.

do_get_accessible_parent() virtual
Returns:

the accessible parent

Return type:

Gtk.Accessible or None

Retrieves the accessible parent for an accessible object.

This function returns NULL for top level widgets.

New in version 4.10.

do_get_at_context() virtual
Returns:

the accessible implementation object

Return type:

Gtk.ATContext or None

Retrieves the accessible implementation for the given GtkAccessible.

New in version 4.10.

do_get_bounds() virtual
Returns:

true if the bounds are valid, and false otherwise

x:

the x coordinate of the top left corner of the accessible

y:

the y coordinate of the top left corner of the widget

width:

the width of the accessible object

height:

the height of the accessible object

Return type:

(bool, x: int, y: int, width: int, height: int)

Queries the coordinates and dimensions of this accessible

This functionality can be overridden by GtkAccessible implementations, e.g. to get the bounds from an ignored child widget.

New in version 4.10.

do_get_first_accessible_child() virtual
Returns:

the first accessible child

Return type:

Gtk.Accessible or None

Retrieves the first accessible child of an accessible object.

New in version 4.10.

do_get_next_accessible_sibling() virtual
Returns:

the next accessible sibling

Return type:

Gtk.Accessible or None

Retrieves the next accessible sibling of an accessible object

New in version 4.10.

do_get_platform_state(state) virtual
Parameters:

state (Gtk.AccessiblePlatformState) – platform state to query

Returns:

the value of state for the accessible

Return type:

bool

Query a platform state, such as focus.

See gtk_accessible_platform_changed().

This functionality can be overridden by GtkAccessible implementations, e.g. to get platform state from an ignored child widget, as is the case for GtkText wrappers.

New in version 4.10.

Property Details

Gtk.Accessible.props.accessible_role
Name:

accessible-role

Type:

Gtk.AccessibleRole

Default Value:

Gtk.AccessibleRole.NONE

Flags:

READABLE, WRITABLE

The accessible role of the given GtkAccessible implementation.

The accessible role cannot be changed once set.