(KeyCode, modifiers) → CommandID lookup table. More...
#include <command_registry.hpp>
Classes | |
| struct | Chord |
| All chords currently bound to the given command. More... | |
Public Member Functions | |
| void | bind (KeyCode key, std::uint16_t modifiers, CommandID id) |
| Associate a (key, modifier) chord with a command. | |
| void | unbind (KeyCode key, std::uint16_t modifiers) |
| Remove any binding for the given chord. No-op if unbound. | |
| void | unbind_command (CommandID id) |
| Remove every chord that points to the given command. | |
| CommandID | find (KeyCode key, std::uint16_t modifiers) const |
| Look up a chord. Returns kInvalidCommandID if unbound. | |
| std::vector< Chord > | chords_for (CommandID id) const |
| std::size_t | size () const |
| Number of bound chords. | |
| void | clear () |
| Clear all bindings. | |
| void | save_to (pulp::state::PropertiesFile &props, std::string_view key_prefix="shortcuts") const |
| Serialize / restore through a pulp::state::PropertiesFile. | |
| bool | load_from (const pulp::state::PropertiesFile &props, std::string_view key_prefix="shortcuts") |
(KeyCode, modifiers) → CommandID lookup table.
Pure data; safe to copy. Persists through save_to / load_from.
Associate a (key, modifier) chord with a command.
If a different command was previously bound to the same chord, it is replaced.
|
inline |
Clear all bindings.
Look up a chord. Returns kInvalidCommandID if unbound.
| bool pulp::view::ShortcutMap::load_from | ( | const pulp::state::PropertiesFile & | props, |
| std::string_view | key_prefix = "shortcuts" ) |
| void pulp::view::ShortcutMap::save_to | ( | pulp::state::PropertiesFile & | props, |
| std::string_view | key_prefix = "shortcuts" ) const |
Serialize / restore through a pulp::state::PropertiesFile.
Round-trip is lossless. The key namespace inside the properties file is "shortcuts.<key>.<mods>" → <command-id> so different subsystems can share one file without colliding (callers can pass a custom key_prefix to use their own namespace).
|
inline |
Number of bound chords.
| void pulp::view::ShortcutMap::unbind | ( | KeyCode | key, |
| std::uint16_t | modifiers ) |
Remove any binding for the given chord. No-op if unbound.
| void pulp::view::ShortcutMap::unbind_command | ( | CommandID | id | ) |
Remove every chord that points to the given command.