class EE::UI::KeyBindings

Overview

#include <keyboardshortcut.hpp>

class KeyBindings {
public:
    // structs

    struct Shortcut;

    // construction

    KeyBindings(const Window::Input* input);

    // methods

    static KeyBindings::Shortcut sanitizeShortcut(const KeyBindings::Shortcut& shortcut);
    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 addKeybindsString(const std::map<std::string, std::string>& binds);
    void addKeybinds(const std::map<Shortcut, std::string>& binds);
    void addKeybindsStringUnordered(const std::unordered_map<std::string, std::string>& binds);
    void addKeybindsUnordered(const std::unordered_map<Shortcut, 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);
    bool existsKeybind(const Shortcut& keys);
    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, Uint64> getKeybindings() const;
    std::string getShortcutString(Shortcut shortcut, bool format = false) const;
};

Detailed Documentation

Methods

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.