Struct cursive::views::Menubar
[−]
[src]
pub struct Menubar { pub autohide: bool, // some fields omitted }
Shows a single-line list of items, with pop-up menus when one is selected.
The Cursive
root already includes a menubar
that you just need to configure.
Fields
autohide: bool
TODO: move this out of this view.
Methods
impl Menubar
[src]
fn new() -> Self
[src]
Creates a new, empty menubar.
fn receive_events(&self) -> bool
[src]
True if we should be receiving events.
[src]
True if some submenus are visible.
fn visible(&self) -> bool
[src]
Returns true
if we should be drawn.
fn add_subtree(&mut self, title: &str, menu: MenuTree) -> &mut Self
[src]
Adds a new item to the menubar.
The item will use the given title, and on selection, will open a popup-menu with the given menu tree.
fn insert_subtree(&mut self, i: usize, title: &str, menu: MenuTree) -> &mut Self
[src]
Insert a new item at the given position.
fn clear(&mut self)
[src]
Removes all menu items from this menubar.
fn len(&self) -> usize
[src]
Returns the number of items in this menubar.
fn is_empty(&self) -> bool
[src]
Returns true
if this menubar is empty.
fn get_subtree(&mut self, i: usize) -> Option<&mut MenuTree>
[src]
Returns the item at the given position.
Returns None
if i > self.len()
fn find_subtree(&mut self, label: &str) -> Option<&mut MenuTree>
[src]
Looks for an item with the given label.
fn find_position(&mut self, label: &str) -> Option<usize>
[src]
Returns the position of the item with the given label.
Returns None
if no such label was found.
fn remove(&mut self, i: usize)
[src]
Remove the item at the given position.
Trait Implementations
impl Default for Menubar
[src]
impl View for Menubar
[src]
fn draw(&self, printer: &Printer)
[src]
Draws the view with the given printer (includes bounds) and focus.
fn on_event(&mut self, event: Event) -> EventResult
[src]
Called when a key was pressed. Read more
fn take_focus(&mut self, _: Direction) -> bool
[src]
This view is offered focus. Will it take it? Read more
fn required_size(&mut self, _: Vec2) -> Vec2
[src]
Returns the minimum size the view requires with the given restrictions. Read more
fn needs_relayout(&self) -> bool
[src]
Returns true
if the view content changed since last layout phase. Read more
fn layout(&mut self, Vec2)
[src]
Called once the size for this view has been decided, Read more
fn call_on_any<'a>(&mut self, _: &Selector, _: Box<FnMut(&mut Any) + 'a>)
[src]
Runs a closure on the view identified by the given selector. Read more
fn focus_view(&mut self, &Selector) -> Result<(), ()>
[src]
Moves the focus to the view identified by the given selector. Read more