HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
style_pseudo_class.hpp
1// Copyright Take Vos 2024.
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 "../macros.hpp"
8#include <utility>
9
10hi_export_module(hikogui.theme : style_pseudo_class);
11
12hi_export namespace hi {
13inline namespace v1 {
14
15// clang-format off
23 disabled = 0b0'0'00,
24
29 enabled = 0b0'0'01,
30
35 hover = 0b0'0'10,
36
41 active = 0b0'0'11,
42
45 focus = 0b0'1'00,
46
49 _false = 0b0'0'00,
50
53 _true = 0b1'0'00,
54};
55// clang-format on
56
57constexpr auto style_pseudo_class_size = size_t{16};
58
59[[nodiscard]] constexpr style_pseudo_class operator|(style_pseudo_class const& lhs, style_pseudo_class const& rhs) noexcept
60{
61 return static_cast<style_pseudo_class>(std::to_underlying(lhs) | std::to_underlying(rhs));
62}
63
64[[nodiscard]] constexpr style_pseudo_class operator&(style_pseudo_class const& lhs, style_pseudo_class const& rhs) noexcept
65{
66 return static_cast<style_pseudo_class>(std::to_underlying(lhs) & std::to_underlying(rhs));
67}
68
69constexpr style_pseudo_class& operator|=(style_pseudo_class& lhs, style_pseudo_class const& rhs) noexcept
70{
71 return lhs = lhs | rhs;
72}
73
74constexpr style_pseudo_class& operator&=(style_pseudo_class& lhs, style_pseudo_class const& rhs) noexcept
75{
76 return lhs = lhs & rhs;
77}
78
79[[nodiscard]] constexpr bool to_bool(style_pseudo_class const& rhs) noexcept
80{
81 return static_cast<bool>(std::to_underlying(rhs));
82}
83
84}}
@ enabled
The widget is fully enabled.
Definition widget_state.hpp:81
The HikoGUI namespace.
Definition array_generic.hpp:21
The HikoGUI API version 1.
Definition array_generic.hpp:22
style_pseudo_class
The different dynamic states of a widget from the point of view of styles.
Definition style_pseudo_class.hpp:18
@ focus
The widget has keyboard focus.
Definition style_pseudo_class.hpp:45
@ _false
The value that the widget represent is 'false'.
Definition style_pseudo_class.hpp:49
@ _true
The value that the widget represent is 'true'.
Definition style_pseudo_class.hpp:53