aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/ShortcutHub.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-10-28 16:17:20 +0800
committercrupest <crupest@outlook.com>2020-10-28 16:17:20 +0800
commitfde24556042b76863bdec34dcc213cb7298f68f9 (patch)
treea6ed8de1a5044c24b72a1b71dad21bb977b6b1be /include/cru/ui/ShortcutHub.hpp
parent9d4a37acbe66983654aa90dbd3aa3700038697b9 (diff)
downloadcru-fde24556042b76863bdec34dcc213cb7298f68f9.tar.gz
cru-fde24556042b76863bdec34dcc213cb7298f68f9.tar.bz2
cru-fde24556042b76863bdec34dcc213cb7298f68f9.zip
...
Diffstat (limited to 'include/cru/ui/ShortcutHub.hpp')
-rw-r--r--include/cru/ui/ShortcutHub.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/cru/ui/ShortcutHub.hpp b/include/cru/ui/ShortcutHub.hpp
index 7557b758..a1dfcb7d 100644
--- a/include/cru/ui/ShortcutHub.hpp
+++ b/include/cru/ui/ShortcutHub.hpp
@@ -4,6 +4,7 @@
#include "cru/common/Base.hpp"
#include "cru/common/Event.hpp"
#include "cru/platform/native/Keyboard.hpp"
+#include "cru/ui/UiEvent.hpp"
#include <cstddef>
#include <functional>
@@ -43,6 +44,14 @@ class ShortcutKeyBind {
return !this->operator==(other);
}
+ std::u16string ToString() {
+ std::u16string result = u"(";
+ result += platform::native::ToString(modifier_);
+ result += u")";
+ result += platform::native::ToString(key_);
+ return result;
+ }
+
private:
platform::native::KeyCode key_;
platform::native::KeyModifier modifier_;
@@ -95,6 +104,9 @@ class ShortcutHub : public Object {
void Uninstall();
private:
+ void OnKeyDown(event::KeyEventArgs& event);
+
+ private:
std::unordered_map<ShortcutKeyBind, std::vector<ShortcutInfo>> map_;
const std::vector<ShortcutInfo> empty_list_;