HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
callback_flags.hpp
1// Copyright Take Vos 2020.
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 "cast.hpp"
8#include "assert.hpp"
9
10namespace hi::inline v1 {
11
12enum class callback_flags {
15 synchronous = 0x00,
16
19 local = 0x01,
20
23 main = 0x02,
24
27 timer = 0x03,
28
31 once = 0x1'00,
32};
33
34[[nodiscard]] constexpr callback_flags operator|(callback_flags const &lhs, callback_flags const &rhs) noexcept
35{
36 hi_axiom((to_underlying(lhs) & 0xff) == 0 or (to_underlying(rhs) & 0xff) == 0);
37 return static_cast<callback_flags>(to_underlying(lhs) | to_underlying(rhs));
38}
39
40[[nodiscard]] constexpr bool is_once(callback_flags const &rhs) noexcept
41{
42 return to_bool(to_underlying(rhs) & to_underlying(callback_flags::once));
43}
44
45[[nodiscard]] constexpr bool is_synchronous(callback_flags const& rhs) noexcept
46{
47 return to_bool((to_underlying(rhs) & 0xff) == to_underlying(callback_flags::synchronous));
48}
49
50[[nodiscard]] constexpr bool is_local(callback_flags const& rhs) noexcept
51{
52 return to_bool((to_underlying(rhs) & 0xff) == to_underlying(callback_flags::local));
53}
54
55[[nodiscard]] constexpr bool is_main(callback_flags const& rhs) noexcept
56{
57 return to_bool((to_underlying(rhs) & 0xff) == to_underlying(callback_flags::main));
58}
59
60[[nodiscard]] constexpr bool is_timer(callback_flags const& rhs) noexcept
61{
62 return to_bool((to_underlying(rhs) & 0xff) == to_underlying(callback_flags::timer));
63}
64
65}
constexpr alignment operator|(horizontal_alignment lhs, vertical_alignment rhs) noexcept
Combine vertical and horizontal alignment.
Definition alignment.hpp:200