menu/
menu.rs

1use rui::*;
2
3// Requires tao instead of winit for menus.
4// Run with: cargo run --example menu --no-default-features --features tao
5
6fn main() {
7    rui(hstack((
8        circle()
9            .color(RED_HIGHLIGHT)
10            .padding(Auto)
11            .command("File:New", Some(HotKey::KeyN), |_| println!("new")),
12        rectangle()
13            .corner_radius(5.0)
14            .color(AZURE_HIGHLIGHT)
15            .padding(Auto)
16            .command("Edit:Two", None, |_| println!("two"))
17            .command("Edit:Three", None, |_| println!("three"))
18            .command("Custom:Submenu:One", None, |_| println!("submenu one"))
19            .command("Custom:Submenu:Two", None, |_| println!("submenu two"))
20            .command_group((command("Custom 2:Four")
21                .action(|| println!("four"))
22                .hotkey(HotKey::KeyF),)),
23    )));
24}