Struct fltk::text::TextEditor
source · pub struct TextEditor { /* private fields */ }
Expand description
Creates an editable text display widget
Implementations§
source§impl TextEditor
impl TextEditor
sourcepub fn set_insert_mode(&mut self, b: bool)
pub fn set_insert_mode(&mut self, b: bool)
Set to insert mode
sourcepub fn insert_mode(&self) -> bool
pub fn insert_mode(&self) -> bool
Returns whether insert mode is set
Set tab navigation
Returns whether tab navigation is set
sourcepub fn copy(&self)
pub fn copy(&self)
Copies the text within the TextEditor
widget
Examples found in repository?
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
fn menu_cb(m: &mut impl MenuExt) {
if let Ok(mpath) = m.item_pathname(None) {
let ed: text::TextEditor = app::widget_from_id("ed").unwrap();
match mpath.as_str() {
"&File/New\t" => {
STATE.with(|s| {
if !s.buf.text().is_empty() {
let c = dialog::choice2_default(
"Are you sure you want to clear the buffer?",
"Yes",
"No",
"",
);
if c == Some(0) {
s.buf.set_text("");
s.saved = false;
}
}
});
}
"&File/Open...\t" => {
let c = nfc_get_file(dialog::NativeFileChooserType::BrowseFile);
if let Ok(text) = std::fs::read_to_string(&c) {
STATE.with(move |s| {
s.buf.set_text(&text);
s.saved = false;
s.current_file = c.clone();
});
}
}
"&File/Save\t" => {
STATE.with(|s| {
if !s.saved && s.current_file.exists() {
std::fs::write(&s.current_file, s.buf.text()).ok();
}
});
}
"&File/Save as...\t" => {
let c = nfc_get_file(dialog::NativeFileChooserType::BrowseSaveFile);
STATE.with(move |s| {
std::fs::write(&c, s.buf.text()).ok();
s.saved = true;
s.current_file = c.clone();
});
}
"&File/Quit\t" => quit_cb(),
"&Edit/Cut\t" => ed.cut(),
"&Edit/Copy\t" => ed.copy(),
"&Edit/Paste\t" => ed.paste(),
"&Help/About\t" => {
dialog::message_default("A minimal text editor written using fltk-rs!")
}
_ => unreachable!(),
}
}
}
More examples
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
pub fn launch(&mut self) {
while self.app.wait() {
use Message::*;
if let Some(msg) = self.r.recv() {
match msg {
Changed => {
if !self.modified {
self.modified = true;
self.menu.menu.find_item("&File/Save\t").unwrap().activate();
self.menu.menu.find_item("&File/Quit\t").unwrap().set_label_color(Color::Red);
let name = match &self.filename {
Some(f) => f.to_string_lossy().to_string(),
None => "(Untitled)".to_string(),
};
self.main_win.set_label(&format!("* {name} - RustyEd"));
}
}
New => {
if self.buf.text() != "" {
let clear = if let Some(x) = dialog::choice2(center().0 - 200, center().1 - 100, "File unsaved, Do you wish to continue?", "Yes", "No!", "") {
x == 0
} else {
false
};
if clear {
self.buf.set_text("");
}
}
},
Open => {
let mut dlg = dialog::FileDialog::new(dialog::FileDialogType::BrowseFile);
dlg.set_option(dialog::FileDialogOptions::NoOptions);
dlg.set_filter("*.{txt,rs,toml}");
dlg.show();
let filename = dlg.filename();
if !filename.to_string_lossy().to_string().is_empty() {
if filename.exists() {
match self.buf.load_file(&filename) {
Ok(_) => self.filename = Some(filename),
Err(e) => dialog::alert(center().0 - 200, center().1 - 100, &format!("An issue occured while loading the file: {e}")),
}
} else {
dialog::alert(center().0 - 200, center().1 - 100, "File does not exist!")
}
}
},
Save => { self.save_file().unwrap(); },
SaveAs => { self.save_file_as().unwrap(); },
Print => {
let mut printer = printer::Printer::default();
if printer.begin_job(0).is_ok() {
let (w, h) = printer.printable_rect();
self.printable.set_size(w - 40, h - 40);
// Needs cleanup
let line_count = self.printable.count_lines(0, self.printable.buffer().unwrap().length(), true) / 45;
for i in 0..=line_count {
self.printable.scroll(45 * i, 0);
printer.begin_page().ok();
printer.print_widget(&self.printable, 20, 20);
printer.end_page().ok();
}
printer.end_job();
}
},
Quit => {
if self.modified {
match dialog::choice2(center().0 - 200, center().1 - 100,
"Would you like to save your work?", "Yes", "No", "") {
Some(0) => {
if self.save_file().unwrap() {
self.app.quit();
}
},
Some(1) => { self.app.quit() },
Some(_) | None => (),
}
} else {
self.app.quit();
}
},
Cut => self.editor.cut(),
Copy => self.editor.copy(),
Paste => self.editor.paste(),
About => dialog::message(center().0 - 300, center().1 - 100, "This is an example application written in Rust and using the FLTK Gui library."),
}
}
}
}
sourcepub fn cut(&self)
pub fn cut(&self)
Cuts the text within the TextEditor
widget
Examples found in repository?
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
fn menu_cb(m: &mut impl MenuExt) {
if let Ok(mpath) = m.item_pathname(None) {
let ed: text::TextEditor = app::widget_from_id("ed").unwrap();
match mpath.as_str() {
"&File/New\t" => {
STATE.with(|s| {
if !s.buf.text().is_empty() {
let c = dialog::choice2_default(
"Are you sure you want to clear the buffer?",
"Yes",
"No",
"",
);
if c == Some(0) {
s.buf.set_text("");
s.saved = false;
}
}
});
}
"&File/Open...\t" => {
let c = nfc_get_file(dialog::NativeFileChooserType::BrowseFile);
if let Ok(text) = std::fs::read_to_string(&c) {
STATE.with(move |s| {
s.buf.set_text(&text);
s.saved = false;
s.current_file = c.clone();
});
}
}
"&File/Save\t" => {
STATE.with(|s| {
if !s.saved && s.current_file.exists() {
std::fs::write(&s.current_file, s.buf.text()).ok();
}
});
}
"&File/Save as...\t" => {
let c = nfc_get_file(dialog::NativeFileChooserType::BrowseSaveFile);
STATE.with(move |s| {
std::fs::write(&c, s.buf.text()).ok();
s.saved = true;
s.current_file = c.clone();
});
}
"&File/Quit\t" => quit_cb(),
"&Edit/Cut\t" => ed.cut(),
"&Edit/Copy\t" => ed.copy(),
"&Edit/Paste\t" => ed.paste(),
"&Help/About\t" => {
dialog::message_default("A minimal text editor written using fltk-rs!")
}
_ => unreachable!(),
}
}
}
More examples
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
pub fn launch(&mut self) {
while self.app.wait() {
use Message::*;
if let Some(msg) = self.r.recv() {
match msg {
Changed => {
if !self.modified {
self.modified = true;
self.menu.menu.find_item("&File/Save\t").unwrap().activate();
self.menu.menu.find_item("&File/Quit\t").unwrap().set_label_color(Color::Red);
let name = match &self.filename {
Some(f) => f.to_string_lossy().to_string(),
None => "(Untitled)".to_string(),
};
self.main_win.set_label(&format!("* {name} - RustyEd"));
}
}
New => {
if self.buf.text() != "" {
let clear = if let Some(x) = dialog::choice2(center().0 - 200, center().1 - 100, "File unsaved, Do you wish to continue?", "Yes", "No!", "") {
x == 0
} else {
false
};
if clear {
self.buf.set_text("");
}
}
},
Open => {
let mut dlg = dialog::FileDialog::new(dialog::FileDialogType::BrowseFile);
dlg.set_option(dialog::FileDialogOptions::NoOptions);
dlg.set_filter("*.{txt,rs,toml}");
dlg.show();
let filename = dlg.filename();
if !filename.to_string_lossy().to_string().is_empty() {
if filename.exists() {
match self.buf.load_file(&filename) {
Ok(_) => self.filename = Some(filename),
Err(e) => dialog::alert(center().0 - 200, center().1 - 100, &format!("An issue occured while loading the file: {e}")),
}
} else {
dialog::alert(center().0 - 200, center().1 - 100, "File does not exist!")
}
}
},
Save => { self.save_file().unwrap(); },
SaveAs => { self.save_file_as().unwrap(); },
Print => {
let mut printer = printer::Printer::default();
if printer.begin_job(0).is_ok() {
let (w, h) = printer.printable_rect();
self.printable.set_size(w - 40, h - 40);
// Needs cleanup
let line_count = self.printable.count_lines(0, self.printable.buffer().unwrap().length(), true) / 45;
for i in 0..=line_count {
self.printable.scroll(45 * i, 0);
printer.begin_page().ok();
printer.print_widget(&self.printable, 20, 20);
printer.end_page().ok();
}
printer.end_job();
}
},
Quit => {
if self.modified {
match dialog::choice2(center().0 - 200, center().1 - 100,
"Would you like to save your work?", "Yes", "No", "") {
Some(0) => {
if self.save_file().unwrap() {
self.app.quit();
}
},
Some(1) => { self.app.quit() },
Some(_) | None => (),
}
} else {
self.app.quit();
}
},
Cut => self.editor.cut(),
Copy => self.editor.copy(),
Paste => self.editor.paste(),
About => dialog::message(center().0 - 300, center().1 - 100, "This is an example application written in Rust and using the FLTK Gui library."),
}
}
}
}
sourcepub fn paste(&self)
pub fn paste(&self)
Pastes text from the clipboard into the TextEditor
widget
Examples found in repository?
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
fn menu_cb(m: &mut impl MenuExt) {
if let Ok(mpath) = m.item_pathname(None) {
let ed: text::TextEditor = app::widget_from_id("ed").unwrap();
match mpath.as_str() {
"&File/New\t" => {
STATE.with(|s| {
if !s.buf.text().is_empty() {
let c = dialog::choice2_default(
"Are you sure you want to clear the buffer?",
"Yes",
"No",
"",
);
if c == Some(0) {
s.buf.set_text("");
s.saved = false;
}
}
});
}
"&File/Open...\t" => {
let c = nfc_get_file(dialog::NativeFileChooserType::BrowseFile);
if let Ok(text) = std::fs::read_to_string(&c) {
STATE.with(move |s| {
s.buf.set_text(&text);
s.saved = false;
s.current_file = c.clone();
});
}
}
"&File/Save\t" => {
STATE.with(|s| {
if !s.saved && s.current_file.exists() {
std::fs::write(&s.current_file, s.buf.text()).ok();
}
});
}
"&File/Save as...\t" => {
let c = nfc_get_file(dialog::NativeFileChooserType::BrowseSaveFile);
STATE.with(move |s| {
std::fs::write(&c, s.buf.text()).ok();
s.saved = true;
s.current_file = c.clone();
});
}
"&File/Quit\t" => quit_cb(),
"&Edit/Cut\t" => ed.cut(),
"&Edit/Copy\t" => ed.copy(),
"&Edit/Paste\t" => ed.paste(),
"&Help/About\t" => {
dialog::message_default("A minimal text editor written using fltk-rs!")
}
_ => unreachable!(),
}
}
}
More examples
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
pub fn launch(&mut self) {
while self.app.wait() {
use Message::*;
if let Some(msg) = self.r.recv() {
match msg {
Changed => {
if !self.modified {
self.modified = true;
self.menu.menu.find_item("&File/Save\t").unwrap().activate();
self.menu.menu.find_item("&File/Quit\t").unwrap().set_label_color(Color::Red);
let name = match &self.filename {
Some(f) => f.to_string_lossy().to_string(),
None => "(Untitled)".to_string(),
};
self.main_win.set_label(&format!("* {name} - RustyEd"));
}
}
New => {
if self.buf.text() != "" {
let clear = if let Some(x) = dialog::choice2(center().0 - 200, center().1 - 100, "File unsaved, Do you wish to continue?", "Yes", "No!", "") {
x == 0
} else {
false
};
if clear {
self.buf.set_text("");
}
}
},
Open => {
let mut dlg = dialog::FileDialog::new(dialog::FileDialogType::BrowseFile);
dlg.set_option(dialog::FileDialogOptions::NoOptions);
dlg.set_filter("*.{txt,rs,toml}");
dlg.show();
let filename = dlg.filename();
if !filename.to_string_lossy().to_string().is_empty() {
if filename.exists() {
match self.buf.load_file(&filename) {
Ok(_) => self.filename = Some(filename),
Err(e) => dialog::alert(center().0 - 200, center().1 - 100, &format!("An issue occured while loading the file: {e}")),
}
} else {
dialog::alert(center().0 - 200, center().1 - 100, "File does not exist!")
}
}
},
Save => { self.save_file().unwrap(); },
SaveAs => { self.save_file_as().unwrap(); },
Print => {
let mut printer = printer::Printer::default();
if printer.begin_job(0).is_ok() {
let (w, h) = printer.printable_rect();
self.printable.set_size(w - 40, h - 40);
// Needs cleanup
let line_count = self.printable.count_lines(0, self.printable.buffer().unwrap().length(), true) / 45;
for i in 0..=line_count {
self.printable.scroll(45 * i, 0);
printer.begin_page().ok();
printer.print_widget(&self.printable, 20, 20);
printer.end_page().ok();
}
printer.end_job();
}
},
Quit => {
if self.modified {
match dialog::choice2(center().0 - 200, center().1 - 100,
"Would you like to save your work?", "Yes", "No", "") {
Some(0) => {
if self.save_file().unwrap() {
self.app.quit();
}
},
Some(1) => { self.app.quit() },
Some(_) | None => (),
}
} else {
self.app.quit();
}
},
Cut => self.editor.cut(),
Copy => self.editor.copy(),
Paste => self.editor.paste(),
About => dialog::message(center().0 - 300, center().1 - 100, "This is an example application written in Rust and using the FLTK Gui library."),
}
}
}
}
sourcepub fn kf_default(&mut self, c: Key)
pub fn kf_default(&mut self, c: Key)
Inserts the text associated with key ‘c’
sourcepub fn kf_backspace(&mut self)
pub fn kf_backspace(&mut self)
Does a backspace
sourcepub fn kf_shift_move(&mut self, c: Key)
pub fn kf_shift_move(&mut self, c: Key)
Extends the current selection in the direction of key ‘c’
sourcepub fn kf_ctrl_move(&mut self, c: Key)
pub fn kf_ctrl_move(&mut self, c: Key)
Moves the current text cursor in the direction indicated by control key ‘c’
sourcepub fn kf_c_s_move(&mut self, c: Key)
pub fn kf_c_s_move(&mut self, c: Key)
Extends the current selection in the direction indicated by control key ‘c’
sourcepub fn kf_meta_move(&mut self, c: Key)
pub fn kf_meta_move(&mut self, c: Key)
Moves the current text cursor in the direction indicated by meta key ‘c’
sourcepub fn kf_m_s_move(&mut self, c: Key)
pub fn kf_m_s_move(&mut self, c: Key)
Extends the current selection in the direction indicated by meta key ‘c’
sourcepub fn kf_page_up(&mut self)
pub fn kf_page_up(&mut self)
Moves the text cursor up one page
sourcepub fn kf_page_down(&mut self)
pub fn kf_page_down(&mut self)
Moves the text cursor down one page
sourcepub fn kf_delete(&mut self)
pub fn kf_delete(&mut self)
Does a delete of selected text or the current character in the current buffer
sourcepub fn kf_select_all(&mut self)
pub fn kf_select_all(&mut self)
Selects all text in the associated buffer
sourcepub fn add_key_binding(
&mut self,
key: Key,
shortcut: Shortcut,
cb: fn(key: Key, editor: TextEditorPtr) -> i32
)
pub fn add_key_binding( &mut self, key: Key, shortcut: Shortcut, cb: fn(key: Key, editor: TextEditorPtr) -> i32 )
Add a key binding
sourcepub fn remove_key_binding(&mut self, key: Key, shortcut: Shortcut)
pub fn remove_key_binding(&mut self, key: Key, shortcut: Shortcut)
Remove a key binding
Trait Implementations§
source§impl Clone for TextEditor
impl Clone for TextEditor
source§fn clone(&self) -> TextEditor
fn clone(&self) -> TextEditor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TextEditor
impl Debug for TextEditor
source§impl Default for TextEditor
impl Default for TextEditor
source§impl DisplayExt for TextEditor
impl DisplayExt for TextEditor
source§fn buffer(&self) -> Option<TextBuffer>
fn buffer(&self) -> Option<TextBuffer>
TextBuffer
source§fn set_buffer<B: Into<Option<TextBuffer>>>(&mut self, buffer: B)
fn set_buffer<B: Into<Option<TextBuffer>>>(&mut self, buffer: B)
TextBuffer
source§fn style_buffer(&self) -> Option<TextBuffer>
fn style_buffer(&self) -> Option<TextBuffer>
TextBuffer
source§fn set_text_font(&mut self, font: Font)
fn set_text_font(&mut self, font: Font)
source§fn text_color(&self) -> Color
fn text_color(&self) -> Color
source§fn set_text_color(&mut self, color: Color)
fn set_text_color(&mut self, color: Color)
source§fn set_text_size(&mut self, sz: i32)
fn set_text_size(&mut self, sz: i32)
source§fn set_insert_position(&mut self, new_pos: i32)
fn set_insert_position(&mut self, new_pos: i32)
source§fn insert_position(&self) -> i32
fn insert_position(&self) -> i32
source§fn count_lines(&self, start: i32, end: i32, is_line_start: bool) -> i32
fn count_lines(&self, start: i32, end: i32, is_line_start: bool) -> i32
source§fn show_cursor(&mut self, val: bool)
fn show_cursor(&mut self, val: bool)
source§fn set_highlight_data<B: Into<Option<TextBuffer>>, E: Into<Vec<StyleTableEntry>>>(
&mut self,
style_buffer: B,
entries: E
)
fn set_highlight_data<B: Into<Option<TextBuffer>>, E: Into<Vec<StyleTableEntry>>>( &mut self, style_buffer: B, entries: E )
source§fn set_highlight_data_ext<B: Into<Option<TextBuffer>>, E: Into<Vec<StyleTableEntryExt>>>(
&mut self,
style_buffer: B,
entries: E
)
fn set_highlight_data_ext<B: Into<Option<TextBuffer>>, E: Into<Vec<StyleTableEntryExt>>>( &mut self, style_buffer: B, entries: E )
source§fn unset_highlight_data<B: Into<Option<TextBuffer>>>(&mut self, style_buffer: B)
fn unset_highlight_data<B: Into<Option<TextBuffer>>>(&mut self, style_buffer: B)
source§fn set_cursor_style(&mut self, style: Cursor)
fn set_cursor_style(&mut self, style: Cursor)
source§fn set_cursor_color(&mut self, color: Color)
fn set_cursor_color(&mut self, color: Color)
source§fn set_scrollbar_size(&mut self, size: i32)
fn set_scrollbar_size(&mut self, size: i32)
source§fn set_scrollbar_align(&mut self, align: Align)
fn set_scrollbar_align(&mut self, align: Align)
source§fn cursor_style(&self) -> Cursor
fn cursor_style(&self) -> Cursor
source§fn cursor_color(&self) -> Color
fn cursor_color(&self) -> Color
source§fn scrollbar_size(&self) -> i32
fn scrollbar_size(&self) -> i32
source§fn scrollbar_align(&self) -> Align
fn scrollbar_align(&self) -> Align
source§fn line_start(&self, pos: i32) -> i32
fn line_start(&self, pos: i32) -> i32
source§fn line_end(&self, start_pos: i32, is_line_start: bool) -> i32
fn line_end(&self, start_pos: i32, is_line_start: bool) -> i32
source§fn skip_lines(&mut self, start_pos: i32, lines: i32, is_line_start: bool) -> i32
fn skip_lines(&mut self, start_pos: i32, lines: i32, is_line_start: bool) -> i32
start_pos
source§fn previous_word(&mut self)
fn previous_word(&mut self)
source§fn word_start(&self, pos: i32) -> i32
fn word_start(&self, pos: i32) -> i32
source§fn word_end(&self, pos: i32) -> i32
fn word_end(&self, pos: i32) -> i32
source§fn set_linenumber_width(&mut self, w: i32)
fn set_linenumber_width(&mut self, w: i32)
source§fn linenumber_width(&self) -> i32
fn linenumber_width(&self) -> i32
source§fn set_linenumber_font(&mut self, font: Font)
fn set_linenumber_font(&mut self, font: Font)
source§fn linenumber_font(&self) -> Font
fn linenumber_font(&self) -> Font
source§fn set_linenumber_size(&mut self, size: i32)
fn set_linenumber_size(&mut self, size: i32)
source§fn linenumber_size(&self) -> i32
fn linenumber_size(&self) -> i32
source§fn set_linenumber_fgcolor(&mut self, color: Color)
fn set_linenumber_fgcolor(&mut self, color: Color)
source§fn linenumber_fgcolor(&self) -> Color
fn linenumber_fgcolor(&self) -> Color
source§fn set_linenumber_bgcolor(&mut self, color: Color)
fn set_linenumber_bgcolor(&mut self, color: Color)
source§fn linenumber_bgcolor(&self) -> Color
fn linenumber_bgcolor(&self) -> Color
source§fn set_linenumber_align(&mut self, align: Align)
fn set_linenumber_align(&mut self, align: Align)
source§fn linenumber_align(&self) -> Align
fn linenumber_align(&self) -> Align
source§fn in_selection(&self, x: i32, y: i32) -> bool
fn in_selection(&self, x: i32, y: i32) -> bool
source§fn wrap_mode(&mut self, wrap: WrapMode, wrap_margin: i32)
fn wrap_mode(&mut self, wrap: WrapMode, wrap_margin: i32)
AtColumn
, wrap margin is the column.
If the wrap mode is AtPixel
, wrap margin is the pixel.
For more infosource§fn wrapped_column(&self, row: i32, column: i32) -> i32
fn wrapped_column(&self, row: i32, column: i32) -> i32
source§fn wrapped_row(&self, row: i32) -> i32
fn wrapped_row(&self, row: i32) -> i32
source§fn set_grammar_underline_color(&mut self, color: Color)
fn set_grammar_underline_color(&mut self, color: Color)
source§fn grammar_underline_color(&self) -> Color
fn grammar_underline_color(&self) -> Color
source§fn set_spelling_underline_color(&mut self, color: Color)
fn set_spelling_underline_color(&mut self, color: Color)
source§fn spelling_underline_color(&self) -> Color
fn spelling_underline_color(&self) -> Color
source§fn set_secondary_selection_color(&mut self, color: Color)
fn set_secondary_selection_color(&mut self, color: Color)
source§fn secondary_selection_color(&self) -> Color
fn secondary_selection_color(&self) -> Color
source§fn show_insert_position(&mut self)
fn show_insert_position(&mut self)
source§impl Drop for TextEditor
impl Drop for TextEditor
source§impl PartialEq<TextEditor> for TextEditor
impl PartialEq<TextEditor> for TextEditor
source§impl WidgetBase for TextEditor
impl WidgetBase for TextEditor
source§fn new<T: Into<Option<&'static str>>>(
x: i32,
y: i32,
width: i32,
height: i32,
title: T
) -> TextEditor
fn new<T: Into<Option<&'static str>>>( x: i32, y: i32, width: i32, height: i32, title: T ) -> TextEditor
source§fn default_fill() -> Self
fn default_fill() -> Self
source§unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self
unsafe fn from_widget_ptr(ptr: *mut Fl_Widget) -> Self
source§unsafe fn from_widget<W: WidgetExt>(w: W) -> Self
unsafe fn from_widget<W: WidgetExt>(w: W) -> Self
source§fn handle<F: FnMut(&mut Self, Event) -> bool + 'static>(&mut self, cb: F)
fn handle<F: FnMut(&mut Self, Event) -> bool + 'static>(&mut self, cb: F)
Fl_Widget::handle(int)
.
Handled or ignored events should return true, unhandled events should return false.
takes the widget as a closure argument.
The ability to handle an event might depend on handling other events, as explained heresource§fn draw<F: FnMut(&mut Self) + 'static>(&mut self, cb: F)
fn draw<F: FnMut(&mut Self) + 'static>(&mut self, cb: F)
WidgetBase::draw
actually calls drawing functionssource§fn resize_callback<F: FnMut(&mut Self, i32, i32, i32, i32) + 'static>(
&mut self,
cb: F
)
fn resize_callback<F: FnMut(&mut Self, i32, i32, i32, i32) + 'static>( &mut self, cb: F )
source§unsafe fn assume_derived(&mut self)
unsafe fn assume_derived(&mut self)
source§impl WidgetExt for TextEditor
impl WidgetExt for TextEditor
source§fn with_label(self, title: &str) -> Self
fn with_label(self, title: &str) -> Self
source§fn with_align(self, align: Align) -> Self
fn with_align(self, align: Align) -> Self
source§fn with_type<T: WidgetType>(self, typ: T) -> Self
fn with_type<T: WidgetType>(self, typ: T) -> Self
source§fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
source§fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
source§fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
source§fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
source§fn center_of_parent(self) -> Self
fn center_of_parent(self) -> Self
source§fn size_of_parent(self) -> Self
fn size_of_parent(self) -> Self
source§fn set_label(&mut self, title: &str)
fn set_label(&mut self, title: &str)
@
sign.
and for the associated formatting.source§fn measure_label(&self) -> (i32, i32)
fn measure_label(&self) -> (i32, i32)
source§fn as_widget_ptr(&self) -> *mut Fl_Widget
fn as_widget_ptr(&self) -> *mut Fl_Widget
Fl_Widget
, for internal usesource§fn deactivate(&mut self)
fn deactivate(&mut self)
source§fn redraw_label(&mut self)
fn redraw_label(&mut self)
source§fn resize(&mut self, x: i32, y: i32, width: i32, height: i32)
fn resize(&mut self, x: i32, y: i32, width: i32, height: i32)
source§fn widget_resize(&mut self, x: i32, y: i32, width: i32, height: i32)
fn widget_resize(&mut self, x: i32, y: i32, width: i32, height: i32)
source§fn set_tooltip(&mut self, txt: &str)
fn set_tooltip(&mut self, txt: &str)
source§fn label_color(&self) -> Color
fn label_color(&self) -> Color
source§fn set_label_color(&mut self, color: Color)
fn set_label_color(&mut self, color: Color)
source§fn label_font(&self) -> Font
fn label_font(&self) -> Font
source§fn set_label_font(&mut self, font: Font)
fn set_label_font(&mut self, font: Font)
source§fn label_size(&self) -> i32
fn label_size(&self) -> i32
source§fn set_label_size(&mut self, sz: i32)
fn set_label_size(&mut self, sz: i32)
source§fn label_type(&self) -> LabelType
fn label_type(&self) -> LabelType
source§fn set_label_type(&mut self, typ: LabelType)
fn set_label_type(&mut self, typ: LabelType)
source§fn set_changed(&mut self)
fn set_changed(&mut self)
source§fn clear_changed(&mut self)
fn clear_changed(&mut self)
source§fn set_trigger(&mut self, trigger: CallbackTrigger)
fn set_trigger(&mut self, trigger: CallbackTrigger)
when()
source§fn trigger(&self) -> CallbackTrigger
fn trigger(&self) -> CallbackTrigger
when()
source§fn selection_color(&self) -> Color
fn selection_color(&self) -> Color
source§fn set_selection_color(&mut self, color: Color)
fn set_selection_color(&mut self, color: Color)
source§fn do_callback(&mut self)
fn do_callback(&mut self)
source§fn top_window(&self) -> Option<Box<dyn WindowExt>>
fn top_window(&self) -> Option<Box<dyn WindowExt>>
source§fn takes_events(&self) -> bool
fn takes_events(&self) -> bool
source§fn set_visible_focus(&mut self)
fn set_visible_focus(&mut self)
source§fn clear_visible_focus(&mut self)
fn clear_visible_focus(&mut self)
source§fn visible_focus(&mut self, v: bool)
fn visible_focus(&mut self, v: bool)
source§fn has_visible_focus(&self) -> bool
fn has_visible_focus(&self) -> bool
source§fn was_deleted(&self) -> bool
fn was_deleted(&self) -> bool
source§fn set_damage(&mut self, flag: bool)
fn set_damage(&mut self, flag: bool)
source§fn damage_type(&self) -> Damage
fn damage_type(&self) -> Damage
source§fn set_damage_type(&mut self, mask: Damage)
fn set_damage_type(&mut self, mask: Damage)
source§fn set_damage_area(&mut self, mask: Damage, x: i32, y: i32, w: i32, h: i32)
fn set_damage_area(&mut self, mask: Damage, x: i32, y: i32, w: i32, h: i32)
source§fn clear_damage(&mut self)
fn clear_damage(&mut self)
source§fn as_window(&self) -> Option<Box<dyn WindowExt>>
fn as_window(&self) -> Option<Box<dyn WindowExt>>
source§fn as_group(&self) -> Option<Group>
fn as_group(&self) -> Option<Group>
source§fn inside<W: WidgetExt>(&self, wid: &W) -> bool
fn inside<W: WidgetExt>(&self, wid: &W) -> bool
source§fn get_type<T: WidgetType>(&self) -> T
fn get_type<T: WidgetType>(&self) -> T
source§fn set_type<T: WidgetType>(&mut self, typ: T)
fn set_type<T: WidgetType>(&mut self, typ: T)
source§fn set_image_scaled<I: ImageExt>(&mut self, image: Option<I>)
fn set_image_scaled<I: ImageExt>(&mut self, image: Option<I>)
source§unsafe fn image_mut(&self) -> Option<&mut Image>
unsafe fn image_mut(&self) -> Option<&mut Image>
source§fn set_deimage<I: ImageExt>(&mut self, image: Option<I>)
fn set_deimage<I: ImageExt>(&mut self, image: Option<I>)
source§fn set_deimage_scaled<I: ImageExt>(&mut self, image: Option<I>)
fn set_deimage_scaled<I: ImageExt>(&mut self, image: Option<I>)
source§fn deimage(&self) -> Option<Box<dyn ImageExt>>
fn deimage(&self) -> Option<Box<dyn ImageExt>>
source§unsafe fn deimage_mut(&self) -> Option<&mut Image>
unsafe fn deimage_mut(&self) -> Option<&mut Image>
source§fn set_callback<F: FnMut(&mut Self) + 'static>(&mut self, cb: F)
fn set_callback<F: FnMut(&mut Self) + 'static>(&mut self, cb: F)
source§fn emit<T: 'static + Clone + Send + Sync>(&mut self, sender: Sender<T>, msg: T)
fn emit<T: 'static + Clone + Send + Sync>(&mut self, sender: Sender<T>, msg: T)
source§unsafe fn into_widget<W: WidgetBase>(&self) -> W
unsafe fn into_widget<W: WidgetBase>(&self) -> W
WidgetExt
to some widget type Read moresource§fn visible_r(&self) -> bool
fn visible_r(&self) -> bool
source§fn is_same<W: WidgetExt>(&self, other: &W) -> bool
fn is_same<W: WidgetExt>(&self, other: &W) -> bool
source§fn active_r(&self) -> bool
fn active_r(&self) -> bool
source§fn handle_event(&mut self, event: Event) -> bool
fn handle_event(&mut self, event: Event) -> bool
source§fn is_derived(&self) -> bool
fn is_derived(&self) -> bool
source§fn as_base_widget(&self) -> Widgetwhere
Self: Sized,
fn as_base_widget(&self) -> Widgetwhere Self: Sized,
WidgetExt
to a Widget