Atk.Text
Description: Reference for Atk.Text

### Interface

# AtkText

#### Description [src]

    interface Atk.Text : GObject.Object

The ATK interface implemented by components with text content.

`AtkText` should be implemented by `AtkObjects` on behalf of widgets that have text content which is either attributed or otherwise non-trivial. `AtkObjects` whose text content is simple, unattributed, and very brief may expose that content via

# atk_object_get_name instead; however if the text is editable,

multi-line, typically longer than three or four words, attributed, selectable, or if the object already uses the ‘name’ ATK property for other information, the `AtkText` interface should be used to expose the text content. In the case of editable text content, `AtkEditableText` (a subtype of the `AtkText` interface) should be implemented instead.

`AtkText` provides not only traversal facilities and change notification for text content, but also caret tracking and glyph bounding box calculations. Note that the text strings are exposed as UTF-8, and are therefore potentially multi-byte, and caret-to-byte offset mapping makes no assumptions about the character length; also bounding box glyph-to-offset mapping may be complex for languages which use ligatures.

#### Prerequisite

In order to implement Text, your type must inherit from`GObject`.

#### Implementations

- AtkNoOpObject

#### Functions

###### atk_text_free_ranges

Frees the memory associated with an array of AtkTextRange. It is assumed that the array was returned by the function atk_text_get_bounded_ranges and is NULL terminated.

since: 1.3

#### Instance methods

###### atk_text_add_selection

Adds a selection bounded by the specified offsets.

###### atk_text_get_bounded_ranges

Get the ranges of text in the specified bounding box.

since: 1.3

###### atk_text_get_caret_offset

Gets the offset of the position of the caret (cursor).

###### atk_text_get_character_at_offset

Gets the specified text.

###### atk_text_get_character_count

Gets the character count.

###### atk_text_get_character_extents

If the extent can not be obtained (e.g. missing support), all of x, y, width, height are set to -1.

###### atk_text_get_default_attributes

Creates an `AtkAttributeSet` which consists of the default values of attributes for the text. See the enum AtkTextAttribute for types of text attributes that can be returned. Note that other attributes may also be returned.

###### atk_text_get_n_selections

Gets the number of selected regions.

###### atk_text_get_offset_at_point

Gets the offset of the character located at coordinates `x` and `y`. `x` and `y` are interpreted as being relative to the screen or this widget’s window depending on `coords`.

###### atk_text_get_range_extents

Get the bounding box for text within the specified range.

since: 1.3

###### atk_text_get_run_attributes

Creates an `AtkAttributeSet` which consists of the attributes explicitly set at the position `offset` in the text. `start_offset` and `end_offset` are set to the start and end of the range around `offset` where the attributes are invariant. Note that `end_offset` is the offset of the first character after the range. See the enum AtkTextAttribute for types of text attributes that can be returned. Note that other attributes may also be returned.

###### atk_text_get_selection

Gets the text from the specified selection.

###### atk_text_get_string_at_offset

Gets a portion of the text exposed through an `AtkText` according to a given `offset` and a specific `granularity`, along with the start and end offsets defining the boundaries of such a portion of text.

since: 2.10

###### atk_text_get_text

Gets the specified text.

###### atk_text_get_text_after_offset

Gets the specified text.

deprecated: 2.9.3

###### atk_text_get_text_at_offset

Gets the specified text.

deprecated: Unknown

###### atk_text_get_text_before_offset

Gets the specified text.

deprecated: 2.9.3

###### atk_text_remove_selection

Removes the specified selection.

###### atk_text_scroll_substring_to

Makes a substring of `text` visible on the screen by scrolling all necessary parents.

since: 2.32

###### atk_text_scroll_substring_to_point

Move the top-left of a substring of `text` to a given position of the screen by scrolling all necessary parents.

since: 2.32

###### atk_text_set_caret_offset

Sets the caret (cursor) position to the specified `offset`.

###### atk_text_set_selection

Changes the start and end offset of the specified selection.

#### Signals

###### Atk.Text::text-attributes-changed

