Struct orbtk::text_box::TextBox
[−]
[src]
pub struct TextBox { pub core: WidgetCore, pub text: CloneCell<String>, pub text_i: Cell<usize>, pub fg_cursor: Color, pub mask_char: Cell<Option<char>>, pub grab_focus: Cell<bool>, pub on_click: RefCell<Option<Arc<Fn(&TextBox, Point)>>>, pub on_enter: RefCell<Option<Arc<Fn(&TextBox)>>>, pub event_filter: RefCell<Option<Arc<Fn(&TextBox, Event, &mut bool, &mut bool) -> Option<Event>>>>, // some fields omitted }
Fields
core: WidgetCore
text: CloneCell<String>
text_i: Cell<usize>
fg_cursor: Color
mask_char: Cell<Option<char>>
grab_focus: Cell<bool>
on_click: RefCell<Option<Arc<Fn(&TextBox, Point)>>>
on_enter: 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() -> Self
fn grab_focus(self, grab_focus: bool) -> Self
fn mask_char(self, mask_char: Option<char>) -> Self
fn text<S: Into<String>>(self, text: S) -> Self
Trait Implementations
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 Placeable for TextBox
[src]
fn place(self, window: &Window) -> Arc<Self>
fn position(self, x: i32, y: i32) -> Self
fn size(self, width: u32, height: u32) -> 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