Struct cursive::menu::MenuTree [−][src]
Root of a menu tree.
Fields
children: Vec<MenuItem>
Menu items
Methods
impl MenuTree
[src]
impl MenuTree
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new, empty tree.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Remove every children from this tree.
pub fn insert(&mut self, i: usize, item: MenuItem)
[src]
pub fn insert(&mut self, i: usize, item: MenuItem)
Inserts an item at the given position.
pub fn insert_delimiter(&mut self, i: usize)
[src]
pub fn insert_delimiter(&mut self, i: usize)
Inserts a delimiter at the given position.
pub fn add_delimiter(&mut self)
[src]
pub fn add_delimiter(&mut self)
Adds a delimiter to the end of this tree.
pub fn delimiter(self) -> Self
[src]
pub fn delimiter(self) -> Self
Adds a delimiter to the end of this tree - chainable variant.
pub fn add_leaf<S, F>(&mut self, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
pub fn add_leaf<S, F>(&mut self, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree.
pub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
pub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Inserts a leaf at the given position.
pub fn leaf<S, F>(self, title: S, cb: F) -> Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
[src]
pub fn leaf<S, F>(self, title: S, cb: F) -> Self where
S: Into<String>,
F: 'static + Fn(&mut Cursive),
Adds a actionnable leaf to the end of this tree - chainable variant.
pub fn insert_subtree<S>(&mut self, i: usize, title: S, tree: MenuTree) where
S: Into<String>,
[src]
pub fn insert_subtree<S>(&mut self, i: usize, title: S, tree: MenuTree) where
S: Into<String>,
Inserts a subtree at the given position.
pub fn add_subtree<S>(&mut self, title: S, tree: MenuTree) where
S: Into<String>,
[src]
pub fn add_subtree<S>(&mut self, title: S, tree: MenuTree) where
S: Into<String>,
Adds a submenu to the end of this tree.
pub fn subtree<S>(self, title: S, tree: MenuTree) -> Self where
S: Into<String>,
[src]
pub fn subtree<S>(self, title: S, tree: MenuTree) -> Self where
S: Into<String>,
Adds a submenu to the end of this tree - chainable variant.
pub fn get_mut(&mut self, i: usize) -> Option<&mut MenuItem>
[src]
pub fn get_mut(&mut self, i: usize) -> Option<&mut MenuItem>
Looks for the child at the given position.
Returns None
if i >= self.len()
.
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()
or if the item is not a subtree.
pub fn find_item(&mut self, title: &str) -> Option<&mut MenuItem>
[src]
pub fn find_item(&mut self, title: &str) -> Option<&mut MenuItem>
Looks for a child with the given title.
Returns None
if no such label was found.
pub fn find_subtree(&mut self, title: &str) -> Option<&mut MenuTree>
[src]
pub fn find_subtree(&mut self, title: &str) -> Option<&mut MenuTree>
Looks for a subtree with the given title.
pub fn find_position(&mut self, title: &str) -> Option<usize>
[src]
pub fn find_position(&mut self, title: &str) -> Option<usize>
Returns the position of a child 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)
Removes the item at the given position.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of direct children in this node.
- Includes delimiters.
- Does not count nested children.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if this tree has no children.