pub trait CustomInput {
// Provided methods
fn handle_key_press(
&mut self,
key: &Event,
current_text: String,
) -> KeyPressResult { ... }
fn before_draw_text(
&mut self,
terminal_size: (u16, u16),
current_text: String,
) { ... }
fn after_draw_text(
&mut self,
terminal_size: (u16, u16),
current_text: String,
) { ... }
fn get_offset(
&mut self,
terminal_size: (u16, u16),
current_text: String,
) -> (u16, u16) { ... }
fn get_size(
&mut self,
terminal_size: (u16, u16),
current_text: String,
) -> (u16, u16) { ... }
}
Expand description
Trait that allows custom implementations / behaviour of an input
Provided Methods§
Sourcefn handle_key_press(
&mut self,
key: &Event,
current_text: String,
) -> KeyPressResult
fn handle_key_press( &mut self, key: &Event, current_text: String, ) -> KeyPressResult
Called before handling of every key press.
Sourcefn before_draw_text(&mut self, terminal_size: (u16, u16), current_text: String)
fn before_draw_text(&mut self, terminal_size: (u16, u16), current_text: String)
Called before the user’s text input is drawn. Here you can ex. change color of the inputted text
Sourcefn after_draw_text(&mut self, terminal_size: (u16, u16), current_text: String)
fn after_draw_text(&mut self, terminal_size: (u16, u16), current_text: String)
Called after the user’s text is drawn. Here you can ex. draw other text like information or a title of the document.