pub struct MenuItem<'ui> { /* private fields */ }
Expand description
An item within a Menu
.
Examples
use boing::Menu;
let menu: Menu;
let checkable = menu.push_new_item("Checkable")?;
checkable.set_checked(true);
checkable.on_clicked(|item| {
// Toggle the item.
item.set_checked(!item.is_checked());
});
let disabled = menu.push_new_item("Disabled")?;
disabled.disable();
Implementations§
source§impl<'ui> Item<'ui>
impl<'ui> Item<'ui>
sourcepub fn disable(&self)
pub fn disable(&self)
Makes this item not interactive.
By convention, the item is greyed-out as a visual indicator.
sourcepub fn on_clicked<F>(&'ui self, f: F)where
F: 'ui + FnMut(),
pub fn on_clicked<F>(&'ui self, f: F)where F: 'ui + FnMut(),
Sets a callback for when the user clicks this item.
This callback is unset by default.
sourcepub fn is_checked(&self) -> bool
pub fn is_checked(&self) -> bool
Determines if this item is checked.
Items are not checked by default.
sourcepub fn set_checked(&self, value: bool)
pub fn set_checked(&self, value: bool)
Sets whether or not this item is checked.