gpui-kit GitHub

Components

Menubar view

A row of menus, at most one of them open.

A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).

use gpui_kit::overlay::Menubar;

Construct

new(ident: impl Into<Ident>, menus: impl IntoIterator<Item = MenubarMenu>, window: &mut Window, cx: &mut Context<Self>) -> Self

Options

Chain onto the value.

control_size(size: ControlSize) -> Self

Commands

Need a Context, so they need a view.

set_menus(menus: Vec<MenubarMenu>, window: &mut Window, cx: &mut Context<Self>)
open(id: &str, window: &mut Window, cx: &mut Context<Self>)
close(window: &mut Window, cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

open_menu() -> Option<&SharedString>
menus() -> &[MenubarMenu]

Reports

The variants of the event it emits. It never applies the change itself.

Rendered by

Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.

Source: crates/gpui-kit/src/overlay/menubar.rs