Files
MuditaOS/module-gui/gui/input/InputEvent.cpp
Paweł Joński 5ad878c6c4 [BH-371] Replace gsl with mainline submodule and move to third-party
Replacing loose gsl files with gsl mainline project as submodule
and moving it to third-party
2021-06-07 09:30:04 +02:00

29 lines
729 B
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "InputEvent.hpp"
#include <gsl/assert>
namespace gui
{
InputEvent::InputEvent(RawKey key, State state, KeyCode keyCode) : rawKey(key), state(state), keyCode(keyCode)
{}
std::string InputEvent::str() const
{
std::stringstream ss;
ss << "KeyCode: " << c_str(keyCode) << " ";
ss << "State: " << c_str(state) << " ";
ss << "short press: " << isShortRelease();
return ss.str();
}
auto InputEvent::numericValue() const -> int
{
Expects(isDigit());
return toNumeric(keyCode);
}
}; // namespace gui