Struct fltk::menu::MenuItem [−][src]
pub struct MenuItem { /* fields omitted */ }
Expand description
Creates a menu item
Implementations
Creates a popup menu at the specified coordinates and returns its choice
Returns the label type of the menu item
Sets the label type of the menu item
Returns the label color of the menu item
Sets the label color of the menu item
Returns the label font of the menu item
Sets the label font of the menu item
Returns the label size of the menu item
Sets the label size of the menu item
Deactivates the menu item
Returns whether a menu item is a submenu
Returns whether a menu item is a checkbox
Get the submenu count
Get the user data
Safety
Can return multiple mutable instances of the user data, which has a different lifetime than the object
Set a callback for the menu item
Use a sender to send a message during callback
Check if a menu item was deleted
Draw a box around the menu item. Requires the call to be made inside a MenuExt-implementing widget’s own draw method
Add an image to a menu item
use fltk::{prelude::*, *}; const PXM: &[&str] = &[ "13 11 3 1", " c None", "x c #d8d833", "@ c #808011", " ", " @@@@ ", " @xxxx@ ", "@@@@@xxxx@@ ", "@xxxxxxxxx@ ", "@xxxxxxxxx@ ", "@xxxxxxxxx@ ", "@xxxxxxxxx@ ", "@xxxxxxxxx@ ", "@xxxxxxxxx@ ", "@@@@@@@@@@@ " ]; let image = image::Pixmap::new(PXM).unwrap(); let mut menu = menu::MenuBar::default(); menu.add( "&File/Open...\t", enums::Shortcut::Ctrl | 'o', menu::MenuFlag::Normal, |_| println!("Opened file!"), ); if let Some(mut item) = menu.find_item("&File/Open...\t") { item.add_image(Some(image), true); }
Trait Implementations
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more