7#include "keyboard_key.hpp"
11#include "../subsystem.hpp"
12#include <unordered_map>
15namespace hi::inline
v1 {
36 void add_system_command(gui_event_type cmd)
noexcept
39 if (i == system.cend()) {
40 system.push_back(cmd);
45 void add_ignored_command(gui_event_type cmd)
noexcept
48 if (i == ignored.
cend()) {
54 void add_user_command(gui_event_type cmd)
noexcept
57 if (i == user.
cend()) {
63 void update_cache()
noexcept
65 cache.
reserve(ssize(system) + ssize(user));
67 for (
hilet cmd : system) {
69 if (i == cache.
cend()) {
74 for (
hilet cmd : ignored) {
76 if (i != cache.
cend()) {
81 for (
hilet cmd : user) {
83 if (i == cache.
cend()) {
97 void add_system_binding(
keyboard_key key, gui_event_type command)
noexcept
99 bindings[key].add_system_command(command);
102 void add_ignored_binding(
keyboard_key key, gui_event_type command)
noexcept
104 bindings[key].add_ignored_command(command);
107 void add_user_binding(
keyboard_key key, gui_event_type command)
noexcept
109 bindings[key].add_user_command(command);
119 if (event == gui_event_type::keyboard_down) {
121 if (i != bindings.
cend()) {
122 hilet& new_events = i->second.get_events();
123 events.insert(events.cend(), new_events.cbegin(), new_events.cend());
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
Functions and macros for handling architectural difference between compilers, CPUs and operating syst...
Definition of GUI event types.
DOXYGEN BUG.
Definition algorithm.hpp:15
Definition keyboard_bindings.hpp:17
void translate(gui_event event, std::vector< gui_event > &events) const noexcept
translate a key press in the empty-context to a command.
Definition keyboard_bindings.hpp:117
void load_bindings(URL url, bool system_binding=false)
Load bindings from a JSON file.
void clear() noexcept
Clear all bindings.
Definition keyboard_bindings.hpp:133
A key in combination with modifiers.
Definition keyboard_key.hpp:20
T emplace_back(T... args)