The “text-attributes-changed” signal is emitted when the text attributes of the text of an object which implements AtkText changes.

###### Atk.Text::text-caret-moved

The “text-caret-moved” signal is emitted when the caret position of the text of an object which implements AtkText changes.

###### Atk.Text::text-changed

The “text-changed” signal is emitted when the text of the object which implements the AtkText interface changes, This signal will have a detail which is either “insert” or “delete” which identifies whether the text change was an insertion or a deletion.

deprecated: 2.9.4

###### Atk.Text::text-insert

The “text-insert” signal is emitted when a new text is inserted. If the signal was not triggered by the user (e.g. typing or pasting text), the “system” detail should be included.

###### Atk.Text::text-remove

The “text-remove” signal is emitted when a new text is removed. If the signal was not triggered by the user (e.g. typing or pasting text), the “system” detail should be included.

###### Atk.Text::text-selection-changed

The “text-selection-changed” signal is emitted when the selected text of an object which implements AtkText changes.

#### Interface structure

    struct AtkTextIface {
      GTypeInterface parent;
      gchar* (* get_text) (
        AtkText* text,
        gint start_offset,
        gint end_offset
      );
      gchar* (* get_text_after_offset) (
        AtkText* text,
        gint offset,
        AtkTextBoundary boundary_type,
        gint* start_offset,
        gint* end_offset
      );
      gchar* (* get_text_at_offset) (
        AtkText* text,
        gint offset,
        AtkTextBoundary boundary_type,
        gint* start_offset,
        gint* end_offset
      );
      gunichar (* get_character_at_offset) (
        AtkText* text,
        gint offset
      );
      gchar* (* get_text_before_offset) (
        AtkText* text,
        gint offset,
        AtkTextBoundary boundary_type,
        gint* start_offset,
        gint* end_offset
      );
      gint (* get_caret_offset) (
        AtkText* text
      );
      AtkAttributeSet* (* get_run_attributes) (
        AtkText* text,
        gint offset,
        gint* start_offset,
        gint* end_offset
      );
      AtkAttributeSet* (* get_default_attributes) (
        AtkText* text
      );
      void (* get_character_extents) (
        AtkText* text,
        gint offset,
        gint* x,
        gint* y,
        gint* width,
        gint* height,
        AtkCoordType coords
      );
      gint (* get_character_count) (
        AtkText* text
      );
      gint (* get_offset_at_point) (
        AtkText* text,
        gint x,
        gint y,
        AtkCoordType coords
      );
      gint (* get_n_selections) (
        AtkText* text
      );
      gchar* (* get_selection) (
        AtkText* text,
        gint selection_num,
        gint* start_offset,
        gint* end_offset
      );
      gboolean (* add_selection) (
        AtkText* text,
        gint start_offset,
        gint end_offset
      );
      gboolean (* remove_selection) (
        AtkText* text,
        gint selection_num
      );
      gboolean (* set_selection) (
        AtkText* text,
        gint selection_num,
        gint start_offset,
        gint end_offset
      );
      gboolean (* set_caret_offset) (
        AtkText* text,
        gint offset
      );
      void (* text_changed) (
        AtkText* text,
        gint position,
        gint length
      );
      void (* text_caret_moved) (
        AtkText* text,
        gint location
      );
      void (* text_selection_changed) (
        AtkText* text
      );
      void (* text_attributes_changed) (
        AtkText* text
      );
      void (* get_range_extents) (
        AtkText* text,
        gint start_offset,
        gint end_offset,
        AtkCoordType coord_type,
        AtkTextRectangle* rect
      );
      AtkTextRange** (* get_bounded_ranges) (
        AtkText* text,
        AtkTextRectangle* rect,
        AtkCoordType coord_type,
        AtkTextClipType x_clip_type,
        AtkTextClipType y_clip_type
      );
      gchar* (* get_string_at_offset) (
        AtkText* text,
        gint offset,
        AtkTextGranularity granularity,
        gint* start_offset,
        gint* end_offset
      );
      gboolean (* scroll_substring_to) (
        AtkText* text,
        gint start_offset,
        gint end_offset,
        AtkScrollType type
      );
      gboolean (* scroll_substring_to_point) (
        AtkText* text,
        gint start_offset,
        gint end_offset,
        AtkCoordType coords,
        gint x,
        gint y
      );

    }

