Struct orbtk::widgets::TextBox
[−]
[src]
pub struct TextBox { pub rect: Cell<Rect>, pub bg: Color, pub fg: Color, pub fg_border: Color, pub fg_cursor: Color, pub border: Cell<bool>, pub border_radius: Cell<u32>, pub text: CloneCell<String>, pub text_i: Cell<usize>, pub text_offset: Cell<Point>, pub mask_char: Cell<Option<char>>, pub grab_focus: Cell<bool>, pub click_callback: RefCell<Option<Arc<Fn(&TextBox, Point)>>>, pub enter_callback: RefCell<Option<Arc<Fn(&TextBox)>>>, pub event_filter: RefCell<Option<Arc<Fn(&TextBox, Event, &mut bool, &mut bool) -> Option<Event>>>>, // some fields omitted }
Fields
rect: Cell<Rect>
bg: Color
fg: Color
fg_border: Color
fg_cursor: Color
border: Cell<bool>
border_radius: Cell<u32>
text: CloneCell<String>
text_i: Cell<usize>
text_offset: Cell<Point>
mask_char: Cell<Option<char>>
grab_focus: Cell<bool>
click_callback: RefCell<Option<Arc<Fn(&TextBox, Point)>>>
enter_callback: RefCell<Option<Arc<Fn(&TextBox)>>>
event_filter: RefCell<Option<Arc<Fn(&TextBox, Event, &mut bool, &mut bool) -> Option<Event>>>>
If event_filter is defined, all of the events will go trough it Instead of the default behavior. This allows defining fields that ex. will only accept numbers and ignore all else, or add some special behavior for some keys.
The closure should return None if the event was manually handled, or should return the event it received if it wants the default handler deal with it.
Methods
impl TextBox
[src]
fn new() -> Arc<Self>
fn grab_focus(&self, grab_focus: bool) -> &Self
fn mask_char(&self, mask_char: Option<char>) -> &Self
Trait Implementations
impl Border for TextBox
[src]
fn border(&self, enabled: bool) -> &Self
fn border_radius(&self, radius: u32) -> &Self
impl Click for TextBox
[src]
fn emit_click(&self, point: Point)
fn on_click<T: Fn(&Self, Point) + 'static>(&self, func: T) -> &Self
impl Enter for TextBox
[src]
fn emit_enter(&self)
fn on_enter<T: Fn(&Self) + 'static>(&self, func: T) -> &Self
impl EventFilter for TextBox
[src]
fn handle_event(&self,
event: Event,
focused: &mut bool,
redraw: &mut bool)
-> Option<Event>
event: Event,
focused: &mut bool,
redraw: &mut bool)
-> Option<Event>
fn event_filter<T: Fn(&Self, Event, &mut bool, &mut bool) -> Option<Event> + 'static>(&self,
func: T)
-> &Self
func: T)
-> &Self