mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-02 10:58:45 -05:00
28 lines
746 B
C++
28 lines
746 B
C++
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "InputEvent.hpp"
|
|
#include <gsl/assert>
|
|
#include <sstream>
|
|
|
|
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
|