1 #ifndef TERMOX_SYSTEM_SHORTCUTS_HPP
2 #define TERMOX_SYSTEM_SHORTCUTS_HPP
3 #include <unordered_map>
5 #include <signals_light/signal.hpp>
7 #include <termox/system/key.hpp>
18 [[nodiscard]]
static auto add_shortcut(Key k) -> sl::Signal<void()>&;
38 using Map_t = std::unordered_map<Key, sl::Signal<void()>>;
39 inline static Map_t shortcuts_;
40 inline static bool enabled_ =
true;
Provides functions for defining global keyboard shortcuts.
Definition: shortcuts.hpp:12
static void remove_shortcut(Key k)
Stop key and its associated Signal from being called.
Definition: shortcuts.cpp:16
static void enable_all()
Allow all shortcuts to be processed, on by default.
Definition: shortcuts.cpp:31
static auto send_key(Key k) -> bool
Call on the associated Signal if key exists as a shortcut.
Definition: shortcuts.cpp:20
static void disable_all()
Stop all shortcuts from working.
Definition: shortcuts.cpp:29
static void clear()
Remove all shortcuts from the system.
Definition: shortcuts.cpp:18
static auto add_shortcut(Key k) -> sl::Signal< void()> &
Add an entry for the key, returning a Signal to connect an action to.
Definition: shortcuts.cpp:9