Struct cursive::views::MenuPopup [−][src]
pub struct MenuPopup { /* fields omitted */ }
Popup that shows a list of items.
Methods
impl MenuPopup
[src]
impl MenuPopup
pub fn new(menu: Rc<MenuTree>) -> Self
[src]
pub fn new(menu: Rc<MenuTree>) -> Self
Creates a new MenuPopup
using the given menu tree.
pub fn set_focus(&mut self, focus: usize)
[src]
pub fn set_focus(&mut self, focus: usize)
Sets the currently focused element.
pub fn focus(self, focus: usize) -> Self
[src]
pub fn focus(self, focus: usize) -> Self
Sets the currently focused element.
Chainable variant.
pub fn align(self, align: Align) -> Self
[src]
pub fn align(self, align: Align) -> Self
Sets the alignment for this view.
Chainable variant.
pub fn set_align(&mut self, align: Align)
[src]
pub fn set_align(&mut self, align: Align)
Sets the alignment for this view.
pub fn on_dismiss<F: 'static + Fn(&mut Cursive)>(self, f: F) -> Self
[src]
pub fn on_dismiss<F: 'static + Fn(&mut Cursive)>(self, f: F) -> Self
Sets a callback to be used when this view is actively dismissed.
(When the user hits
Chainable variant.
pub fn set_on_dismiss<F: 'static + Fn(&mut Cursive)>(&mut self, f: F)
[src]
pub fn set_on_dismiss<F: 'static + Fn(&mut Cursive)>(&mut self, f: F)
Sets a callback to be used when this view is actively dismissed.
(When the user hits
pub fn on_action<F: 'static + Fn(&mut Cursive)>(self, f: F) -> Self
[src]
pub fn on_action<F: 'static + Fn(&mut Cursive)>(self, f: F) -> Self
Sets a callback to be used when a leaf is activated.
Will also be called if a leaf from a subtree is activated.
Usually used to hide the parent view.
Chainable variant.
pub fn set_on_action<F: 'static + Fn(&mut Cursive)>(&mut self, f: F)
[src]
pub fn set_on_action<F: 'static + Fn(&mut Cursive)>(&mut self, f: F)
Sets a callback to be used when a leaf is activated.
Will also be called if a leaf from a subtree is activated.
Usually used to hide the parent view.
Trait Implementations
impl View for MenuPopup
[src]
impl View for MenuPopup
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 required_size(&mut self, req: Vec2) -> Vec2
[src]
fn required_size(&mut self, req: Vec2) -> Vec2
Returns the minimum size the view requires with the given restrictions. 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 layout(&mut self, size: Vec2)
[src]
fn layout(&mut self, size: Vec2)
Called once the size for this view has been decided. Read more
fn important_area(&self, size: Vec2) -> Rect
[src]
fn important_area(&self, size: Vec2) -> Rect
What part of the view is important and should be visible? 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
fn take_focus(&mut self, source: Direction) -> bool
[src]
fn take_focus(&mut self, source: Direction) -> bool
This view is offered focus. Will it take it? Read more