[][src]Trait atk::TextExt

pub trait TextExt: 'static {
    fn add_selection(&self, start_offset: i32, end_offset: i32) -> bool;
fn get_bounded_ranges(
        &self,
        rect: &mut TextRectangle,
        coord_type: CoordType,
        x_clip_type: TextClipType,
        y_clip_type: TextClipType
    ) -> Vec<TextRange>;
fn get_caret_offset(&self) -> i32;
fn get_character_at_offset(&self, offset: i32) -> char;
fn get_character_count(&self) -> i32;
fn get_character_extents(
        &self,
        offset: i32,
        coords: CoordType
    ) -> (i32, i32, i32, i32);
fn get_n_selections(&self) -> i32;
fn get_offset_at_point(&self, x: i32, y: i32, coords: CoordType) -> i32;
fn get_range_extents(
        &self,
        start_offset: i32,
        end_offset: i32,
        coord_type: CoordType
    ) -> TextRectangle;
fn get_selection(&self, selection_num: i32) -> (GString, i32, i32);
fn get_string_at_offset(
        &self,
        offset: i32,
        granularity: TextGranularity
    ) -> (Option<GString>, i32, i32);
fn get_text(&self, start_offset: i32, end_offset: i32) -> Option<GString>;
fn get_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,
        f: F
    ) -> SignalHandlerId;
fn connect_text_remove<F: Fn(&Self, i32, i32, &str) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_text_selection_changed<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Text methods.

Implementors

NoOpObject, Text

Required methods

fn add_selection(&self, start_offset: i32, end_offset: i32) -> bool

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

fn get_bounded_ranges(
    &self,
    rect: &mut TextRectangle,
    coord_type: CoordType,
    x_clip_type: TextClipType,
    y_clip_type: TextClipType
) -> Vec<TextRange>

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.

fn get_caret_offset(&self) -> i32

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.

fn get_character_at_offset(&self, offset: i32) -> char

Gets the specified text.

offset

a character offset within self

Returns

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

fn get_character_count(&self) -> i32

Gets the character count.

Returns

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

fn get_character_extents(
    &self,
    offset: i32,
    coords: CoordType
) -> (i32, i32, i32, i32)

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.

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

coords

specify whether coordinates are relative to the screen or widget window

fn get_n_selections(&self) -> i32

Gets the number of selected regions.

Returns

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

fn get_offset_at_point(&self, x: i32, y: i32, coords: CoordType) -> i32

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.

fn get_range_extents(
    &self,
    start_offset: i32,
    end_offset: i32,
    coord_type: CoordType
) -> TextRectangle

Get the bounding box for text within the specified range.

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.

rect

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

fn get_selection(&self, selection_num: i32) -> (GString, i32, i32)

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.

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

Returns

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

fn get_string_at_offset(
    &self,
    offset: i32,
    granularity: TextGranularity
) -> (Option<GString>, i32, i32)

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

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)

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.

fn get_text(&self, start_offset: i32, end_offset: i32) -> Option<GString>

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.

fn get_text_at_offset(
    &self,
    offset: i32,
    boundary_type: TextBoundary
) -> (GString, i32, i32)

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 Text::get_string_at_offset instead.

offset

position

boundary_type

An TextBoundary

start_offset

the starting character offset of the returned string

end_offset

the offset of the first character after the returned substring

Returns

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

fn remove_selection(&self, selection_num: i32) -> bool

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

fn scroll_substring_to(
    &self,
    start_offset: i32,
    end_offset: i32,
    type_: ScrollType
) -> bool

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

Contrary to atk_text_set_position, this does not actually move self in its parent, this only makes the parents scroll so that the object shows up on the screen, given its current position within the parents.

Feature: v2_32

start_offset

start position

end_offset

end position, or -1 for the end of the string.

type_

specify where the object should be made visible.

Returns

whether scrolling was successful.

fn scroll_substring_to_point(
    &self,
    start_offset: i32,
    end_offset: i32,
    coords: CoordType,
    x: i32,
    y: i32
) -> bool

Makes an object visible on the screen at a given position by scrolling all necessary parents.

Feature: v2_32

start_offset

start position

end_offset

end position, or -1 for the end of the string.

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.

fn set_caret_offset(&self, offset: i32) -> bool

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

offset

the character offset of the new caret position

Returns

true if successful, false otherwise.

fn set_selection(
    &self,
    selection_num: i32,
    start_offset: i32,
    end_offset: i32
) -> bool

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

fn connect_text_attributes_changed<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

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

fn connect_text_caret_moved<F: Fn(&Self, i32) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

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.

fn connect_text_insert<F: Fn(&Self, i32, i32, &str) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

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

fn connect_text_remove<F: Fn(&Self, i32, i32, &str) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

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

fn connect_text_selection_changed<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

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

Loading content...

Implementors

impl<O: IsA<Text>> TextExt for O[src]

Loading content...