Struct fltk::menu::MenuItem[][src]

pub struct MenuItem { /* fields omitted */ }
Expand description

Creates a menu item

Implementations

Initializes a new menu item

Creates a popup menu at the specified coordinates and returns its choice

Returns the label of the menu item

Sets the label of the menu item

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

Returns the value of the menu item

Sets the menu item

Clears the menu item

Returns whether the menu item is visible or not

Returns whether the menu item is active

Activates the menu item

Deactivates the menu item

Returns whether a menu item is a submenu

Returns whether a menu item is a checkbox

Returns whether a menu item is a radio item

Shows the menu item

Hides the menu item

Get the next menu item skipping submenus

Get children of MenuItem

Get the submenu count

Get the size of the MenuItem

Get the menu item at idx

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

Measure the width and height of a menu item

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.