Struct termimad::InputField [−][src]
A simple input field, managing its cursor position and either handling the events you give it or being managed through direct manipulation functions (put_char, del_char_left, etc.)
Fields
area: Area
focused: bool
Implementations
impl InputField
[src]
pub fn new(area: Area) -> Self
[src]
pub fn change_area(&mut self, x: u16, y: u16, w: u16)
[src]
pub fn set_normal_style(&mut self, style: CompoundStyle)
[src]
pub fn get_content(&self) -> String
[src]
pub fn is_content(&self, s: &str) -> bool
[src]
tell whether the content of the input is equal to the argument
pub fn set_content(&mut self, s: &str)
[src]
change the content to the new one and put the cursor at the end if the content is different from the previous one.
pub fn put_char(&mut self, c: char) -> bool
[src]
put a char at cursor position (and increment this position)
pub fn del_char_left(&mut self) -> bool
[src]
remove the char left of the cursor, if any
pub fn del_char_below(&mut self) -> bool
[src]
remove the char at cursor position, if any
pub fn move_right(&mut self) -> bool
[src]
pub fn move_left(&mut self) -> bool
[src]
pub fn move_to_end(&mut self) -> bool
[src]
pub fn move_to_start(&mut self) -> bool
[src]
pub fn move_word_left(&mut self) -> bool
[src]
pub fn move_word_right(&mut self) -> bool
[src]
pub fn del_word_left(&mut self) -> bool
[src]
pub fn del_word_right(&mut self) -> bool
[src]
pub fn apply_keycode_event(&mut self, code: KeyCode) -> bool
[src]
apply an event being a key without modifier.
You don't usually call this function but the more
general apply_event
. This one is useful when you
manage events mostly yourselves.
This function handles a few events like deleting a
char, or going to the start (home key) or end (end key)
of the input. If you want to totally handle events, you
may call function like put_char
and del_char_left
directly.
pub fn apply_click_event(&mut self, x: u16, y: u16) -> bool
[src]
apply a click event
(for when you handle the events yourselves and don't have a termimad event)
pub fn apply_event(&mut self, event: &Event) -> bool
[src]
apply the passed event to change the state (content, cursor)
Return true when the event was used.
pub fn display_on<W>(&self, w: &mut W) -> Result<(), Error> where
W: Write,
[src]
W: Write,
render the input field on screen.
All rendering must be explicitely called, no rendering is done on functions changing the state.
w is typically either stderr or stdout.
pub fn display(&self) -> Result<(), Error>
[src]
render the input field on stdout
Auto Trait Implementations
impl RefUnwindSafe for InputField
[src]
impl Send for InputField
[src]
impl Sync for InputField
[src]
impl Unpin for InputField
[src]
impl UnwindSafe for InputField
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,