Expand description
Toolbars drawn from their declarations (docs/toolbars.md): a toolbar
is a menu id (demo.toolbar) whose items are contributed as any
menu’s (Ctx::menu_item, CommandSpec::menu, an alter hook), and
drawn as a row or a column of buttons instead of a list.
Experimental: may change in any release
(docs/stability.md).
- A command item is a button showing the command’s icon
(
CommandSpec::icon, itsicon_onwhile checked), its title and first key binding in the tooltip; a toolbar showing its titles (Labels) writes the title beside the icon, and a command without an icon shows its title. - Its
checkedclause draws it on (toolbar-button’sselectedstate, framed as a checked menu icon is; announced as toggled, a radio item as a chosen radio button); where the command or the item does not apply it is greyed, the reason in its tooltip; a run waiting for its result shows the spinner in its icon’s place. - Groups are separated by a line, as in a menu; a submenu is a button with a drop-down mark opening that menu; a list item gives a button per entry (with the entry’s own icon), asked of its provider when the toolbar is first drawn and again when the context changes.
- The tools that do not fit go, from the end, into a “More tools”
button (
Glyph::More) opening them as a menu. - The toolbar is one Tab stop: the arrows along it go from tool to tool, Home and End to the first and the last, and Tab coming back lands on the tool focused last.
egui_stack’s [ToolRow] lays the tools
out, takes their input and moves the focus; the kit paints them (its
DockPainter). Sizes come from the theme: the icon is
size.icon.toolbar, padded by space.xs, so the density moves them.
What each toolbar drew last is layout (the toolbars debug
collector), so an agent reads a toolbar’s tools, their state and which
went into “More tools” without pixels.
use egui_pop_api::AppHandle;
use egui_pop_api::toolbars::{Labels, Toolbar};
use egui_pop_model::ids::MenuId;
const TOOLBAR: MenuId = MenuId::from_static("demo.toolbar");
fn bar(ui: &mut egui::Ui, app: &AppHandle) {
Toolbar::new(app, &TOOLBAR).show(ui);
Toolbar::new(app, &TOOLBAR).labels(Labels::Beside).vertical().show(ui);
}Structs§
- Tool
Trace - A tool as a toolbar drew it last, for agents and tests.
- Toolbar
- A toolbar drawn from a menu’s items.
- Toolbar
Layout - A toolbar as it was drawn last.
Enums§
- Labels
- How a toolbar shows its tools.
- Orientation
- Which way a toolbar runs.
- Tool
Kind - What a tool is.
Functions§
- layout
- What a toolbar drew last, if it was drawn.