Jazz2::Editor::EditorAction struct

Something the user can do in the level editor.

The same action is behind a menu item, a toolbar button and a shortcut, so they all agree on what it does, what it's called and whether it can be done now.

Public functions

auto CanExecute() -> bool
Returns true if it can be done now.
auto GetTooltip() const -> String
Returns the label with the shortcut, as a tooltip.

Public variables

String Id
Identifier, it doesn't change between versions.
String Label
Name shown to the user.
EditorIcon Icon
Icon.
Shortcut Key
Shortcut, may be none.
Shortcut AlternateKey
Another shortcut, may be none.
Shortcut DefaultKey
Shortcut the action has unless the user changed it, see ActionRegistry::CaptureDefaults().
Shortcut DefaultAlternateKey
Other shortcut the action has unless the user changed it, see ActionRegistry::CaptureDefaults().
Function<void()> Execute
What it does.
Function<void()> Release
What ends it once the key that ran it is released, for an action that lasts while its key is held, or empty.
Function<bool()> IsEnabled
Returns whether it can be done now, always if not set.
Function<bool()> IsChecked
Returns whether it's turned on, for actions that toggle something.
bool WorksWhileTyping
Whether its shortcut works while a text is typed, as saving does, the text is confirmed first.
bool IgnoresRepeat
Whether its shortcut runs it only once while it's held, not again as the key repeats, as marking a corner shouldn't.
ActionScope Scope
When its shortcut works.

Variable documentation

Function<void()> Jazz2::Editor::EditorAction::Release

What ends it once the key that ran it is released, for an action that lasts while its key is held, or empty.

Called only after it was run by its key, see EditorInputRouter.

ActionScope Jazz2::Editor::EditorAction::Scope

When its shortcut works.

An action that works only while the level is played may have the same key as one that works only while it's edited, they don't conflict. A menu item or a button runs it whenever it can be done.