[][src]Struct termimad::InputField

pub struct InputField {
    pub area: Area,
    pub focused: bool,
    // some fields omitted
}

A simple input field, managing its cursor position.

Fields

area: Areafocused: 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)[src]

put a char at cursor position (and increments 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 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_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 yourselves.

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]

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

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, 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.