pub struct Menu {
pub style: Style,
pub item_style: Style,
pub selected_color: Color,
pub header_color: Color,
pub text_color: Color,
pub separator_color: Color,
/* private fields */
}Expand description
Multi-page hierarchical navigation surface (LPAR-13 §5.E).
Stores all page data and item strings as owned values.
Fields§
§style: StyleBackground / border style for the full widget (Part::MAIN).
item_style: StyleStyle applied to item rows (Part::ITEMS).
selected_color: ColorHighlight color for the focused item (Part::SELECTED).
header_color: ColorBackground color for the header bar.
text_color: ColorColor for all text labels.
separator_color: ColorColor for separator rules.
Implementations§
Source§impl Menu
impl Menu
Sourcepub fn set_font(&mut self, font: &'static dyn FontMetrics)
pub fn set_font(&mut self, font: &'static dyn FontMetrics)
Assign the font used to render this widget (FONT-00 §5); resolves to
FONT_6X10 when unset.
Sourcepub fn add_page(&mut self, title: &str) -> MenuPageId
pub fn add_page(&mut self, title: &str) -> MenuPageId
Create a new page with the given title and return its id.
Sourcepub fn set_root_page(&mut self, id: MenuPageId)
pub fn set_root_page(&mut self, id: MenuPageId)
Set the root (initial) page displayed when the stack is empty.
Sourcepub fn add_item(&mut self, page: MenuPageId, item: MenuItem) -> MenuItemId
pub fn add_item(&mut self, page: MenuPageId, item: MenuItem) -> MenuItemId
Append item to page and return its id within that page.
The item string data is owned by the widget.
Sourcepub fn set_page(&mut self, id: MenuPageId)
pub fn set_page(&mut self, id: MenuPageId)
Navigate directly to id, pushing it onto the stack.
If id is already in the stack, pops back to that position.
Sourcepub fn back(&mut self)
pub fn back(&mut self)
Pop the current page from the stack.
No-op when already at the root page (i.e. active_page() == root_page
and the stack is empty or has the root page at position 0).
Sourcepub fn active_page(&self) -> MenuPageId
pub fn active_page(&self) -> MenuPageId
Return the id of the currently displayed page.
Sourcepub fn set_header_mode(&mut self, mode: MenuHeaderMode)
pub fn set_header_mode(&mut self, mode: MenuHeaderMode)
Set the position of the header bar.
Sourcepub fn header_mode(&self) -> MenuHeaderMode
pub fn header_mode(&self) -> MenuHeaderMode
Return the current header mode.
Enable or disable the back button when on the root page.
Return whether the root back button is enabled.
Move the highlight to the next navigable item on the current page, wrapping at the end.
Wire to ObjectEvent::Key(Key::ArrowDown).
Move the highlight to the previous navigable item on the current page, wrapping at the start.
Wire to ObjectEvent::Key(Key::ArrowUp).
Sourcepub fn activate_selected(&mut self)
pub fn activate_selected(&mut self)
Activate the currently highlighted item.
MenuItem::SubPage— pushes the target page onto the stack.MenuItem::Label— no structural change (caller polls viaactive_pageetc.).MenuItem::Separator— not reachable by navigation.
Wire to ObjectEvent::Key(Key::Enter).