Jazz2::Editor::ToolOptionsBuilder class

Makes the options of a tool, shown in the toolbar while the tool is chosen, see EditorTool::BuildOptions().

Options are compact controls in a row. Where the row hasn't room for all of them, choices and groups of toggles turn into dropdowns, and those that still don't fit are found behind a button at its end. Each option reads its value whenever it's drawn, so a value changed by a shortcut is shown right away. Options kept by actions of the editor are left out for those who aren't experts if the actions are only for experts, unless the tool is too.

Constructors, destructors, conversion operators

~ToolOptionsBuilder() defaulted virtual

Public functions

void AddAction(const char* actionId, StringView label = {}, EditorIcon icon = EditorIcon::None) pure virtual
Adds an action of the editor.
void AddChoice(StringView label, ArrayView<const ToolOptionItem> items, bool preferDropdown = false) pure virtual
Adds a choice of actions of the editor, the one checked is chosen, as buttons side by side or as a dropdown.
void AddChoice(StringView label, ArrayView<const ToolOptionItem> items, Function<std::int32_t()>&& getter, Function<void(std::int32_t)>&& setter, bool preferDropdown = false) pure virtual
Adds a choice the tool keeps, getter returns the index of the item chosen, setter chooses one.
void AddToggles(StringView label, ArrayView<const ToolOptionItem> items) pure virtual
Adds actions of the editor that are toggled each by itself, as buttons side by side or as a dropdown.
void AddToggle(const ToolOptionItem& item, Function<bool()>&& getter, Function<void(bool)>&& setter) pure virtual
Adds a toggle the tool keeps.
void AddNumber(StringView label, StringView tooltip, float minValue, float maxValue, float step, Function<float()>&& getter, Function<void(float, bool)>&& setter) pure virtual
Adds a number the tool keeps, setter gets whether the value is final or only dragged.
void AddSeparator() pure virtual
Starts another group of options.

Function documentation

void Jazz2::Editor::ToolOptionsBuilder::AddAction(const char* actionId, StringView label = {}, EditorIcon icon = EditorIcon::None) pure virtual

Adds an action of the editor.

A toggle if the action can be checked, a button otherwise. It shows its icon, or icon, or label if it has none, or the label of the action. The tooltip is the label of the action with its shortcut.