[][src]Struct cursive::views::Menubar

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.

Implementations

impl Menubar[src]

pub fn new() -> Menubar[src]

Creates a new, empty menubar.

pub fn receive_events(&self) -> bool[src]

True if we should be receiving events.

pub fn has_submenu(&self) -> bool[src]

True if some submenus are visible.

pub fn visible(&self) -> bool[src]

Returns true if we should be drawn.

pub fn add_subtree<S>(&mut self, title: S, menu: MenuTree) -> &mut Menubar where
    S: Into<String>, 
[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.

pub fn add_delimiter(&mut self) -> &mut Menubar[src]

Adds a delimiter to the menubar.

pub fn add_leaf<S, F>(&mut self, title: S, cb: F) -> &mut Menubar where
    F: 'static + Fn(&mut Cursive),
    S: Into<String>, 
[src]

Adds a leaf node to the menubar.

pub fn insert_subtree<S>(
    &mut self,
    i: usize,
    title: S,
    menu: MenuTree
) -> &mut Menubar where
    S: Into<String>, 
[src]

Insert a new item at the given position.

pub fn insert_delimiter(&mut self, i: usize) -> &mut Menubar[src]

Inserts a new delimiter at the given position.

It will show up as |.

pub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) -> &mut Menubar where
    F: 'static + Fn(&mut Cursive),
    S: Into<String>, 
[src]

Inserts a new leaf node at the given position.

It will be directly actionable.

pub fn clear(&mut self)[src]

Removes all menu items from this menubar.

pub fn len(&self) -> usize[src]

Returns the number of items in this menubar.

pub fn is_empty(&self) -> bool[src]

Returns true if this menubar is empty.

pub fn get_subtree(&mut self, i: usize) -> Option<&mut MenuTree>[src]

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]

Looks for an item with the given label.

pub 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.

pub 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]

Auto Trait Implementations

impl !RefUnwindSafe for Menubar

impl !Send for Menubar

impl !Sync for Menubar

impl Unpin for Menubar

impl !UnwindSafe for Menubar

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AnyView for T where
    T: View
[src]

fn as_any(&self) -> &(dyn Any + 'static)[src]

Downcast self to a Any.

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

Downcast self to a mutable Any.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> Finder for T where
    T: View
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoBoxedView for T where
    T: View
[src]

impl<T> Nameable for T where
    T: View
[src]

impl<T> Resizable for T where
    T: View
[src]

impl<T> Scrollable for T where
    T: View
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> View for T where
    T: ViewWrapper
[src]

impl<T> With for T[src]