add member alt for arg_keyboard

This commit is contained in:
Jinhao 2018-02-24 06:10:43 +08:00
parent 2ba4b612f1
commit 244416088f
3 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/**
* Definition of General Events
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@ -460,8 +460,9 @@ namespace nana
::nana::window window_handle; ///< A handle to the event window
mutable wchar_t key; ///< the key corresponding to the key pressed
mutable bool ignore; ///< this member is only available for key_char event, set 'true' to ignore the input.
bool ctrl; ///< keyboard Ctrl is pressed?
bool shift; ///< keyboard Shift is pressed
bool alt; ///< it is set to indicate the modifier key Alt just prior to the event.
bool ctrl; ///< it is set to indicate the modifier key Ctrl just prior to the event.
bool shift; ///< it is set to indicate the modifier key Shift just prior to the event.
};
struct arg_move : public event_arg

View File

@ -223,6 +223,7 @@ namespace detail
{
XKeyEvent xkey;
nana::detail::platform_spec::instance().read_keystate(xkey);
arg.alt = (xkey.state & Mod1Mask);
arg.ctrl = (xkey.state & ControlMask);
arg.shift = (xkey.state & ShiftMask);
}

View File

@ -1622,6 +1622,7 @@ namespace detail
void bedrock::get_key_state(arg_keyboard& kb)
{
kb.alt = (0 != (::GetKeyState(VK_MENU) & 0x80));
kb.ctrl = (0 != (::GetKeyState(VK_CONTROL) & 0x80));
kb.shift = (0 != (::GetKeyState(VK_SHIFT) & 0x80));
}