1use gpui::{Entity, View};
2
3enum ContextMenuItem {
4 Item {
5 label: String,
6 action: Box<dyn Action>,
7 },
8 Separator,
9}
10
11pub struct ContextMenu {
12 position: Vector2F,
13 items: Vec<ContextMenuItem>,
14}
15
16impl Entity for ContextMenu {
17 type Event = ();
18}
19
20impl View for ContextMenu {
21 fn ui_name() -> &'static str {
22 "ContextMenu"
23 }
24
25 fn render(&mut self, cx: &mut gpui::RenderContext<'_, Self>) -> gpui::ElementBox {
26 Overlay::new().with_abs_position(self.position).boxed()
27 }
28}