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]
impl Menubar
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new, empty menubar.
pub fn receive_events(&self) -> bool
[src]
pub fn receive_events(&self) -> bool
True if we should be receiving events.
True if some submenus are visible.
pub fn visible(&self) -> bool
[src]
pub fn visible(&self) -> bool
Returns true
if we should be drawn.
ⓘImportant traits for &'a mut Rpub fn add_subtree<S>(&mut self, title: S, menu: MenuTree) -> &mut Self where
S: Into<String>,
[src]
pub fn add_subtree<S>(&mut self, title: S, menu: MenuTree) -> &mut Self where
S: Into<String>,
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.
ⓘImportant traits for &'a mut Rpub fn add_delimiter(&mut self) -> &mut Self
[src]
pub fn add_delimiter(&mut self) -> &mut Self
Adds a delimiter to the menubar.
ⓘImportant traits for &'a mut Rpub fn add_leaf<S, F>(&mut self, title: S, cb: F) -> &mut Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
pub fn add_leaf<S, F>(&mut self, title: S, cb: F) -> &mut Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a leaf node to the menubar.
ⓘImportant traits for &'a mut Rpub fn insert_subtree<S>(
&mut self,
i: usize,
title: S,
menu: MenuTree
) -> &mut Self where
S: Into<String>,
[src]
pub fn insert_subtree<S>(
&mut self,
i: usize,
title: S,
menu: MenuTree
) -> &mut Self where
S: Into<String>,
Insert a new item at the given position.
ⓘImportant traits for &'a mut Rpub fn insert_delimiter(&mut self, i: usize) -> &mut Self
[src]
pub fn insert_delimiter(&mut self, i: usize) -> &mut Self
Inserts a new delimiter at the given position.
It will show up as |
.
ⓘImportant traits for &'a mut Rpub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) -> &mut Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
pub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) -> &mut Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Inserts a new leaf node at the given position.
It will be directly actionable.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Removes all menu items from this menubar.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of items in this menubar.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if this menubar is empty.
pub fn get_subtree(&mut self, i: usize) -> Option<&mut MenuTree>
[src]
pub fn get_subtree(&mut self, i: usize) -> Option<&mut MenuTree>
Returns the item at the given position.
Returns None
if i > self.len()
pub fn find_subtree(&mut self, label: &str) -> Option<&mut MenuTree>
[src]
pub fn find_subtree(&mut self, label: &str) -> Option<&mut MenuTree>
Looks for an item with the given label.
pub fn find_position(&mut self, label: &str) -> Option<usize>
[src]
pub fn find_position(&mut self, label: &str) -> Option<usize>
Returns the position of the item with the given label.
Returns None
if no such label was found.
pub fn remove(&mut self, i: usize)
[src]
pub fn remove(&mut self, i: usize)
Remove the item at the given position.
Trait Implementations
impl Default for Menubar
[src]
impl Default for Menubar
impl View for Menubar
[src]
impl View for Menubar
fn draw(&self, printer: &Printer)
[src]
fn draw(&self, printer: &Printer)
Draws the view with the given printer (includes bounds) and focus. Read more
fn on_event(&mut self, event: Event) -> EventResult
[src]
fn on_event(&mut self, event: Event) -> EventResult
Called when an event is received (key press, mouse event, ...). Read more
fn take_focus(&mut self, _: Direction) -> bool
[src]
fn take_focus(&mut self, _: Direction) -> bool
This view is offered focus. Will it take it? Read more
fn required_size(&mut self, _: Vec2) -> Vec2
[src]
fn required_size(&mut self, _: Vec2) -> Vec2
Returns the minimum size the view requires with the given restrictions. Read more
fn important_area(&self, _: Vec2) -> Rect
[src]
fn important_area(&self, _: Vec2) -> Rect
What part of the view is important and should be visible? Read more
fn layout(&mut self, Vec2)
[src]
fn layout(&mut self, Vec2)
Called once the size for this view has been decided. Read more
fn needs_relayout(&self) -> bool
[src]
fn needs_relayout(&self) -> bool
Returns true
if the view content changed since last layout phase. Read more
fn call_on_any<'a>(&mut self, _: &Selector, _: AnyCb<'a>)
[src]
fn call_on_any<'a>(&mut self, _: &Selector, _: AnyCb<'a>)
Runs a closure on the view identified by the given selector. Read more
fn focus_view(&mut self, &Selector) -> Result<(), ()>
[src]
fn focus_view(&mut self, &Selector) -> Result<(), ()>
Moves the focus to the view identified by the given selector. Read more