[][src]Struct fltk::text::TextBuffer

pub struct TextBuffer { /* fields omitted */ }

Wraps a text buffer, Cloning a text buffer invalidates the underlying pointer, thus the no derive(Clone)

Implementations

impl TextBuffer[src]

pub fn default() -> TextBuffer[src]

Initialized a default text buffer

pub unsafe fn delete(&mut self)[src]

Deletes the TextBuffer

Safety

The buffer shouldn't be deleted while the Display widget still needs it

pub unsafe fn from_ptr(ptr: *mut Fl_Text_Buffer) -> Self[src]

Initialized a text buffer from a pointer

Safety

The pointer must be valid

pub unsafe fn as_ptr(&self) -> *mut Fl_Text_Buffer[src]

Returns the inner pointer from a text buffer

Safety

Can return multiple mutable pointers to the same buffer

pub fn set_text(&mut self, txt: &str)[src]

Sets the text of the buffer

pub fn text(&self) -> String[src]

Returns the text of the buffer

pub fn append(&mut self, text: &str)[src]

Appends to the buffer

pub fn length(&self) -> u32[src]

Get the length of the buffer

pub fn remove(&mut self, start: u32, end: u32)[src]

Removes from the buffer

pub fn text_range(&self, start: u32, end: u32) -> Option<String>[src]

Returns the text within the range

pub fn insert(&mut self, pos: u32, text: &str)[src]

Inserts text into a position

pub fn replace(&mut self, start: u32, end: u32, text: &str)[src]

Replaces text from position start to end

pub fn copy_from(
    &mut self,
    source_buf: &TextBuffer,
    start: u32,
    end: u32,
    to: u32
)
[src]

Copies text from a source buffer into the current buffer

pub fn copy(&self) -> TextBuffer[src]

Copies whole text from a source buffer into a new buffer

pub fn undo(&mut self) -> Result<(), FltkError>[src]

Performs an undo operation on the buffer

pub fn can_undo(&mut self, flag: bool)[src]

Sets whether the buffer can undo

pub fn load_file(&mut self, path: &Path) -> Result<(), FltkError>[src]

Loads a file into the buffer

pub fn tab_distance(&self) -> u32[src]

Returns the tab distance for the buffer

pub fn set_tab_distance(&mut self, tab_dist: u32)[src]

Sets the tab distance

pub fn select(&mut self, start: u32, end: u32)[src]

Selects the text from start to end

pub fn selected(&self) -> bool[src]

Returns whether text is selected

pub fn unselect(&mut self)[src]

Unselects text

pub fn selection_position(&mut self) -> Option<(u32, u32)>[src]

Returns the selection position

pub fn selection_text(&mut self) -> String[src]

Returns the selection text

pub fn remove_selection(&mut self)[src]

Removes the selection

pub fn replace_selection(&mut self, text: &str)[src]

Replaces selection

pub fn highlight(&mut self, start: u32, end: u32)[src]

Highlights selection

pub fn is_highlighted(&mut self) -> bool[src]

Returns whether text is highlighted

pub fn unhighlight(&mut self)[src]

Unhighlights text

pub fn highlight_position(&mut self) -> Option<(u32, u32)>[src]

Returns the highlight position

pub fn highlight_text(&mut self) -> String[src]

Returns the highlighted text

pub fn line_text(&self, pos: u32) -> String[src]

Returns the line at pos

pub fn line_start(&self, pos: u32) -> u32[src]

Returns the index of the line's start position at pos

pub fn word_start(&self, pos: u32) -> u32[src]

Returns the index of the first character of a word at pos

pub fn word_end(&self, pos: u32) -> u32[src]

Returns the index of the last character of a word at pos

pub fn count_lines(&self, start: u32, end: u32) -> u32[src]

Counts the lines from start to end

pub fn call_modify_callbacks(&mut self)[src]

Calls the modify callbacks

pub fn add_modify_callback(
    &mut self,
    cb: Box<dyn FnMut(u32, u32, u32, u32, &str)>
)
[src]

Adds a modify callback

pub fn remove_modify_callback(
    &mut self,
    cb: Box<dyn FnMut(u32, u32, u32, u32, &str)>
)
[src]

Removes a modify callback

Trait Implementations

impl Clone for TextBuffer[src]

impl Debug for TextBuffer[src]

impl Send for TextBuffer[src]

impl Sync for TextBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.