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 Menubar
pub fn add_subtree<S>(&mut self, title: S, menu: Tree) -> &mut Menubar
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 Menubar
pub fn add_delimiter(&mut self) -> &mut Menubar
Adds a delimiter to the menubar.
Sourcepub fn add_leaf<S, F>(&mut self, title: S, cb: F) -> &mut Menubar
pub fn add_leaf<S, F>(&mut self, title: S, cb: F) -> &mut Menubar
Adds a leaf node to the menubar.
Sourcepub fn insert_subtree<S>(
&mut self,
i: usize,
title: S,
menu: Tree,
) -> &mut Menubar
pub fn insert_subtree<S>( &mut self, i: usize, title: S, menu: Tree, ) -> &mut Menubar
Insert a new item at the given position.
Sourcepub fn insert_delimiter(&mut self, i: usize) -> &mut Menubar
pub fn insert_delimiter(&mut self, i: usize) -> &mut Menubar
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 Menubar
pub fn insert_leaf<S, F>(&mut self, i: usize, title: S, cb: F) -> &mut Menubar
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.
Trait Implementations§
Source§impl View for Menubar
impl View for Menubar
Source§fn draw(&self, printer: &Printer<'_, '_>)
fn draw(&self, printer: &Printer<'_, '_>)
Source§fn on_event(&mut self, event: Event) -> EventResult
fn on_event(&mut self, event: Event) -> EventResult
Source§fn take_focus(&mut self, _: Direction) -> Result<EventResult, CannotFocus>
fn take_focus(&mut self, _: Direction) -> Result<EventResult, CannotFocus>
Source§fn required_size(&mut self, _: XY<usize>) -> XY<usize>
fn required_size(&mut self, _: XY<usize>) -> XY<usize>
Source§fn important_area(&self, size: XY<usize>) -> Rect
fn important_area(&self, size: XY<usize>) -> Rect
Source§fn layout(&mut self, _: XY<usize>)
fn layout(&mut self, _: XY<usize>)
Source§fn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
Source§fn call_on_any(
&mut self,
_: &Selector<'_>,
_: &mut dyn FnMut(&mut (dyn View + 'static)),
)
fn call_on_any( &mut self, _: &Selector<'_>, _: &mut dyn FnMut(&mut (dyn View + 'static)), )
Source§fn focus_view(&mut self, _: &Selector<'_>) -> Result<EventResult, ViewNotFound>
fn focus_view(&mut self, _: &Selector<'_>) -> Result<EventResult, ViewNotFound>
Auto Trait Implementations§
impl Freeze for Menubar
impl !RefUnwindSafe for Menubar
impl Send for Menubar
impl Sync for Menubar
impl Unpin for Menubar
impl !UnwindSafe for Menubar
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Finder for Twhere
T: View,
impl<T> Finder for Twhere
T: View,
Source§fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
sel
. Read moreSource§fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
sel
. Read moreSource§fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
call_on
with a view::Selector::Name
.Source§impl<T> IntoBoxedView for Twhere
T: View,
impl<T> IntoBoxedView for Twhere
T: View,
Source§fn into_boxed_view(self) -> Box<dyn View>
fn into_boxed_view(self) -> Box<dyn View>
Box<View>
.Source§impl<T> Resizable for Twhere
T: View,
impl<T> Resizable for Twhere
T: View,
Source§fn resized(
self,
width: SizeConstraint,
height: SizeConstraint,
) -> ResizedView<Self>
fn resized( self, width: SizeConstraint, height: SizeConstraint, ) -> ResizedView<Self>
self
in a ResizedView
with the given size constraints.Source§fn fixed_size<S>(self, size: S) -> ResizedView<Self>
fn fixed_size<S>(self, size: S) -> ResizedView<Self>
self
into a fixed-size ResizedView
.Source§fn fixed_width(self, width: usize) -> ResizedView<Self>
fn fixed_width(self, width: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn fixed_height(self, height: usize) -> ResizedView<Self>
fn fixed_height(self, height: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn full_screen(self) -> ResizedView<Self>
fn full_screen(self) -> ResizedView<Self>
self
into a full-screen ResizedView
.Source§fn full_width(self) -> ResizedView<Self>
fn full_width(self) -> ResizedView<Self>
self
into a full-width ResizedView
.Source§fn full_height(self) -> ResizedView<Self>
fn full_height(self) -> ResizedView<Self>
self
into a full-height ResizedView
.Source§fn max_size<S>(self, size: S) -> ResizedView<Self>
fn max_size<S>(self, size: S) -> ResizedView<Self>
self
into a limited-size ResizedView
.Source§fn max_width(self, max_width: usize) -> ResizedView<Self>
fn max_width(self, max_width: usize) -> ResizedView<Self>
self
into a limited-width ResizedView
.Source§fn max_height(self, max_height: usize) -> ResizedView<Self>
fn max_height(self, max_height: usize) -> ResizedView<Self>
self
into a limited-height ResizedView
.Source§fn min_size<S>(self, size: S) -> ResizedView<Self>
fn min_size<S>(self, size: S) -> ResizedView<Self>
self
into a ResizedView
at least sized size
.Source§fn min_width(self, min_width: usize) -> ResizedView<Self>
fn min_width(self, min_width: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_width
wide.Source§fn min_height(self, min_height: usize) -> ResizedView<Self>
fn min_height(self, min_height: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_height
tall.Source§impl<T> Scrollable for Twhere
T: View,
impl<T> Scrollable for Twhere
T: View,
Source§fn scrollable(self) -> ScrollView<Self>
fn scrollable(self) -> ScrollView<Self>
self
in a ScrollView
.