pub struct TextInput { /* private fields */ }Implementations§
Source§impl TextInput
impl TextInput
pub fn new(on_change: SetSignal<String>) -> Self
pub fn with_placeholder(self, text: impl Into<String>) -> Self
pub fn with_metrics(self, metrics: Metrics) -> Self
pub fn with_text_color(self, color: [u8; 3]) -> Self
pub fn with_background(self, color: [f32; 4]) -> Self
pub fn with_border_radius(self, radius: f32) -> Self
pub fn with_padding(self, padding: f32) -> Self
pub fn with_initial_value(self, text: impl Into<String>) -> Self
Sourcepub fn text_before_cursor(&self) -> &str
pub fn text_before_cursor(&self) -> &str
Returns the text substring before the cursor position.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Returns whether the widget has focus.
Trait Implementations§
Source§impl Widget for TextInput
impl Widget for TextInput
fn style(&self) -> Style
fn draw(&self, ctx: &mut DrawContext<'_>)
fn handle_event(&mut self, ctx: &mut EventContext<'_>) -> bool
Source§fn handle_key_event(
&mut self,
event: &KeyEvent,
modifiers: ModifiersState,
) -> bool
fn handle_key_event( &mut self, event: &KeyEvent, modifiers: ModifiersState, ) -> bool
Called when this widget has focus and a key is pressed.
Returns true if the event was consumed.
Source§fn update_measures(&mut self, measures: &[Vec<f32>])
fn update_measures(&mut self, measures: &[Vec<f32>])
Called after text rendering to feed back measured pixel widths.
fn is_focusable(&self) -> bool
fn set_focus(&mut self, focused: bool)
fn activate(&mut self)
fn clear_active(&mut self)
fn is_scrollable(&self) -> bool
Auto Trait Implementations§
impl !Freeze for TextInput
impl !RefUnwindSafe for TextInput
impl !Send for TextInput
impl !Sync for TextInput
impl Unpin for TextInput
impl !UnwindSafe for TextInput
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.