geom3trik / tuix

Cross-platform GUI toolkit written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Menu API

WeirdConstructor opened this issue · comments

I just need a way to make a very simple popup context menu for instance. Where I specify a few item labels and have a callback which one was clicked.

This was the quick pseudo code I wrote earlier:

   Menu::new(cx, |cx| { ... })
       .items(vec![
           MenuItem::Button(id1, "next"),
           MenuItem::Button(id2, "prev"),
           ...
    ]).on_item(|id| {
         if id == id1 {
              println!("Next clicked!");
         }
   });