Struct fltk::text::TextBuffer [−][src]
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]
impl TextBuffer
[src]pub fn default() -> TextBuffer
[src]
Initialized a default text buffer
pub unsafe fn delete(buf: Self)
[src]
Deletes the TextBuffer
Safety
The buffer shouldn’t be deleted while the Display widget still needs it
pub unsafe fn delete_buffer(buf: TextBuffer)
[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]
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. To append and scroll to the end of the buffer:
use fltk::{prelude::*, *}; let txt = "Some long text!"; let buf = text::TextBuffer::default(); let mut disp = text::TextDisplay::default(); disp.set_buffer(Some(buf)); disp.buffer().unwrap().append(txt); disp.set_insert_position(disp.buffer().unwrap().length()); disp.scroll( disp.count_lines(0, disp.buffer().unwrap().length(), true), 0, );
pub fn length(&self) -> i32
[src]
Get the length of the buffer
pub fn remove(&mut self, start: i32, end: i32)
[src]
Removes from the buffer
pub fn text_range(&self, start: i32, end: i32) -> Option<String>
[src]
Returns the text within the range
pub fn insert(&mut self, pos: i32, text: &str)
[src]
Inserts text into a position
pub fn replace(&mut self, start: i32, end: i32, text: &str)
[src]
Replaces text from position start
to end
pub fn copy_from(
&mut self,
source_buf: &TextBuffer,
start: i32,
end: i32,
to: i32
)
[src]
&mut self,
source_buf: &TextBuffer,
start: i32,
end: i32,
to: i32
)
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]
pub fn can_undo(&mut self, flag: bool)
[src]
Sets whether the buffer can undo
pub fn load_file<P: AsRef<Path>>(&mut self, path: P) -> Result<(), FltkError>
[src]
pub fn save_file<P: AsRef<Path>>(&mut self, path: P) -> Result<(), FltkError>
[src]
pub fn tab_distance(&self) -> i32
[src]
Returns the tab distance for the buffer
pub fn set_tab_distance(&mut self, tab_dist: i32)
[src]
Sets the tab distance
pub fn select(&mut self, start: i32, end: i32)
[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<(i32, i32)>
[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: i32, end: i32)
[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<(i32, i32)>
[src]
Returns the highlight position
pub fn highlight_text(&mut self) -> String
[src]
Returns the highlighted text
pub fn line_text(&self, pos: i32) -> String
[src]
Returns the line at pos
pub fn line_start(&self, pos: i32) -> i32
[src]
Returns the index of the line’s start position at pos
pub fn word_start(&self, pos: i32) -> i32
[src]
Returns the index of the first character of a word at pos
pub fn word_end(&self, pos: i32) -> i32
[src]
Returns the index of the last character of a word at pos
pub fn count_lines(&self, start: i32, end: i32) -> i32
[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<F: FnMut(i32, i32, i32, i32, &str) + 'static>(
&mut self,
cb: F
)
[src]
&mut self,
cb: F
)
Adds a modify callback.
callback args:
pos: i32, inserted items: i32, deleted items: i32, restyled items: i32, deleted_text
pub fn remove_modify_callback<F: FnMut(i32, i32, i32, i32, &str) + 'static>(
&mut self,
cb: F
)
[src]
&mut self,
cb: F
)
Removes a modify callback.
callback args:
pos: i32, inserted items: i32, deleted items: i32, restyled items: i32, deleted_text
Trait Implementations
impl Clone for TextBuffer
[src]
impl Clone for TextBuffer
[src]fn clone(&self) -> TextBuffer
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for TextBuffer
[src]
impl Drop for TextBuffer
[src]impl Send for TextBuffer
[src]
impl Send for TextBuffer
[src]impl Sync for TextBuffer
[src]
impl Sync for TextBuffer
[src]