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
|
#include "adwaitamm/enums.hpp"
#include <adwaitamm/stylemanager.hpp>
#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>);
} // 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)
#undef VALUE_SPECIALIZATION
} // namespace Glib
|