1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include "adwaitamm/enums.hpp"
#include <adwaitamm/stylemanager.hpp>
#include <adwaita.h>
#include <glib-object.h>
#include <type_traits>
namespace
{
template<auto Wrapped, auto Unwrapped>
auto constexpr matches =
static_cast<std::underlying_type_t<decltype(Wrapped)>>(Wrapped) == static_cast<std::underlying_type_t<decltype(Unwrapped)>>(Unwrapped);
} // namespace
namespace Adwaita
{
static_assert(matches<AccentColor::Blue, ADW_ACCENT_COLOR_BLUE>);
static_assert(matches<AccentColor::Teal, ADW_ACCENT_COLOR_TEAL>);
static_assert(matches<AccentColor::Green, ADW_ACCENT_COLOR_GREEN>);
static_assert(matches<AccentColor::Yellow, ADW_ACCENT_COLOR_YELLOW>);
static_assert(matches<AccentColor::Orange, ADW_ACCENT_COLOR_ORANGE>);
static_assert(matches<AccentColor::Red, ADW_ACCENT_COLOR_RED>);
static_assert(matches<AccentColor::Pink, ADW_ACCENT_COLOR_PINK>);
static_assert(matches<AccentColor::Purple, ADW_ACCENT_COLOR_PURPLE>);
static_assert(matches<AccentColor::Slate, ADW_ACCENT_COLOR_SLATE>);
static_assert(matches<ColorScheme::Default, ADW_COLOR_SCHEME_DEFAULT>);
static_assert(matches<ColorScheme::ForceLight, ADW_COLOR_SCHEME_FORCE_LIGHT>);
static_assert(matches<ColorScheme::PreferLight, ADW_COLOR_SCHEME_PREFER_LIGHT>);
static_assert(matches<ColorScheme::PreferDark, ADW_COLOR_SCHEME_PREFER_DARK>);
static_assert(matches<ColorScheme::ForceDark, ADW_COLOR_SCHEME_FORCE_DARK>);
static_assert(matches<LengthType::MinWidth, ADW_BREAKPOINT_CONDITION_MIN_WIDTH>);
static_assert(matches<LengthType::MaxWidth, ADW_BREAKPOINT_CONDITION_MAX_WIDTH>);
static_assert(matches<LengthType::MinHeight, ADW_BREAKPOINT_CONDITION_MIN_HEIGHT>);
static_assert(matches<LengthType::MaxHeight, ADW_BREAKPOINT_CONDITION_MAX_HEIGHT>);
static_assert(matches<RatioType::MinAspectRatio, ADW_BREAKPOINT_CONDITION_MIN_ASPECT_RATIO>);
static_assert(matches<RatioType::MaxAspectRatio, ADW_BREAKPOINT_CONDITION_MAX_ASPECT_RATIO>);
static_assert(matches<ResponseAppearance::Default, ADW_RESPONSE_DEFAULT>);
static_assert(matches<ResponseAppearance::Suggested, ADW_RESPONSE_SUGGESTED>);
static_assert(matches<ResponseAppearance::Destructive, ADW_RESPONSE_DESTRUCTIVE>);
static_assert(matches<ToastPriority::Normal, ADW_TOAST_PRIORITY_NORMAL>);
static_assert(matches<ToastPriority::High, ADW_TOAST_PRIORITY_HIGH>);
} // namespace Adwaita
namespace Glib
{
#define VALUE_SPECIALIZATION(Enum, AdwEnumName) \
auto Value<Adwaita::Enum>::value_type() -> GType \
{ \
return adw_##AdwEnumName##_get_type(); \
}
VALUE_SPECIALIZATION(AccentColor, accent_color)
VALUE_SPECIALIZATION(ColorScheme, color_scheme)
VALUE_SPECIALIZATION(LengthType, breakpoint_condition)
VALUE_SPECIALIZATION(RatioType, breakpoint_condition)
VALUE_SPECIALIZATION(ResponseAppearance, response_appearance)
VALUE_SPECIALIZATION(ToastPriority, toast_priority)
#undef VALUE_SPECIALIZATION
} // namespace Glib
|