[][src]Struct orbtk::widgets::TextBox

pub struct TextBox {
    pub rect: Cell<Rect>,
    pub selector: CloneCell<Selector>,
    pub text: CloneCell<String>,
    pub text_i: Cell<usize>,
    pub text_offset: Cell<Point>,
    pub scroll_offset: Cell<(i32, i32)>,
    pub mask_char: Cell<Option<char>>,
    pub grab_focus: Cell<bool>,
    pub click_callback: RefCell<Option<Arc<dyn Fn(&TextBox, Point)>>>,
    pub enter_callback: RefCell<Option<Arc<dyn Fn(&TextBox)>>>,
    pub event_filter: RefCell<Option<Arc<dyn Fn(&TextBox, Event, &mut bool, &mut bool) -> Option<Event>>>>,
    // some fields omitted
}

Fields

rect: Cell<Rect>selector: CloneCell<Selector>text: CloneCell<String>text_i: Cell<usize>text_offset: Cell<Point>scroll_offset: Cell<(i32, i32)>mask_char: Cell<Option<char>>grab_focus: Cell<bool>click_callback: RefCell<Option<Arc<dyn Fn(&TextBox, Point)>>>enter_callback: RefCell<Option<Arc<dyn Fn(&TextBox)>>>event_filter: RefCell<Option<Arc<dyn 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]

pub fn new() -> Arc<Self>[src]

pub fn grab_focus(&self, grab_focus: bool) -> &Self[src]

pub fn mask_char(&self, mask_char: Option<char>) -> &Self[src]

Trait Implementations

impl Click for TextBox[src]

impl Enter for TextBox[src]

impl EventFilter for TextBox[src]

impl Place for TextBox[src]

impl Style for TextBox[src]

impl Text for TextBox[src]

impl Widget for TextBox[src]

Auto Trait Implementations

impl !RefUnwindSafe for TextBox

impl !Send for TextBox

impl !Sync for TextBox

impl Unpin for TextBox

impl !UnwindSafe for TextBox

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> SetParameter for T

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.