From 36820c22929f4fb11892c4fbd52f321cc63a55ad Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 7 Oct 2018 00:49:38 +0800 Subject: Add shift selection, and fix the bug that caret is at wrong position when move with selection. --- src/ui/ui_base.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/ui/ui_base.cpp') 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(result) & 0x8000) != 0; + } + + bool IsKeyToggled(const int virtual_code) + { + const auto result = ::GetKeyState(virtual_code); + return (static_cast(result) & 1) != 0; + } + } } -- cgit v1.2.3