pub struct Input<'a, T, F, S> { /* private fields */ }Expand description
Editable text input
Implementations§
Source§impl<'a, T, F, S> Input<'a, T, F, S>
impl<'a, T, F, S> Input<'a, T, F, S>
Sourcepub fn placeholder(self, placeholder: &'a str) -> Self
pub fn placeholder(self, placeholder: &'a str) -> Self
Sets the placeholder text, which is displayed when the input has no value.
Sourcepub fn password(self, password: bool) -> Self
pub fn password(self, password: bool) -> Self
Construct a new Input that renders the text as dots, for passwords.
Sourcepub fn val<N: AsRef<str>>(self, value: N) -> Input<'a, T, F, N>
pub fn val<N: AsRef<str>>(self, value: N) -> Input<'a, T, F, N>
Sets the current text value of the input.
Sourcepub fn on_change<N: Fn(String) -> T>(self, on_change: N) -> Input<'a, T, N, S>
pub fn on_change<N: Fn(String) -> T>(self, on_change: N) -> Input<'a, T, N, S>
Sets the message to post when the text value should be changed to a new value.
Sourcepub fn on_submit(self, message: T) -> Self
pub fn on_submit(self, message: T) -> Self
Sets the message to post when the users submits using the enter key
Sourcepub fn trigger_key(self, key: Key) -> Self
pub fn trigger_key(self, key: Key) -> Self
Sets a keyboard key that will trigger input focus
Trait Implementations§
Source§impl<'a, T, F, S> IntoNode<'a, T> for Input<'a, T, F, S>
impl<'a, T, F, S> IntoNode<'a, T> for Input<'a, T, F, S>
Source§impl<'a, T, F, S> Widget<'a, T> for Input<'a, T, F, S>
impl<'a, T, F, S> Widget<'a, T> for Input<'a, T, F, S>
Source§fn widget(&self) -> &'static str
fn widget(&self) -> &'static str
The name of this widget, used to identify widgets of this type in stylesheets.
Source§fn state(&self, state: &State) -> StateVec
fn state(&self, state: &State) -> StateVec
The state of this widget, used for computing the style.
If
None is returned, Node will automatically compute a state, such as “hover” and “pressed”.Source§fn len(&self) -> usize
fn len(&self) -> usize
Should return the amount of children this widget has. Must be consistent with
visit_children().Source§fn visit_children(&mut self, _: &mut dyn FnMut(&mut dyn GenericNode<'a, T>))
fn visit_children(&mut self, _: &mut dyn FnMut(&mut dyn GenericNode<'a, T>))
Source§fn size(&self, _: &State, stylesheet: &Stylesheet) -> (Size, Size)
fn size(&self, _: &State, stylesheet: &Stylesheet) -> (Size, Size)
Returns the
(width, height) of this widget.
The extents are defined as a Size,
which will later be resolved to actual dimensions.Source§fn event(
&mut self,
state: &mut State,
layout: Rectangle,
clip: Rectangle,
stylesheet: &Stylesheet,
event: Event,
context: &mut Context<T>,
)
fn event( &mut self, state: &mut State, layout: Rectangle, clip: Rectangle, stylesheet: &Stylesheet, event: Event, context: &mut Context<T>, )
Source§fn draw(
&mut self,
state: &mut State,
layout: Rectangle,
clip: Rectangle,
stylesheet: &Stylesheet,
) -> Vec<Primitive<'a>>
fn draw( &mut self, state: &mut State, layout: Rectangle, clip: Rectangle, stylesheet: &Stylesheet, ) -> Vec<Primitive<'a>>
Draw the widget. Returns a list of
Primitives that should be drawn. Read moreSource§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns whether this children has no children. Must be consistent with
visit_children().Source§fn hit(
&self,
_state: &Self::State,
layout: Rectangle,
clip: Rectangle,
_style: &Stylesheet,
x: f32,
y: f32,
) -> bool
fn hit( &self, _state: &Self::State, layout: Rectangle, clip: Rectangle, _style: &Stylesheet, x: f32, y: f32, ) -> bool
Source§fn focused(&self, _state: &Self::State) -> bool
fn focused(&self, _state: &Self::State) -> bool
Test the widget for focus exclusivity.
If the widget or one of it’s descendants is in an exclusive focus state, this function should return
true.
In all other cases, it should return false. When a widget is in an exclusive focus state it is
the only widget that is allowed to receive events in event.
Widgets that intended to use this behaviour are modal dialogs, dropdown boxes, context menu’s, etc.Auto Trait Implementations§
impl<'a, T, F, S> Freeze for Input<'a, T, F, S>
impl<'a, T, F, S> RefUnwindSafe for Input<'a, T, F, S>
impl<'a, T, F, S> Send for Input<'a, T, F, S>
impl<'a, T, F, S> Sync for Input<'a, T, F, S>
impl<'a, T, F, S> Unpin for Input<'a, T, F, S>
impl<'a, T, F, S> UnwindSafe for Input<'a, T, F, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more