aboutsummaryrefslogtreecommitdiff
path: root/src/ui/ui_base.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-10-07 00:49:38 +0800
committercrupest <crupest@outlook.com>2018-10-07 00:49:38 +0800
commit36820c22929f4fb11892c4fbd52f321cc63a55ad (patch)
tree0c87a377fac3d9359995cb1fa62ec541fe83f579 /src/ui/ui_base.cpp
parentb0057dc911f96258c7280b89c8f4da828ecc283c (diff)
downloadcru-36820c22929f4fb11892c4fbd52f321cc63a55ad.tar.gz
cru-36820c22929f4fb11892c4fbd52f321cc63a55ad.tar.bz2
cru-36820c22929f4fb11892c4fbd52f321cc63a55ad.zip
Add shift selection, and fix the bug that caret is at wrong position when move with selection.
Diffstat (limited to 'src/ui/ui_base.cpp')
-rw-r--r--src/ui/ui_base.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ui/ui_base.cpp b/src/ui/ui_base.cpp
index 550432e4..3bee2269 100644
--- a/src/ui/ui_base.cpp
+++ b/src/ui/ui_base.cpp
@@ -1,6 +1,19 @@
#include "ui_base.h"
+#include "system_headers.h"
+
namespace cru {
namespace ui {
- }
+ bool IsKeyDown(const int virtual_code)
+ {
+ const auto result = ::GetKeyState(virtual_code);
+ return (static_cast<unsigned short>(result) & 0x8000) != 0;
+ }
+
+ bool IsKeyToggled(const int virtual_code)
+ {
+ const auto result = ::GetKeyState(virtual_code);
+ return (static_cast<unsigned short>(result) & 1) != 0;
+ }
+ }
}