Shortcut struct
Key and modifiers that run an action.
On Apple platforms, Cmd is taken as Ctrl and shown as Cmd, elsewhere a key pressed with the system key (Win) matches no shortcut. The side buttons of a mouse (MouseButton::Fourth and MouseButton::Fifth) have no use of their own in the editor, so they can be shortcuts too. They stand for the keys Mouse4 and Mouse5, which no keyboard has, a press of them is passed on as a press of that key.
Public static variables
Public static functions
- static auto FromEvent(const KeyboardEvent& event) -> Shortcut
- Returns the shortcut a key event would be, its key and modifiers.
- static auto GetMouseButtonKey(MouseButton button) -> Keys
- Returns the key that stands for a side button of the mouse, Keys::Unknown for a button with a use of its own.
- static auto Parse(StringView text, Shortcut& result) -> bool
- Reads a shortcut from text as ToString() writes it, returns
falseif it isn't one.
Public functions
- auto Matches(const KeyboardEvent& event) const -> bool
- Returns
trueif a key event matches. - auto IsSameAs(const Shortcut& other) const -> bool
- Returns
trueif it's the same shortcut, plus, minus and Enter of the numeric keypad are the same keys as the others, its digits aren't. - auto ToString() const -> String
- Returns the shortcut as text, such as
Ctrl+ZorShift+Mouse 4, empty if the key has no name.
Public variables
- Keys Key
- Key, Keys::Unknown for none.
-
std::
int32_t Modifiers - Modifiers, a combination of KeyMod::Ctrl, KeyMod::Shift and KeyMod::Alt.