diff options
author | crupest <crupest@outlook.com> | 2018-10-07 00:49:38 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-10-07 00:49:38 +0800 |
commit | 36820c22929f4fb11892c4fbd52f321cc63a55ad (patch) | |
tree | 0c87a377fac3d9359995cb1fa62ec541fe83f579 /src/ui/ui_base.cpp | |
parent | b0057dc911f96258c7280b89c8f4da828ecc283c (diff) | |
download | cru-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.cpp | 15 |
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; + } + } } |