No description available.

###### Interface members

`parent` |
    GTypeInterface
| No description available.
`get_text` |
    gchar* (* get_text) (
        AtkText* text,
        gint start_offset,
        gint end_offset
      )
| No description available.
`get_text_after_offset` |
    gchar* (* get_text_after_offset) (
        AtkText* text,
        gint offset,
        AtkTextBoundary boundary_type,
        gint* start_offset,
        gint* end_offset
      )
| Gets specified text. This virtual function is deprecated and it should not be overridden.
`get_text_at_offset` |
    gchar* (* get_text_at_offset) (
        AtkText* text,
        gint offset,
        AtkTextBoundary boundary_type,
        gint* start_offset,
        gint* end_offset
      )
| Gets specified text. This virtual function is deprecated and it should not be overridden.
`get_character_at_offset` |
    gunichar (* get_character_at_offset) (
        AtkText* text,
        gint offset
      )
| No description available.
`get_text_before_offset` |
    gchar* (* get_text_before_offset) (
        AtkText* text,
        gint offset,
        AtkTextBoundary boundary_type,
        gint* start_offset,
        gint* end_offset
      )
| Gets specified text. This virtual function is deprecated and it should not be overridden.
`get_caret_offset` |
    gint (* get_caret_offset) (
        AtkText* text
      )
| No description available.
`get_run_attributes` |
    AtkAttributeSet* (* get_run_attributes) (
        AtkText* text,
        gint offset,
        gint* start_offset,
        gint* end_offset
      )
| No description available.
`get_default_attributes` |
    AtkAttributeSet* (* get_default_attributes) (
        AtkText* text
      )
| No description available.
`get_character_extents` |
    void (* get_character_extents) (
        AtkText* text,
        gint offset,
        gint* x,
        gint* y,
        gint* width,
        gint* height,
        AtkCoordType coords
      )
| No description available.
`get_character_count` |
    gint (* get_character_count) (
        AtkText* text
      )
| No description available.
`get_offset_at_point` |
    gint (* get_offset_at_point) (
        AtkText* text,
        gint x,
        gint y,
        AtkCoordType coords
      )
| No description available.
`get_n_selections` |
    gint (* get_n_selections) (
        AtkText* text
      )
| No description available.
`get_selection` |
    gchar* (* get_selection) (
        AtkText* text,
        gint selection_num,
        gint* start_offset,
        gint* end_offset
      )
| No description available.
`add_selection` |
    gboolean (* add_selection) (
        AtkText* text,
        gint start_offset,
        gint end_offset
      )
| No description available.
`remove_selection` |
    gboolean (* remove_selection) (
        AtkText* text,
        gint selection_num
      )
| No description available.
`set_selection` |
    gboolean (* set_selection) (
        AtkText* text,
        gint selection_num,
        gint start_offset,
        gint end_offset
      )
| No description available.
`set_caret_offset` |
    gboolean (* set_caret_offset) (
        AtkText* text,
        gint offset
      )
| No description available.
`text_changed` |
    void (* text_changed) (
        AtkText* text,
        gint position,
        gint length
      )
| The signal handler which is executed when there is a text change. This virtual function is deprecated sice 2.9.4 and it should not be overriden.
`text_caret_moved` |
    void (* text_caret_moved) (
        AtkText* text,
        gint location
      )
| No description available.
`text_selection_changed` |
    void (* text_selection_changed) (
        AtkText* text
      )
| No description available.
`text_attributes_changed` |
    void (* text_attributes_changed) (
        AtkText* text
      )
| No description available.
`get_range_extents` |
    void (* get_range_extents) (
        AtkText* text,
        gint start_offset,
        gint end_offset,
        AtkCoordType coord_type,
        AtkTextRectangle* rect
      )
