Trait atk::prelude::TextExt[][src]

pub trait TextExt: 'static {
Show methods fn add_selection(&self, start_offset: i32, end_offset: i32) -> bool;
fn bounded_ranges(
        &self,
        rect: &mut TextRectangle,
        coord_type: CoordType,
        x_clip_type: TextClipType,
        y_clip_type: TextClipType
    ) -> Vec<TextRange>;
fn caret_offset(&self) -> i32;
fn character_at_offset(&self, offset: i32) -> char;
fn character_count(&self) -> i32;
fn character_extents(
        &self,
        offset: i32,
        coords: CoordType
    ) -> (i32, i32, i32, i32);
fn n_selections(&self) -> i32;
fn offset_at_point(&self, x: i32, y: i32, coords: CoordType) -> i32;
fn range_extents(
        &self,
        start_offset: i32,
        end_offset: i32,
        coord_type: CoordType
    ) -> TextRectangle;
fn selection(&self, selection_num: i32) -> (GString, i32, i32);
fn string_at_offset(
        &self,
        offset: i32,
        granularity: TextGranularity
    ) -> (Option<GString>, i32, i32);
fn text(&self, start_offset: i32, end_offset: i32) -> Option<GString>;
fn text_at_offset(
        &self,
        offset: i32,
        boundary_type: TextBoundary
    ) -> (GString, i32, i32);
fn remove_selection(&self, selection_num: i32) -> bool;
fn scroll_substring_to(
        &self,
        start_offset: i32,
        end_offset: i32,
        type_: ScrollType
    ) -> bool;
fn scroll_substring_to_point(
        &self,
        start_offset: i32,
        end_offset: i32,
        coords: CoordType,
        x: i32,
        y: i32
    ) -> bool;
fn set_caret_offset(&self, offset: i32) -> bool;
fn set_selection(
        &self,
        selection_num: i32,
        start_offset: i32,
        end_offset: i32
    ) -> bool;
fn connect_text_attributes_changed<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_text_caret_moved<F: Fn(&Self, i32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_text_insert<F: Fn(&Self, i32, i32, &str) + 'static>(
        &self,
        detail: Option<&str>,
        f: F
    ) -> SignalHandlerId;
fn connect_text_remove<F: Fn(&Self, i32, i32, &str) + 'static>(
        &self,
        detail: Option<&str>,
        f: F
    ) -> SignalHandlerId;
fn connect_text_selection_changed<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}
Expand description

Trait containing all Text methods.

Implementors

NoOpObject, Text

Required methods

Adds a selection bounded by the specified offsets.

start_offset

the starting character offset of the selected region

end_offset

the offset of the first character after the selected region.

Returns

true if successful, false otherwise

Get the ranges of text in the specified bounding box.

rect

An AtkTextRectangle giving the dimensions of the bounding box.

coord_type

Specify whether coordinates are relative to the screen or widget window.

x_clip_type

Specify the horizontal clip type.

y_clip_type

Specify the vertical clip type.

Returns

Array of AtkTextRange. The last element of the array returned by this function will be NULL.

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

Returns

the character offset of the position of the caret or -1 if the caret is not located inside the element or in the case of any other failure.

Gets the specified text.

offset

a character offset within self

Returns

the character at offset or 0 in the case of failure.

Gets the character count.

Returns

the number of characters or -1 in case of failure.

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

Get the bounding box containing the glyph representing the character at a particular text offset.

offset

The offset of the text character for which bounding information is required.

coords

specify whether coordinates are relative to the screen or widget window

Returns

x

Pointer for the x coordinate of the bounding box

y

Pointer for the y coordinate of the bounding box

width

Pointer for the width of the bounding box

height

Pointer for the height of the bounding box

Gets the number of selected regions.

Returns

The number of selected regions, or -1 in the case of failure.

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.

x

screen x-position of character

y

screen y-position of character

coords

specify whether coordinates are relative to the screen or widget window

Returns

the offset to the character which is located at the specified x and y coordinates of -1 in case of failure.

Get the bounding box for text within the specified range.

If the extents can not be obtained (e.g. or missing support), the rectangle fields are set to -1.

start_offset

The offset of the first text character for which boundary information is required.

end_offset

The offset of the text character after the last character for which boundary information is required.

coord_type

Specify whether coordinates are relative to the screen or widget window.

Returns

rect

A pointer to a AtkTextRectangle which is filled in by this function.

Gets the text from the specified selection.

selection_num

The selection number. The selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

Returns

a newly allocated string containing the selected text. Use g_free() to free the returned string.

start_offset

passes back the starting character offset of the selected region

end_offset

passes back the ending character offset (offset immediately past) of the selected region

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.

