Text
Object Hierarchy:
Description:
[
CCode ( type_id =
"atk_text_get_type ()" ) ]
public interface Text :
Object
Text should be implemented by Objects on behalf of widgets that
have text content which is either attributed or otherwise non-trivial.
Objects whose text content is simple, unattributed, and very brief may expose that content
via 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
Text interface should be used to expose the text content. In the case of editable text content,
EditableText (a subtype of the Text interface) should
be implemented instead.
Text 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.
All known implementing classes:
Content:
Static methods:
Methods:
- public abstract bool add_selection (int start_offset, int end_offset)
Adds a selection bounded by the specified offsets.
- public virtual TextRange[] get_bounded_ranges (TextRectangle rect, CoordType coord_type, TextClipType x_clip_type, TextClipType y_clip_type)
Get the ranges of text in the specified bounding box.
- public abstract int get_caret_offset ()
Gets the offset of the position of the caret (cursor).
- public abstract unichar get_character_at_offset (int offset)
Gets the specified text.
- public abstract int get_character_count ()
Gets the character count.
- public abstract void get_character_extents (int offset, out int x, out int y, out int width, out int height, CoordType coords)
If the extent can not be obtained (e.g. missing support), all of x, y,
width, height are set to -1.
- public abstract AttributeSet get_default_attributes ()
Creates an AttributeSet
which consists of the default values of attributes for the text.
- public abstract int get_n_selections ()
Gets the number of selected regions.
- public abstract int get_offset_at_point (int x, int y, CoordType coords)
Gets the offset of the character located at coordinates x
and
y
.
- public abstract TextRectangle get_range_extents (int start_offset, int end_offset, CoordType coord_type)
Get the bounding box for text within the specified range.
- public abstract AttributeSet get_run_attributes (int offset, out int start_offset, out int end_offset)
Creates an AttributeSet
which consists of the attributes explicitly set at the position offset
in the text.
- public abstract string get_selection (int selection_num, out int start_offset, out int end_offset)
Gets the text from the specified selection.
- public abstract string? get_string_at_offset (int offset, TextGranularity granularity, out int start_offset, out int end_offset)
Gets a portion of the text exposed through an Text
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.
- public abstract string get_text (int start_offset, int end_offset)
Gets the specified text.
- public abstract string get_text_after_offset (int offset, TextBoundary boundary_type, out int start_offset, out int end_offset)
Gets the specified text.
- public abstract string get_text_at_offset (int offset, TextBoundary boundary_type, out int start_offset, out int end_offset)
Gets the specified text.
- public abstract string get_text_before_offset (int offset, TextBoundary boundary_type, out int start_offset, out int end_offset)
Gets the specified text.
- public abstract bool remove_selection (int selection_num)
Removes the specified selection.
- public abstract bool scroll_substring_to (int start_offset, int end_offset, ScrollType type)
Makes a substring of this visible on the
screen by scrolling all necessary parents.
- public abstract bool scroll_substring_to_point (int start_offset, int end_offset, CoordType coords, int x, int y)
Move the top-left of a substring of this
to a given position of the screen by scrolling all necessary parents.
- public abstract bool set_caret_offset (int offset)
Sets the caret (cursor) position to the specified offset
.
- public abstract bool set_selection (int selection_num, int start_offset, int end_offset)
Changes the start and end offset of the specified selection.
Signals:
- public virtual signal void text_attributes_changed ()
The "text-attributes-changed" signal is emitted when the text attributes of
the text of an object which implements AtkText changes.
- public virtual signal void text_caret_moved (int location)
The "text-caret-moved" signal is emitted when the caret position of the text
of an object which implements AtkText changes.
- public virtual signal void text_changed (int position, int length)
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.
- public signal void text_insert (int arg1, int arg2, string arg3)
The "text-insert" signal is emitted when a new text is inserted.
- public signal void text_remove (int arg1, int arg2, string arg3)
The "text-remove" signal is emitted when a new text is removed.
- public virtual signal void text_selection_changed ()
The "text-selection-changed" signal is emitted when the selected text of an
object which implements AtkText changes.
Inherited Members:
All known members inherited from class GLib.Object