[][src]Trait gtk::EditableExt

pub trait EditableExt: 'static {
    fn copy_clipboard(&self);
fn cut_clipboard(&self);
fn delete_selection(&self);
fn delete_text(&self, start_pos: i32, end_pos: i32);
fn get_chars(&self, start_pos: i32, end_pos: i32) -> Option<GString>;
fn get_editable(&self) -> bool;
fn get_position(&self) -> i32;
fn get_selection_bounds(&self) -> Option<(i32, i32)>;
fn insert_text(&self, new_text: &str, position: &mut i32);
fn paste_clipboard(&self);
fn select_region(&self, start_pos: i32, end_pos: i32);
fn set_editable(&self, is_editable: bool);
fn set_position(&self, position: i32); }

Trait containing all Editable methods.

Implementors

Editable, Entry, SearchEntry, SpinButton

Required methods

fn copy_clipboard(&self)

Copies the contents of the currently selected content in the editable and puts it on the clipboard.

fn cut_clipboard(&self)

Removes the contents of the currently selected content in the editable and puts it on the clipboard.

fn delete_selection(&self)

Deletes the currently selected text of the editable. This call doesn’t do anything if there is no selected text.

fn delete_text(&self, start_pos: i32, end_pos: i32)

Deletes a sequence of characters. The characters that are deleted are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the characters deleted are those from start_pos to the end of the text.

Note that the positions are specified in characters, not bytes.

start_pos

start position

end_pos

end position

fn get_chars(&self, start_pos: i32, end_pos: i32) -> Option<GString>

Retrieves a sequence of characters. The characters that are retrieved are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the characters retrieved are those characters from start_pos to the end of the text.

Note that positions are specified in characters, not bytes.

start_pos

start of text

end_pos

end of text

Returns

a pointer to the contents of the widget as a string. This string is allocated by the Editable implementation and should be freed by the caller.

fn get_editable(&self) -> bool

Retrieves whether self is editable. See Editable::set_editable.

Returns

true if self is editable.

fn get_position(&self) -> i32

Retrieves the current position of the cursor relative to the start of the content of the editable.

Note that this position is in characters, not in bytes.

Returns

the cursor position

fn get_selection_bounds(&self) -> Option<(i32, i32)>

Retrieves the selection bound of the editable. start_pos will be filled with the start of the selection and end_pos with end. If no text was selected both will be identical and false will be returned.

Note that positions are specified in characters, not bytes.

start_pos

location to store the starting position, or None

end_pos

location to store the end position, or None

Returns

true if an area is selected, false otherwise

fn insert_text(&self, new_text: &str, position: &mut i32)

Inserts new_text_length bytes of new_text into the contents of the widget, at position position.

Note that the position is in characters, not in bytes. The function updates position to point after the newly inserted text.

new_text

the text to append

new_text_length

the length of the text in bytes, or -1

position

location of the position text will be inserted at

fn paste_clipboard(&self)

Pastes the content of the clipboard to the current position of the cursor in the editable.

fn select_region(&self, start_pos: i32, end_pos: i32)

Selects a region of text. The characters that are selected are those characters at positions from start_pos up to, but not including end_pos. If end_pos is negative, then the characters selected are those characters from start_pos to the end of the text.

Note that positions are specified in characters, not bytes.

start_pos

start of region

end_pos

end of region

fn set_editable(&self, is_editable: bool)

Determines if the user can edit the text in the editable widget or not.

is_editable

true if the user is allowed to edit the text in the widget

fn set_position(&self, position: i32)

Sets the cursor position in the editable to the given value.

The cursor is displayed before the character with the given (base 0) index in the contents of the editable. The value must be less than or equal to the number of characters in the editable. A value of -1 indicates that the position should be set after the last character of the editable. Note that position is in characters, not in bytes.

position

the position of the cursor

Loading content...

Implementors

impl<O: IsA<Editable>> EditableExt for O[src]

Loading content...