gtkmm: Gtk::AccessibleText Class Reference

gtkmm 4.14.0

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::AccessibleText Class Reference

An interface for accessible objects containing formatted text. More...

`#include <gtkmm/accessibletext.h>`

Inheritance diagram for Gtk::AccessibleText:
[legend]

## Public Types
enum class | Granularity { Granularity::CHARACTER , Granularity::WORD , Granularity::SENTENCE , Granularity::LINE , Granularity::PARAGRAPH }
| The granularity for queries about the text contents of a Gtk::AccessibleText implementation. More...
enum class | ContentChange { ContentChange::INSERT , ContentChange::REMOVE }
| The type of contents change operation. More...

## Public Member Functions
| AccessibleText (AccessibleText &&src) noexcept
AccessibleText & | operator= (AccessibleText &&src) noexcept
| ~AccessibleText () noexcept override
GtkAccessibleText * | gobj ()
| Provides access to the underlying C GObject.
const GtkAccessibleText * | gobj () const
| Provides access to the underlying C GObject.
void | update_caret_position ()
| Updates the position of the caret.
void | update_selection_bound ()
| Updates the boundary of the selection.
void | update_contents (ContentChange change, unsigned int start, unsigned int end)
| Notifies assistive technologies of a change in contents.

## Static Public Member Functions
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions
| AccessibleText ()
| You should derive from this class to use it.
virtual Glib::RefPtr< Glib::Bytes > | get_contents_vfunc (unsigned int start, unsigned int end) const
| Retrieve the current contents of the accessible object within the given range.
virtual Glib::RefPtr< Glib::Bytes > | get_contents_at_vfunc (unsigned int offset, Granularity granularity, unsigned int *start, unsigned int *end) const
| Retrieve the current contents of the accessible object starting from the given offset, and using the given granularity.
virtual unsigned int | get_caret_position_vfunc () const
| Retrieves the position of the caret inside the accessible object.
virtual bool | get_selection_vfunc (gsize *n_ranges, GtkAccessibleTextRange ** ranges) const
| Retrieves the selection ranges in the accessible object.
virtual bool | get_attributes_vfunc (unsigned int offset, gsize *n_ranges, GtkAccessibleTextRange ** ranges, char ***attribute_names, char ***attribute_values) const
| Retrieves the text attributes inside the accessible object.
virtual void | get_default_attributes_vfunc (char ***attribute_names, char ***attribute_values) const
| Retrieves the default text attributes inside the accessible object.

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::AccessibleText > | wrap (GtkAccessibleText *object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

An interface for accessible objects containing formatted text.

The Gtk::AccessibleText interface is meant to be implemented by accessible objects that have text formatted with attributes, or non-trivial text contents.

You should use the Gtk::Accessible::Property::LABEL or the Gtk::Accessible::Property::DESCRIPTION properties for accessible objects containing simple, unformatted text.

Since gtkmm 4.14

## Constructor & Destructor Documentation

## ◆ AccessibleText() [1/2]

Gtk::AccessibleText::AccessibleText | ( |  | ) |
| protected

You should derive from this class to use it.

## ◆ AccessibleText() [2/2]

Gtk::AccessibleText::AccessibleText | ( | AccessibleText && | src | ) |
| noexcept

## ◆ ~AccessibleText()

Gtk::AccessibleText::~AccessibleText | ( |  | ) |
| overridenoexcept

## Member Function Documentation

## ◆ add_interface()

static void Gtk::AccessibleText::add_interface | ( | GType | gtype_implementer | ) |
| static

## ◆ get_attributes_vfunc()

virtual bool Gtk::AccessibleText::get_attributes_vfunc | ( | unsigned int | offset,
|  | gsize * | n_ranges,
|  | GtkAccessibleTextRange ** | ranges,
|  | char *** | attribute_names,
|  | char *** | attribute_values ) const
| protectedvirtual

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

Parameters

  | offset | The offset, in characters.
  [out] | n_ranges | The number of attributes.
  [out] | ranges | (array length=n_ranges) (optional) (transfer container) The ranges of the attributes inside the accessible object.
  [out] | attribute_names | (array zero-terminated=1) (optional) (transfer full) The names of the attributes inside the accessible object.
  [out] | attribute_values | (array zero-terminated=1) (optional) (transfer full) The values of the attributes inside the accessible object.

Returns
  `true` if the accessible object has at least one attribute, and `false` otherwise.

Since gtkmm 4.14

## ◆ get_caret_position_vfunc()

virtual unsigned int Gtk::AccessibleText::get_caret_position_vfunc | ( |  | ) | const
| protectedvirtual

Retrieves the position of the caret inside the accessible object.

Returns
  The position of the caret, in characters.

Since gtkmm 4.14

## ◆ get_contents_at_vfunc()

virtual Glib::RefPtr< Glib::Bytes > Gtk::AccessibleText::get_contents_at_vfunc | ( | unsigned int | offset,
|  | Granularity | granularity,
|  | unsigned int * | start,
|  | unsigned int * | end ) const
| protectedvirtual

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 | The offset, in characters.
  | granularity | The granularity of the query.
  [out] | start | The start of the range, in characters.
  [out] | end | 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.

Since gtkmm 4.14

## ◆ get_contents_vfunc()

virtual Glib::RefPtr< Glib::Bytes > Gtk::AccessibleText::get_contents_vfunc | ( | unsigned int | start,
|  | unsigned int | end ) const
| protectedvirtual

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 | The beginning of the range, in characters.
  end | 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.

Since gtkmm 4.14

## ◆ get_default_attributes_vfunc()

virtual void Gtk::AccessibleText::get_default_attributes_vfunc | ( | char *** | attribute_names,
|  | char *** | attribute_values ) const
| protectedvirtual

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

  [out] | attribute_names | (array zero-terminated=1) (optional) (transfer full) The names of the default attributes inside the accessible object.
  [out] | attribute_values | (array zero-terminated=1) (optional) (transfer full) The values of the default attributes inside the accessible object.

Since gtkmm 4.14

## ◆ get_selection_vfunc()

virtual bool Gtk::AccessibleText::get_selection_vfunc | ( | gsize * | n_ranges,
|  | GtkAccessibleTextRange ** | ranges ) const
| protectedvirtual

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

Parameters

  [out] | n_ranges | The number of selection ranges.
  [out] | ranges | (optional) (array length=n_ranges) (transfer container) The selection ranges.

Returns
  `true` if there is at least one selection inside the accessible object, and `false` otherwise.

Since gtkmm 4.14

## ◆ get_type()

static GType Gtk::AccessibleText::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GtkAccessibleText * Gtk::AccessibleText::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkAccessibleText * Gtk::AccessibleText::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ operator=()

AccessibleText & Gtk::AccessibleText::operator= | ( | AccessibleText && | src | ) |
| noexcept

## ◆ update_caret_position()

void Gtk::AccessibleText::update_caret_position | ( |  | ) |

Updates the position of the caret.

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

Since gtkmm 4.14

## ◆ update_contents()

void Gtk::AccessibleText::update_contents | ( | ContentChange | change,
|  | unsigned int | start,
|  | unsigned int | end )

Notifies assistive technologies of a change in contents.

Implementations of the `Gtk::AccessibleText` 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.

Since gtkmm 4.14

Parameters

  change | The type of change in the contents.
  start | The starting offset of the change, in characters.
  end | The end offset of the change, in characters.

## ◆ update_selection_bound()

void Gtk::AccessibleText::update_selection_bound | ( |  | ) |

Updates the boundary of the selection.

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

Since gtkmm 4.14

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::AccessibleText > wrap | ( | GtkAccessibleText * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.