If granularity is ATK_TEXT_GRANULARITY_CHAR the character at the offset is returned.

If granularity is ATK_TEXT_GRANULARITY_WORD the returned string is from the word start at or before the offset to the word start after the offset.

The returned string will contain the word at the offset if the offset is inside a word and will contain the word before the offset if the offset is not inside a word.

If granularity is ATK_TEXT_GRANULARITY_SENTENCE the returned string is from the sentence start at or before the offset to the sentence start after the offset.

The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence before the offset if the offset is not inside a sentence.

If granularity is ATK_TEXT_GRANULARITY_LINE the returned string is from the line start at or before the offset to the line start after the offset.

If granularity is ATK_TEXT_GRANULARITY_PARAGRAPH the returned string is from the start of the paragraph at or before the offset to the start of the following paragraph after the offset.

offset

position

granularity

An TextGranularity

Returns

a newly allocated string containing the text at the offset bounded by the specified granularity. Use g_free() to free the returned string. Returns None if the offset is invalid or no implementation is available.

start_offset

the starting character offset of the returned string, or -1 in the case of error (e.g. invalid offset, not implemented)

end_offset

the offset of the first character after the returned string, or -1 in the case of error (e.g. invalid offset, not implemented)

Gets the specified text.

start_offset

a starting character offset within self

end_offset

an ending character offset within self, or -1 for the end of the string.

Returns

a newly allocated string containing the text from start_offset up to, but not including end_offset. Use g_free() to free the returned string.

Gets the specified text.

If the boundary_type if ATK_TEXT_BOUNDARY_CHAR the character at the offset is returned.

If the boundary_type is ATK_TEXT_BOUNDARY_WORD_START the returned string is from the word start at or before the offset to the word start after the offset.

The returned string will contain the word at the offset if the offset is inside a word and will contain the word before the offset if the offset is not inside a word.

If the boundary type is ATK_TEXT_BOUNDARY_SENTENCE_START the returned string is from the sentence start at or before the offset to the sentence start after the offset.

The returned string will contain the sentence at the offset if the offset is inside a sentence and will contain the sentence before the offset if the offset is not inside a sentence.

If the boundary type is ATK_TEXT_BOUNDARY_LINE_START the returned string is from the line start at or before the offset to the line start after the offset.

Deprecated

This method is deprecated since ATK version 2.9.4. Please use string_at_offset() instead.

offset

position

boundary_type

An TextBoundary

Returns

a newly allocated string containing the text at offset bounded by the specified boundary_type. Use g_free() to free the returned string.

start_offset

the starting character offset of the returned string

end_offset

the offset of the first character after the returned substring

Removes the specified selection.

selection_num

The selection number. The selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

Returns

true if successful, false otherwise

This is supported on crate feature v2_32 only.

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

start_offset

start offset in the self

end_offset

end offset in the self, or -1 for the end of the text.

type_

specify where the object should be made visible.

Returns

whether scrolling was successful.

This is supported on crate feature v2_32 only.

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

start_offset

start offset in the self

end_offset

end offset in the self, or -1 for the end of the text.

coords

specify whether coordinates are relative to the screen or to the parent object.

x

x-position where to scroll to

y

y-position where to scroll to

Returns

whether scrolling was successful.

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

In the case of rich-text content, this method should either grab focus or move the sequential focus navigation starting point (if the application supports this concept) as if the user had clicked on the new caret position. Typically, this means that the target of this operation is the node containing the new caret position or one of its ancestors. In other words, after this method is called, if the user advances focus, it should move to the first focusable node following the new caret position.

Calling this method should also scroll the application viewport in a way that matches the behavior of the application’s typical caret motion or tab navigation as closely as possible. This also means that if the application’s caret motion or focus navigation does not trigger a scroll operation, this method should not trigger one either. If the application does not have a caret motion or focus navigation operation, this method should try to scroll the new caret position into view while minimizing unnecessary scroll motion.

offset

the character offset of the new caret position

Returns

true if successful, false otherwise.

Changes the start and end offset of the specified selection.

selection_num

The selection number. The selected regions are assigned numbers that correspond to how far the region is from the start of the text. The selected region closest to the beginning of the text region is assigned the number 0, etc. Note that adding, moving or deleting a selected region can change the numbering.

start_offset

the new starting character offset of the selection

end_offset

the new end position of (e.g. offset immediately past) the selection

Returns

true if successful, false otherwise

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

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

arg1

The new position of the text caret.

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.

arg1

The position (character offset) of the insertion.

arg2

The length (in characters) of text inserted.

arg3

The new text inserted

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.

arg1

The position (character offset) of the removal.

arg2

The length (in characters) of text removed.

arg3

The old text removed

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

Implementors