5#ifndef MALENA_THEMEMANAGER_H
6#define MALENA_THEMEMANAGER_H
85 template<
typename MANIFEST>
86 static void apply(
typename MANIFEST::Themes themeKey)
89 applyTheme(
static_cast<const Theme&
>(tag));
103 static void set(
const T& theme)
105 static_assert(std::is_base_of_v<Theme, T>,
106 "ThemeManager::set() requires a type derived from ml::Theme");
107 _active = std::make_unique<T>(theme);
141 static void applyTheme(
const Theme& theme);
150 static void notify();
152 inline static std::unique_ptr<Theme> _active = std::make_unique<DarkTheme>();
153 inline static std::vector<Themeable*> _subscribers = {};
154 inline static bool _destroyed =
false;
CRTP base that gives a manager safe deferred-operation support.
static const ThemeTag & getTheme(EnumType key)
Retrieve a theme stored via set(key, ThemeDerived{}).
Global manager for the active Theme.
static void subscribe(Themeable *component)
Subscribe a component to theme change notifications.
static void unsubscribe(Themeable *component)
Unsubscribe a component from theme change notifications.
static void set(const T &theme)
Apply a theme instance directly without a manifest.
static void shutdown()
Shut down the theme system.
static void apply(typename MANIFEST::Themes themeKey)
Apply a theme registered via Manifest::set().
static const Theme & get()
Return a const reference to the currently active theme.
Trait that makes a component react to global theme changes.
Universal design token set applied across all Themeable components.
Lightweight polymorphic base for all Theme structs.