| No description available.
`get_bounded_ranges` |
    AtkTextRange** (* get_bounded_ranges) (
        AtkText* text,
        AtkTextRectangle* rect,
        AtkCoordType coord_type,
        AtkTextClipType x_clip_type,
        AtkTextClipType y_clip_type
      )
| No description available.
`get_string_at_offset` |
    gchar* (* get_string_at_offset) (
        AtkText* text,
        gint offset,
        AtkTextGranularity granularity,
        gint* start_offset,
        gint* end_offset
      )
| Gets a portion of the text exposed through an AtkText according to a given offset and a specific granularity, along with the start and end offsets defining the boundaries of such a portion of text.
`scroll_substring_to` |
    gboolean (* scroll_substring_to) (
        AtkText* text,
        gint start_offset,
        gint end_offset,
        AtkScrollType type
      )
| No description available.
`scroll_substring_to_point` |
    gboolean (* scroll_substring_to_point) (
        AtkText* text,
        gint start_offset,
        gint end_offset,
        AtkCoordType coords,
        gint x,
        gint y
      )
| No description available.

#### Virtual methods

###### Atk.Text.add_selection

Adds a selection bounded by the specified offsets.

###### Atk.Text.get_bounded_ranges

Get the ranges of text in the specified bounding box.

since: 1.3

###### Atk.Text.get_caret_offset

Gets the offset of the position of the caret (cursor).

###### Atk.Text.get_character_at_offset

Gets the specified text.

###### Atk.Text.get_character_count

Gets the character count.

###### Atk.Text.get_character_extents

If the extent can not be obtained (e.g. missing support), all of x, y, width, height are set to -1.

###### Atk.Text.get_default_attributes

Creates an `AtkAttributeSet` which consists of the default values of attributes for the text. See the enum AtkTextAttribute for types of text attributes that can be returned. Note that other attributes may also be returned.

###### Atk.Text.get_n_selections

Gets the number of selected regions.

###### Atk.Text.get_offset_at_point

Gets the offset of the character located at coordinates `x` and `y`. `x` and `y` are interpreted as being relative to the screen or this widget’s window depending on `coords`.

###### Atk.Text.get_range_extents

Get the bounding box for text within the specified range.

since: 1.3

###### Atk.Text.get_run_attributes

Creates an `AtkAttributeSet` which consists of the attributes explicitly set at the position `offset` in the text. `start_offset` and `end_offset` are set to the start and end of the range around `offset` where the attributes are invariant. Note that `end_offset` is the offset of the first character after the range. See the enum AtkTextAttribute for types of text attributes that can be returned. Note that other attributes may also be returned.

###### Atk.Text.get_selection

Gets the text from the specified selection.

###### Atk.Text.get_string_at_offset

Gets a portion of the text exposed through an `AtkText` according to a given `offset` and a specific `granularity`, along with the start and end offsets defining the boundaries of such a portion of text.

since: 2.10

###### Atk.Text.get_text

Gets the specified text.

###### Atk.Text.get_text_after_offset

Gets the specified text.

deprecated: 2.9.3

###### Atk.Text.get_text_at_offset

Gets the specified text.

deprecated: Unknown

###### Atk.Text.get_text_before_offset

Gets the specified text.

deprecated: 2.9.3

###### Atk.Text.remove_selection

Removes the specified selection.

###### Atk.Text.scroll_substring_to

Makes a substring of `text` visible on the screen by scrolling all necessary parents.

since: 2.32

###### Atk.Text.scroll_substring_to_point

Move the top-left of a substring of `text` to a given position of the screen by scrolling all necessary parents.

since: 2.32

###### Atk.Text.set_caret_offset

Sets the caret (cursor) position to the specified `offset`.

###### Atk.Text.set_selection

Changes the start and end offset of the specified selection.

###### Atk.Text.text_attributes_changed

No description available.

###### Atk.Text.text_caret_moved

No description available.

###### Atk.Text.text_changed

The signal handler which is executed when there is a text change. This virtual function is deprecated sice 2.9.4 and it should not be overriden.

###### Atk.Text.text_selection_changed

No description available.