5#ifndef MALENA_THEMEMANAGER_H
6#define MALENA_THEMEMANAGER_H
98 template<
typename MANIFEST>
99 static void apply(
typename MANIFEST::Themes themeKey)
102 applyTheme(
static_cast<const Theme&
>(tag));
116 static void set(
const T& theme)
118 static_assert(std::is_base_of_v<Theme, T>,
119 "ThemeManager::set() requires a type derived from ml::Theme");
120 _active = std::make_unique<T>(theme);
154 static void applyTheme(
const Theme& theme);
163 static void notify();
165 inline static std::unique_ptr<Theme> _active = std::make_unique<DarkTheme>();
166 inline static std::vector<Themeable*> _subscribers = {};
167 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 stored in a Manifest enum.
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.