Module menu

Source
Expand description

A MenuBar widget for displaying [MenuTree]s

This API requires the following crate features to be activated: menu

§Example

use iced::widget::button;
use iced_aw::menu::{MenuTree, MenuBar};

let sub_2 = MenuTree::with_children(
    button("Sub Menu 2"),
    vec![
        MenuTree::new(button("item_1")),
        MenuTree::new(button("item_2")),
        MenuTree::new(button("item_3")),
    ]
);

let sub_1 = MenuTree::with_children(
    button("Sub Menu 1"),
    vec![
        MenuTree::new(button("item_1")),
        sub_2,
        MenuTree::new(button("item_2")),
        MenuTree::new(button("item_3")),
    ]
);


let root_1 = MenuTree::with_children(
    button("Menu 1"),
    vec![
        MenuTree::new(button("item_1")),
        MenuTree::new(button("item_2")),
        sub_1,
        MenuTree::new(button("item_3")),
    ]
);

let root_2 = MenuTree::with_children(
    button("Menu 2"),
    vec![
        MenuTree::new(button("item_1")),
        MenuTree::new(button("item_2")),
        MenuTree::new(button("item_3")),
    ]
);

let menu_bar = MenuBar::new(vec![root_1, root_2]);

Re-exports§

pub use action::MenuAction as Action;
pub use key_bind::KeyBind;
pub use crate::style::menu_bar::Appearance;
pub use crate::style::menu_bar::StyleSheet;

Modules§

action
key_bind

Structs§

CloseCondition
The condition of when to close a menu
MenuBar
A MenuBar collects MenuTrees and handles all the layout, event processing, and drawing.
Tree
Nested menu is essentially a tree of items, a menu is a collection of items a menu itself can also be an item of another menu.

Enums§

Item
Represents a menu item that performs an action when selected or a separator between menu items.
ItemHeight
The height of an item
ItemWidth
The width of an item
PathHighlight
Methods for drawing path highlight

Functions§

bar
A MenuBar collects MenuTrees and handles all the layout, event processing, and drawing.
items
Create a list of menu items from a vector of MenuItem.
menu_button
root
Create a root menu item.