Struct prototty_elements::menu::Menu
[−]
[src]
pub struct Menu<T: Copy> { pub entries: Vec<MenuEntry<T>>, pub size: Vector2<u16>, pub selected_info: TextInfo, pub normal_info: TextInfo, }
A list of MenuEntry
s, in the order they appear when rendered,
with a description of how the text of the selected and normal
(ie. not selected) entries should be rendered.
Menu
s (MenuEntry
s rather) own their value, and remain in
scope after a value has been chosen (by running the menu).
A copy of a MenuEntry
's value is returned by MenuRunner::run_menu
.
Note that a Menu
doesn't contain information about the current
selection. When a Menu
is rendered, all its entries use
normal_info
when rendering. To combine a Menu
with selection
state, use a MenuInstance
.
Fields
entries: Vec<MenuEntry<T>>
size: Vector2<u16>
selected_info: TextInfo
normal_info: TextInfo
Methods
impl<T: Copy> Menu<T>
[src]
fn new<S, V>(e: Vec<(S, T)>, size: V) -> Self where
S: Into<String>,
V: Into<Vector2<u16>>,
[src]
S: Into<String>,
V: Into<Vector2<u16>>,
Create a new menu.
fn smallest<S>(e: Vec<(S, T)>) -> Self where
S: Into<String>,
[src]
S: Into<String>,
Create a new menu, occupying the smallest amount of space required to fit all entries.
Trait Implementations
impl<T: Debug + Copy> Debug for Menu<T>
[src]
impl<T: Clone + Copy> Clone for Menu<T>
[src]
fn clone(&self) -> Menu<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Copy> View for Menu<T>
[src]
fn view<G: ViewGrid>(&self, offset: Vector2<i16>, depth: i16, grid: &mut G)
[src]
Update the cells in grid
to describe how a type should be rendered. Implementations of view
for low level ui components will typically involve updating cells directly. Implementations for higer level components, such as an entire application's ui, will typically call the view
methed of lower level components which make up the ui. Read more