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:
Inheritance graph
[legend]

Public Types

enum class  Granularity {
  CHARACTER ,
  WORD ,
  SENTENCE ,
  LINE ,
  PARAGRAPH
}
 
enum class  ContentChange {
  INSERT ,
  REMOVE
}
 

Public Member Functions

 AccessibleText (AccessibleText &&src) noexcept
 
AccessibleTextoperator= (AccessibleText &&src) noexcept
 
 ~AccessibleText () noexcept override
 
GtkAccessibleTextgobj ()
 Provides access to the underlying C GObject.
 
const GtkAccessibleTextgobj () 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::AccessibleTextwrap (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:

Member Enumeration Documentation

◆ ContentChange

Enumerator
INSERT 

Contents change as the result of an insert operation.

REMOVE 

Contents change as the result of a remove operation.

◆ Granularity

Enumerator
CHARACTER 

Use the boundary between characters (including non-printing characters).

WORD 

Use the boundary between words, starting from the beginning of the current word and ending at the beginning of the next word.

SENTENCE 

Use the boundary between sentences, starting from the beginning of the current sentence and ending at the beginning of the next sentence.

LINE 

Use the boundary between lines, starting from the beginning of the current line and ending at the beginning of the next line.

PARAGRAPH 

Use the boundary between paragraphs, starting from the beginning of the current paragraph and ending at the beginning of the next paragraph.

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
offsetThe offset, in characters.
[out]n_rangesThe 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
offsetThe offset, in characters.
granularityThe granularity of the query.
[out]startThe start of the range, in characters.
[out]endThe 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
startThe beginning of the range, in characters.
endThe 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_rangesThe 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
changeThe type of change in the contents.
startThe starting offset of the change, in characters.
endThe 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
objectThe C instance.
take_copyFalse 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.