Struct termimad::InputField[][src]

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

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: 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) -> 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]

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.