Represents a simple text item that by default can not be selected,
but optionally can be selected and pressed like a button.
Example:
use glerminal::menu_systems::TextItem;
TextItem::new("Just a text label");
TextItem::new("A button that can be pressed").with_is_button(true);
Foreground color for when the button is not focused
Background color for when the button is not focused
Foreground color for when the button is focused
Background color for when the button is focused
The keyboard inputs that trigger was_just_pressed
The mouse inputs that trigger was_just_pressed
The max width the text maximally cuts at
Intiailizes a TextItem with the given text and gets the initial max width from the text width
If the text might get bigger, use with_max_width
or set_max_width
.
Sets the initial position
Set whether the checkbox is initially focused or not
Set the buttons which trigger was_just_pressed
Set the mouse buttons which trigger was_just_pressed
Returns whether buttons from mouse_button_press_inputs
or button_press_inputs
were pressed just now.
Set the initial colors when it is unfocused
Set the initial colors when it is focused
Set the colors when it is unfocused
Set the colors when it is focused
Sets the initial max width of the TextItem
pub fn with_text<T: Into<String>>(self, text: T) -> TextItem | [src] |
Sets the initial text of the TextItem
Set whether this TextItem can be focused and used as a button
Set whether this TextItem can be focused and used as a button
pub fn set_text<T: Into<String>>(&mut self, text: T) | [src] |
Sets the text of the TextItem
Set the max width of the TextItem. This should ideally not be called, unless necessary.
Return the current text of the TextItem
Can this TextItem
be focused and pressed like a button
Get the InterfaceItemBase
Get the InterfaceItemBase
as mutable
Get the width this InterfaceItem can take up Read more
Get the height this InterfaceItem can take up Read more
Handle events for this InterfaceItem. Read more
Update this InterfaceItem; delta is given in seconds. (see Terminal.delta_time())
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Make a box of the cloned InterfaceItem
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static