YCLIMP
Yandex Command Line Interface Music Player
Loading...
Searching...
No Matches
HotKeyComponent.hpp
1#pragma once
2
3#include "Primitives.hpp"
4
5#include <functional>
6#include <string>
7#include <unordered_map>
8
20{
21public:
22 HotKeyComponent(const std::string& ownerName);
23
24 void InsertBindingAction(
25 const std::pair<std::string, std::function<void()>>& bindingAction);
26 void HandleUserEvent(Event event, bool ownerIsActive);
27
28private:
29 void LoadBindings(const std::string& ownerName);
30 virtual void HandleGlobalBindings(Event event);
31 virtual void HandleLocalBindings(Event event);
32
33private:
34 std::unordered_map<EEventKey, std::string> mGlobalBindings;
35 std::unordered_map<EEventKey, std::string> mLocalBindings;
36 std::unordered_map<std::string, std::function<void()>> mBindingActions;
37#ifdef DEBUG
38 std::string mOwnerName;
39#endif
40};
void HandleUserEvent(Event event, bool ownerIsActive)
Process global bindings. If ownerIsActive is true process local bindings as well.
Definition HotKeyComponent.cpp:26
HotKeyComponent(const std::string &ownerName)
HotKeyComponent::HotKeyComponent.
Definition HotKeyComponent.cpp:9
Definition Primitives.hpp:88