Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::Shortcut Struct Reference

Represents a keyboard shortcut for editor actions. More...

#include "donner/editor/TextEditor.h"

Public Member Functions

constexpr Shortcut ()=default
 Default constructor.
constexpr Shortcut (ImGuiKey k, ShortcutModifier m=ShortcutModifier::None)
 Constructs a shortcut with a single key and optional modifiers.
constexpr Shortcut (ImGuiKey k1, ImGuiKey k2, ShortcutModifier m=ShortcutModifier::None)
 Constructs a shortcut with two keys and optional modifiers.
bool matches (const ImGuiIO &io, bool repeat=true) const
 Checks if this shortcut matches the current input state.

Public Attributes

ImGuiKey key1 = ImGuiKey_None
 Primary key (required).
ImGuiKey key2 = ImGuiKey_None
 Secondary key (optional).
ShortcutModifier modifiers = ShortcutModifier::None
 Combined modifiers.

Detailed Description

Represents a keyboard shortcut for editor actions.

A shortcut consists of up to two keys and optional modifier keys.

Constructor & Destructor Documentation

◆ Shortcut() [1/2]

donner::editor::Shortcut::Shortcut ( ImGuiKey k,
ShortcutModifier m = ShortcutModifier::None )
inlineconstexpr

Constructs a shortcut with a single key and optional modifiers.

Parameters
kPrimary key.
mModifier flags combined using bitwise OR.

◆ Shortcut() [2/2]

donner::editor::Shortcut::Shortcut ( ImGuiKey k1,
ImGuiKey k2,
ShortcutModifier m = ShortcutModifier::None )
inlineconstexpr

Constructs a shortcut with two keys and optional modifiers.

Parameters
k1Primary key.
k2Secondary key.
mModifier flags combined using bitwise OR.

Member Function Documentation

◆ matches()

bool donner::editor::Shortcut::matches ( const ImGuiIO & io,
bool repeat = true ) const
inline

Checks if this shortcut matches the current input state.

Compares the set keys and modifiers against the keys currently pressed.

Parameters
ioReference to ImGuiIO containing the current keyboard state.
repeatWhether a key held past ImGui's key-repeat delay matches again. The editor draws frames only on events, so a single frame can outlast that delay while the key is down.
Returns
true if the shortcut matches, false otherwise.

The documentation for this struct was generated from the following file: