gtkmm: Gtk::AccessibleText Class Reference

gtkmm 4.15.1

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 Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## 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.
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## 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.
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

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