HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
theme_state.hpp
1// Copyright Take Vos 2023.
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/module.hpp"
8#include <string>
9#include <ostream>
10
11namespace hi {
12inline namespace v1 {
13
14// clang-format off
15enum class theme_state : uint8_t {
16 disabled = 0b00'0'0'00,
17 enabled = 0b00'0'0'01,
18 hover = 0b00'0'0'10,
19 active = 0b00'0'0'11,
20 no_focus = 0b00'0'0'00,
21 focus = 0b00'0'1'00,
22 off = 0b00'0'0'00,
23 on = 0b00'1'0'00,
24 layer_0 = 0b00'0'0'00,
25 layer_1 = 0b01'0'0'00,
26 layer_2 = 0b10'0'0'00,
27 layer_3 = 0b11'0'0'00
28};
29// clang-format on
30
31constexpr auto theme_state_size = 64_uz;
32
33[[nodiscard]] constexpr theme_state operator|(theme_state const &lhs, theme_state const &rhs) noexcept
34{
35 return static_cast<theme_state>(to_underlying(lhs) | to_underlying(rhs));
36}
37
38constexpr theme_state &operator|=(theme_state &lhs, theme_state const &rhs) noexcept
39{
40 return lhs = lhs | rhs;
41}
42
43// clang-format off
44enum class theme_state_mask : uint8_t {
45 mouse = 0b00'0'0'11,
46 focus = 0b00'0'1'00,
47 value = 0b00'1'0'00,
48 layers = 0b11'0'0'00,
49};
50// clang-format on
51
52[[nodiscard]] constexpr theme_state_mask operator|(theme_state_mask const& lhs, theme_state_mask const& rhs) noexcept
53{
54 return static_cast<theme_state_mask>(to_underlying(lhs) | to_underlying(rhs));
55}
56
57constexpr theme_state_mask& operator|=(theme_state_mask& lhs, theme_state_mask const& rhs) noexcept
58{
59 return lhs = lhs | rhs;
60}
61
62}}
@ mouse
The gui_event has mouse data.
@ disabled
The widget is disabled.
@ enabled
The widget is fully enabled.
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
@ on
The border is drawn on the edge of a quad.
@ off
The widget in the off-state.