Gtk.AccessibleText

g GObject.GInterface GObject.GInterface Gtk.AccessibleText Gtk.AccessibleText GObject.GInterface->Gtk.AccessibleText

Implementations:

Gtk.Inscription, Gtk.Label, Gtk.Text, Gtk.TextView

Methods

update_caret_position ()

update_contents (change, start, end)

update_selection_bound ()

Virtual Methods

do_get_attributes (offset)

do_get_caret_position ()

do_get_contents (start, end)

do_get_contents_at (offset, granularity)

do_get_default_attributes ()

do_get_extents (start, end, extents)

do_get_offset (point)

do_get_selection ()

Properties

None

Signals

None

Fields

None

Class Details

class Gtk.AccessibleText
Bases:

GObject.GInterface

Structure:

Gtk.AccessibleTextInterface

An interface for accessible objects containing formatted text.

The GtkAccessibleText interfaces is meant to be implemented by accessible objects that have text formatted with attributes, or non-trivial text contents.

You should use the [enum`Gtk`.AccessibleProperty.LABEL] or the [enum`Gtk`.AccessibleProperty.DESCRIPTION] properties for accessible objects containing simple, unformatted text.

New in version 4.14.

update_caret_position()[source]

Updates the position of the caret.

Implementations of the GtkAccessibleText interface should call this function every time the caret has moved, in order to notify assistive technologies.

New in version 4.14.

update_contents(change, start, end)[source]
Parameters:
  • change (Gtk.AccessibleTextContentChange) – the type of change in the contents

  • start (int) – the starting offset of the change, in characters

  • end (int) – the end offset of the change, in characters

Notifies assistive technologies of a change in contents.

Implementations of the GtkAccessibleText interface should call this function every time their contents change as the result of an operation, like an insertion or a removal.

Note: If the change is a deletion, this function must be called *before* removing the contents, if it is an insertion, it must be called *after* inserting the new contents.

New in version 4.14.

update_selection_bound()[source]

Updates the boundary of the selection.

Implementations of the GtkAccessibleText interface should call this function every time the selection has moved, in order to notify assistive technologies.

New in version 4.14.

do_get_attributes(offset) virtual
Parameters:

offset (int) – the offset, in characters

Returns:

true if the accessible object has at least an attribute, and false otherwise

ranges:

the ranges of the attributes inside the accessible object

attribute_names:

the names of the attributes inside the accessible object

attribute_values:

the values of the attributes inside the accessible object

Return type:

(bool, ranges: [Gtk.AccessibleTextRange], attribute_names: [str], attribute_values: [str])

Retrieves the text attributes inside the accessible object.

Each attribute is composed by:

  • a range

  • a name

  • a value

It is left to the implementation to determine the serialization format of the value to a string.

GTK provides support for various text attribute names and values, but implementations of this interface are free to add their own attributes.

If this function returns true, n_ranges will be set to a value greater than or equal to one, ranges will be set to a newly allocated array of [struct#Gtk.AccessibleTextRange].

New in version 4.14.

do_get_caret_position() virtual
Returns:

the position of the caret, in characters

Return type:

int

Retrieves the position of the caret inside the accessible object.

New in version 4.14.

do_get_contents(start, end) virtual
Parameters:
  • start (int) – the beginning of the range, in characters

  • end (int) – the end of the range, in characters

Returns:

the requested slice of the contents of the accessible object, as UTF-8. Note that the slice does not have to be NUL-terminated

Return type:

GLib.Bytes

Retrieve the current contents of the accessible object within the given range.

If end is G_MAXUINT, the end of the range is the full content of the accessible object.

New in version 4.14.

do_get_contents_at(offset, granularity) virtual
Parameters:
Returns:

the requested slice of the contents of the accessible object, as UTF-8. Note that the slice does not have to be NUL-terminated

start:

the start of the range, in characters

end:

the end of the range, in characters

Return type:

(GLib.Bytes, start: int, end: int)

Retrieve the current contents of the accessible object starting from the given offset, and using the given granularity.

The start and end values contain the boundaries of the text.

New in version 4.14.

do_get_default_attributes() virtual
Returns:

attribute_names:

the names of the default attributes inside the accessible object

attribute_values:

the values of the default attributes inside the accessible object

Return type:

(attribute_names: [str], attribute_values: [str])

Retrieves the default text attributes inside the accessible object.

Each attribute is composed by:

  • a name

  • a value

It is left to the implementation to determine the serialization format of the value to a string.

GTK provides support for various text attribute names and values, but implementations of this interface are free to add their own attributes.

New in version 4.14.

do_get_extents(start, end, extents) virtual
Parameters:
  • start (int) – the start offset, in characters

  • end (int) – the end offset, in characters, extents (out caller-allocates): return location for the extents

  • extents (Graphene.Rect) –

Returns:

true if the extents were filled in, false otherwise

Return type:

bool

Obtains the extents of a range of text, in widget coordinates.

New in version 4.16.

do_get_offset(point) virtual
Parameters:

point (Graphene.Point) – a point in widget coordinates of self

Returns:

true if the offset was set, false otherwise

offset:

return location for the text offset at point

Return type:

(bool, offset: int)

Gets the text offset at a given point.

New in version 4.16.

do_get_selection() virtual
Returns:

true if there is at least a selection inside the accessible object, and false otherwise

ranges:

the selection ranges

Return type:

(bool, ranges: [Gtk.AccessibleTextRange])

Retrieves the selection ranges in the accessible object.

If this function returns true, n_ranges will be set to a value greater than or equal to one, and ranges will be set to a newly allocated array of [struct#Gtk.AccessibleTextRange].

New in version 4.14.