Module: Gtk::AccessibleText

Defined in:
(unknown)

Overview

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 [enumGtk.AccessibleProperty.LABEL] or the
[enumGtk.AccessibleProperty.DESCRIPTION] properties for accessible
objects containing simple, unformatted text.

Instance Method Summary collapse

Instance Method Details

#caret_position ⇒ Integer

Retrieves the position of the caret inside the accessible object.

Returns:

  • (Integer) —

    the position of the caret, in characters

#caret_position=(offset) ⇒ Boolean

Sets the caret position.

Parameters:

  • offset (Integer) —

    the text offset in characters

Returns:

  • (Boolean) —

    true if the caret position was updated

#get_attributes(offset, n_ranges, ranges, attribute_names, attribute_values) ⇒ Boolean

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

Parameters:

  • offset (Integer) —

    the offset, in characters

  • n_ranges (Integer) —

    the number of attributes

  • ranges (Array<Gtk::AccessibleTextRange>) —

    the ranges of the attributes
    inside the accessible object

  • attribute_names (Array<String>) —

    the
    names of the attributes inside the accessible object

  • attribute_values (Array<String>) —

    the
    values of the attributes inside the accessible object

Returns:

  • (Boolean) —

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

#get_contents(start, end) ⇒ 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.

Parameters:

  • start (Integer) —

    the beginning of the range, in characters

  • end (Integer) —

    the end of the range, in characters

Returns:

  • (GLib::Bytes) —

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

#get_contents_at(offset, granularity, start, end) ⇒ GLib::Bytes

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.

Parameters:

  • offset (Integer) —

    the offset, in characters

  • granularity (Gtk::AccessibleTextGranularity) —

    the granularity of the query

  • start (Integer) —

    the start of the range, in characters

  • end (Integer) —

    the end of the range, in characters

Returns:

  • (GLib::Bytes) —

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

#get_default_attributes(attribute_names, attribute_values) ⇒ nil

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.

Parameters:

  • attribute_names (Array<String>) —

    the
    names of the default attributes inside the accessible object

  • attribute_values (Array<String>) —

    the
    values of the default attributes inside the accessible object

Returns:

  • (nil)

#get_extents(start, end, extents) ⇒ Boolean

Obtains the extents of a range of text, in widget coordinates.
extents (out caller-allocates): return location for the extents

Parameters:

  • start (Integer) —

    the start offset, in characters

  • end (Integer) —

    the end offset, in characters,

  • extents (Graphene::Rect)

Returns:

  • (Boolean) —

    true if the extents were filled in, false otherwise

#get_offset(point, offset) ⇒ Boolean

Gets the text offset at a given point.

Parameters:

  • point (Graphene::Point) —

    a point in widget coordinates of self

  • offset (Integer) —

    return location for the text offset at point

Returns:

  • (Boolean) —

    true if the offset was set, false otherwise

#get_selection(n_ranges, ranges) ⇒ Boolean

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

Parameters:

  • n_ranges (Integer) —

    the number of selection ranges

  • ranges (Array<Gtk::AccessibleTextRange>) —

    the selection ranges

Returns:

  • (Boolean) —

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

#set_selection(i, range) ⇒ Boolean

Sets the caret position.

Parameters:

  • i (Integer) —

    the selection to set

  • range (Gtk::AccessibleTextRange) —

    the range to set the selection to

Returns:

  • (Boolean) —

    true if the selection was updated

#update_caret_position ⇒ nil

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.

Returns:

  • (nil)

#update_contents(change, start, end) ⇒ nil

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.

Parameters:

  • change (Gtk::AccessibleTextContentChange) —

    the type of change in the contents

  • start (Integer) —

    the starting offset of the change, in characters

  • end (Integer) —

    the end offset of the change, in characters

Returns:

  • (nil)

#update_selection_bound ⇒ nil

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.

Returns:

  • (nil)