[][src]Struct glerminal::menu_systems::TextInput

pub struct TextInput {
    pub bg_color_unfocused: [f32; 4],
    pub bg_color_focused: [f32; 4],
    pub fg_color_unfocused: [f32; 4],
    pub fg_color_focused: [f32; 4],
    pub button_press_inputs: Vec<VirtualKeyCode>,
    pub mouse_button_press_inputs: Vec<MouseButton>,
    pub filter: Filter,
    pub caret: f32,
    // some fields omitted
}

Represents a text-input field, that can be focused, takes in events (keyboard events as text), and it's possible to get the input text with get_text

TextInput.filter is used to determine which symbols are registered and then written. Example of a filter that will take in latin alphabetic letters and numerals:

use glerminal::menu_systems::{Filter, TextInput};
use glerminal::VirtualKeyCode::Equals;

let filter = Filter::empty_filter()
    .with_basic_latin_characters() // Add basic latin letters
    .with_basic_numerals()         // Add basic numerals
    .with_pair(Equals, '=');       // Add custom pair

TextInput::new(None, None).with_filter(filter);

Fields

bg_color_unfocused: [f32; 4]

Background-color for when the field is unfocused

bg_color_focused: [f32; 4]

Background-color for when the field is focused

fg_color_unfocused: [f32; 4]

Foreground-color for when the field is unfocused

fg_color_focused: [f32; 4]

Foreground-color for when the field is focused

button_press_inputs: Vec<VirtualKeyCode>

The keyboard inputs that trigger was_just_pressed

mouse_button_press_inputs: Vec<MouseButton>

The mouse inputs that trigger was_just_pressed

filter: Filter

The filter used to determine which button presses are registered for writing

caret: f32

Determines how often (in seconds) the caret's status should update.

Set 0.0 for no caret.

Methods

impl TextInput
[src]

pub fn new<T: Into<Option<u32>>, U: Into<Option<u32>>>(
    min_width: T,
    max_width: U
) -> TextInput
[src]

Initializes a new TextInput with the given min and max width

pub fn with_pos(self, pos: (u32, u32)) -> TextInput
[src]

Sets the initial position

pub fn with_focused(self, focused: bool) -> TextInput
[src]

Set whether the checkbox is initially focused or not

pub fn with_button_press_inputs(self, buttons: Vec<VirtualKeyCode>) -> TextInput
[src]

Set the buttons which trigger was_just_pressed

pub fn with_mouse_button_press_inputs(
    self,
    buttons: Vec<MouseButton>
) -> TextInput
[src]

Set the mouse buttons which trigger was_just_pressed

pub fn was_just_pressed(&self) -> bool
[src]

Returns whether buttons from mouse_button_press_inputs or button_press_inputs were pressed just now.

pub fn with_unfocused_colors(self, colors: ([f32; 4], [f32; 4])) -> TextInput
[src]

Set the initial colors when it is unfocused

pub fn with_focused_colors(self, colors: ([f32; 4], [f32; 4])) -> TextInput
[src]

Set the initial colors when it is focused

pub fn set_unfocused_colors(&mut self, colors: ([f32; 4], [f32; 4]))
[src]

Set the colors when it is unfocused

pub fn set_focused_colors(&mut self, colors: ([f32; 4], [f32; 4]))
[src]

Set the colors when it is focused

pub fn with_width<T: Into<Option<u32>>, U: Into<Option<u32>>>(
    self,
    min_width: T,
    max_width: U
) -> TextInput
[src]

Sets the width of the TextInput.

pub fn with_text<T: Into<String>>(self, text: T) -> TextInput
[src]

Sets the text of the TextInput.

pub fn with_prefix<T: Into<String>>(self, prefix: T) -> TextInput
[src]

Sets the prefix text of the TextInput.

pub fn with_suffix<T: Into<String>>(self, suffix: T) -> TextInput
[src]

Sets the suffix text of the TextInput.

pub fn with_filter(self, filter: Filter) -> TextInput
[src]

Sets the filter for the TextInput.

pub fn with_caret(self, delay: f32) -> TextInput
[src]

Determines how often (in seconds) the caret's status should update.

Set 0.0 for no caret.

pub fn with_character_limit<T: Into<Option<u32>>>(
    self,
    char_limit: T
) -> TextInput
[src]

Limtis the amount of characters that the TextInput will accept.

pub fn set_width<T: Into<Option<u32>>, U: Into<Option<u32>>>(
    self,
    min_width: T,
    max_width: U
)
[src]

Sets the width of the TextInput.

pub fn set_character_limit<T: Into<Option<u32>>>(self, char_limit: T)
[src]

Limtis the amount of characters that the TextInput will accept.

pub fn set_text<T: Into<String>>(&mut self, text: T)
[src]

Set the current text

pub fn get_text(&self) -> String
[src]

Returns the current text in the input

Trait Implementations

impl InterfaceItem for TextInput
[src]

impl Clone for TextInput
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for TextInput
[src]

Auto Trait Implementations

impl Send for TextInput

impl Sync for TextInput

Blanket Implementations

impl<T> InterfaceItemClone for T where
    T: 'static + InterfaceItem + Clone
[src]

impl<T> From for T
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]