pub struct TextBoxState { /* private fields */ }Expand description
Text, caret, selection and focus of one text box.
Implementations§
Source§impl TextBoxState
impl TextBoxState
pub const fn new() -> TextBoxState
pub fn text(&self) -> &str
Sourcepub fn set_text(&mut self, text: impl Into<String>)
pub fn set_text(&mut self, text: impl Into<String>)
Replaces the text (cut to the max length), caret at the end.
pub fn is_focused(&self) -> bool
Sourcepub fn selection(&self) -> (usize, usize)
pub fn selection(&self) -> (usize, usize)
Selected characters start..end (empty when nothing is selected).
Sourcepub fn select_all(&mut self)
pub fn select_all(&mut self)
Selects all the text.
Sourcepub fn event_name(&self, ev: TextBoxEvent) -> Option<&str>
pub fn event_name(&self, ev: TextBoxEvent) -> Option<&str>
The on_change/on_submit event name the widget declared for a
TextBoxEvent::Changed/TextBoxEvent::Submitted (learned in
Self::apply); None for other results or when it has none.
Sourcepub fn apply(&mut self, w: &mut Widget)
pub fn apply(&mut self, w: &mut Widget)
Writes the state into the text box widget w before layout: text,
caret, selection, scroll, focus. Also picks up the widget’s max
length, padding, font and event names. Does nothing to other kinds.
Sourcepub fn handle(&mut self, event: &str, node: &LayoutNode) -> TextBoxEvent
pub fn handle(&mut self, event: &str, node: &LayoutNode) -> TextBoxEvent
Applies one UI event; node is the box’s laid-out node from the
frame the user saw (UiRoot::find_node).
Sourcepub fn handle_event(
&mut self,
event: &UiEvent<'_>,
node: &LayoutNode,
) -> TextBoxEvent
pub fn handle_event( &mut self, event: &UiEvent<'_>, node: &LayoutNode, ) -> TextBoxEvent
Self::handle for a parsed event.
Trait Implementations§
Source§impl Clone for TextBoxState
impl Clone for TextBoxState
Source§fn clone(&self) -> TextBoxState
fn clone(&self) -> TextBoxState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextBoxState
impl Debug for TextBoxState
Source§impl Default for TextBoxState
impl Default for TextBoxState
Source§fn default() -> TextBoxState
fn default() -> TextBoxState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TextBoxState
impl RefUnwindSafe for TextBoxState
impl Send for TextBoxState
impl Sync for TextBoxState
impl Unpin for TextBoxState
impl UnsafeUnpin for TextBoxState
impl UnwindSafe for TextBoxState
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.