public sealed class ToolbarPresenterA strip of buttons, segmented groups and dropdowns over command ids.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The third view over the registry, and the one that shows why the registry is worth having: a toolbar is a list of ids, and every button's label, icon, tooltip, shortcut and enabled state is looked up rather than declared here.
⚠ Enablement is refreshed on a tick rather than when something changes. A menu can wait until it opens; a toolbar is on screen the whole time, and there is no event for "the selection changed in a way that makes Delete meaningful". One predicate per button per frame is a handful of comparisons — and it is the same trade the command's own remarks make about keeping the predicate cheap.
A command with an icon gets an icon button; one without gets its title. A toolbar of identical blank squares is worse than a toolbar of words, and requiring an icon would mean a plugin could not add a toolbar button without drawing one. It is also doc 20's stated mitigation for the icon set being a design dependency: a glyph that has not been drawn yet costs a wider button and never a blocked feature.
⚠ The bar grows sections, not entries. Doc 20's toolbar is mode buttons | save and build | transform mode, space, pivot, snap | play | layout, and two of those need something a flat list of ids cannot express: a segmented control, so that the three gizmo modes read as one choice, and a dropdown, so that a snap value is a popover rather than eight more buttons. Show takes those; Show is still the flat form, and is the same thing with every entry a button.
Fields and properties (3)
public IReadOnlyList<ToolbarEntry> EntriesWhat is on it, in order.
public IReadOnlyList<string?> ItemsThe ids on it, with null for anything that is not a plain button.
public UiElement StripThe strip element, which is replaced by every rebuild.
Methods (5)
public ToolbarPresenter(UiElement host, CommandRegistry commands, KeyMap keys)Builds a toolbar into an element.
public void Show(params ReadOnlySpan<string?> commandIds)Puts a set of commands on the toolbar.
public void Show(params ReadOnlySpan<ToolbarEntry> entries)Puts a described strip on the toolbar.
public void Rebuild()Throws the strip away and builds it again.
public void Refresh()Asks every command on the strip whether it can run, and shows the answer.
Used by (12)
- AttachedVixen.Editor.App
- ChromeFixtureVixen.Editor.Ui.Tests
- EditorAffordanceTestsVixen.Editor.App.Tests
- EditorApplicationVixen.Editor.App
- EditorModeTestsVixen.Editor.App.Tests
- EditorShellVixen.Editor.Ui
- EditorShellTestsVixen.Editor.Ui.Tests
- MenuTestsVixen.Editor.Ui.Tests
- ModeTestsVixen.Editor.Ui.Tests
- ToolbarSectionTestsVixen.Editor.Ui.Tests
- TransportTestsVixen.Editor.App.Tests
- ViewportChromeVixen.Editor.App