Introduce keyboard navigation in context menus

This commit is contained in:
Antonio Scandurra 2022-05-26 16:36:30 +02:00
parent 991eb742b0
commit 5b2d6e41f3
20 changed files with 121 additions and 34 deletions

11
crates/menu/Cargo.toml Normal file
View file

@ -0,0 +1,11 @@
[package]
name = "menu"
version = "0.1.0"
edition = "2021"
[lib]
path = "src/menu.rs"
doctest = false
[dependencies]
gpui = { path = "../gpui" }

16
crates/menu/src/menu.rs Normal file
View file

@ -0,0 +1,16 @@
#[derive(Clone)]
pub struct SelectIndex(pub usize);
gpui::actions!(
menu,
[
Cancel,
Confirm,
SelectPrev,
SelectNext,
SelectFirst,
SelectLast
]
);
gpui::impl_internal_actions!(menu, [SelectIndex]);