ContextMenu view
The same menu, opened at the pointer over a region rather than from a trigger.
A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).
use gpui_kit::overlay::ContextMenu;
Construct
new(ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<Self>) -> SelfOptions
Chain onto the value.
menu(items: impl IntoIterator<Item = MenuItem>) -> Self
target(target: impl Into<SharedString>) -> Self
content(content: impl Fn(&mut Window, &mut App) -> AnyElement + 'static) -> SelfCommands
Need a Context, so they need a view.
set_items(items: Vec<MenuItem>, cx: &mut Context<Self>)
open_at(position: Point<Pixels>, window: &mut Window, cx: &mut Context<Self>)
close(window: &mut Window, cx: &mut Context<Self>)
dismiss(window: &mut Window, cx: &mut Context<Self>)Queries
Only answer; they change nothing.
is_open() -> bool
position() -> Point<Pixels>Reports
The variants of the event it emits. It never applies the change itself.
- Opened
- Invoked
- Dismissed
- Closed
Rendered by
Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.