Struct cursive_core::views::Menubar
source · pub struct Menubar {
pub autohide: bool,
/* private fields */
}
Expand description
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.
Implementations§
source§impl Menubar
impl Menubar
sourcepub fn receive_events(&self) -> bool
pub fn receive_events(&self) -> bool
True if we should be receiving events.
True if some submenus are visible.
sourcepub fn add_subtree<S>(&mut self, title: S, menu: Tree) -> &mut Selfwhere
S: Into<String>,
pub fn add_subtree<S>(&mut self, title: S, menu: Tree) -> &mut Selfwhere
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.
sourcepub fn add_delimiter(&mut self) -> &mut Self
pub fn add_delimiter(&mut self) -> &mut Self
Adds a delimiter to the menubar.
sourcepub fn add_leaf<S, F>(&mut self, title: S, cb: F) -> &mut Selfwhere
S: Into<String>,
F: 'static + Fn(&mut Cursive),
pub fn add_leaf<S, F>(&mut self, title: S, cb: F) -> &mut Selfwhere
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a leaf node to the menubar.
sourcepub fn insert_subtree<S>(&mut self, i: usize, title: S, menu: Tree) -> &mut Selfwhere
S: Into<String>,
pub fn insert_subtree<S>(&mut self, i: usize, title: S, menu: Tree) -> &mut Selfwhere
S: Into<String>,
Insert a new item at the given position.
sourcepub fn insert_delimiter(&mut self, i: usize) -> &mut Self
pub fn insert_delimiter(&mut self, i: usize) -> &mut Self
Inserts a new delimiter at the given position.
It will show up as |
.
sourcepub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) -> &mut Selfwhere
S: Into<String>,
F: 'static + Fn(&mut Cursive),
pub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) -> &mut Selfwhere
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Inserts a new leaf node at the given position.
It will be directly actionable.
sourcepub fn get_subtree(&mut self, i: usize) -> Option<&mut Tree>
pub fn get_subtree(&mut self, i: usize) -> Option<&mut Tree>
Returns the item at the given position.
Returns None
if i > self.len()
sourcepub fn find_subtree(&mut self, label: &str) -> Option<&mut Tree>
pub fn find_subtree(&mut self, label: &str) -> Option<&mut Tree>
Looks for an item with the given label.
sourcepub fn find_position(&mut self, label: &str) -> Option<usize>
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.