class EE::UI::KeyBindings¶
Overview¶
#include <keyboardshortcut.hpp> class KeyBindings { public: // typedefs typedef UnorderedMap<Shortcut, std::string, ShortcutHash> ShortcutMap; // structs struct Shortcut; struct ShortcutHash; struct Storage; // construction KeyBindings(const Window::Input* input); // methods static KeyBindings::Shortcut sanitizeShortcut(const KeyBindings::Shortcut& shortcut); static std::vector<Shortcut> getOrderedShortcuts(const ShortcutMap& bindings); static std::string keybindFormat(std::string str); static Shortcut toShortcut(const Window::Input* input, const std::string& keys); static std::string fromShortcut(const Window::Input* input, KeyBindings::Shortcut shortcut, bool format = false); void setKeybinds(const KeyBindings& bindings); void addKeybindsString(const std::map<std::string, std::string>& binds); void addKeybinds(const ShortcutMap& binds); void addKeybindsStringUnordered(const std::unordered_map<std::string, std::string>& binds); void addKeybindString(const std::string& key, const std::string& command); void addKeybind(const Shortcut& key, const std::string& command); void replaceKeybindString(const std::string& keys, const std::string& command); void replaceKeybind(const Shortcut& keys, const std::string& command); Shortcut getShortcutFromString(const std::string& keys); void removeKeybind(const Shortcut& keys); void removeKeybind(const std::string& kb); bool existsKeybind(const Shortcut& keys); bool hasCommand(const std::string& command); void removeCommandKeybind(const std::string& command); void removeCommandsKeybind(const std::vector<std::string>& command); std::string getCommandFromKeyBind(const Shortcut& keys); std::string getCommandKeybindString(const std::string& command) const; void reset(); const ShortcutMap& getShortcutMap() const; const std::map<std::string, Shortcut>& getKeybindings() const; Shortcut getShortcutFromCommand(const std::string& cmd) const; std::string getShortcutString(Shortcut shortcut, bool format = false) const; };
Detailed Documentation¶
Methods¶
static std::vector<Shortcut> getOrderedShortcuts(const ShortcutMap& bindings)
Returns the shortcut keys in ascending packed-value order. This provides deterministic iteration at boundaries where the order affects the selected reverse binding or serialized output, while keeping ShortcutMap optimized for lookup.
void setKeybinds(const KeyBindings& bindings)
Shares bindings storage while keeping this instance’s input source.
void replaceKeybindString(const std::string& keys, const std::string& command)
If the command is already on the list, it will remove the previous keybind.
void replaceKeybind(const Shortcut& keys, const std::string& command)
If the command is already on the list, it will remove the previous keybind.