HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
keyboard_state.hpp
1// Copyright Take Vos 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../utility/utility.hpp"
8#include "../macros.hpp"
9#include <utility>
10
11hi_export_module(hikogui.GUI : keyboard_state);
12
13hi_export namespace hi::inline v1 {
14
15enum class keyboard_state : uint8_t {
16 idle = 0x00,
17 caps_lock = 0x01,
18 scroll_lock = 0x02,
19 num_lock = 0x04,
20};
21
22[[nodiscard]] constexpr keyboard_state operator|(keyboard_state const& lhs, keyboard_state const& rhs) noexcept
23{
24 return static_cast<keyboard_state>(std::to_underlying(lhs) | std::to_underlying(rhs));
25}
26
27[[nodiscard]] constexpr keyboard_state operator&(keyboard_state const& lhs, keyboard_state const& rhs) noexcept
28{
29 return static_cast<keyboard_state>(std::to_underlying(lhs) & std::to_underlying(rhs));
30}
31
32constexpr keyboard_state& operator|=(keyboard_state& lhs, keyboard_state const& rhs) noexcept
33{
34 return lhs = lhs | rhs;
35}
36
37bool operator>=(keyboard_state const& lhs, keyboard_state const& rhs) = delete;
38
39[[nodiscard]] constexpr bool to_bool(keyboard_state const& rhs) noexcept
40{
41 return to_bool(std::to_underlying(rhs));
42}
43
44}
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
T operator>=(T... args)