|
RADLib
RADical C++ application framework
|
Process/application theme manager with RADCore events. More...
#include <RADTheme.h>
Inheritance diagram for RADUi::ThemeManager:
Collaboration diagram for RADUi::ThemeManager:Public Member Functions | |
| ThemeManager () | |
| Creates a manager using the default light theme. More... | |
| ThemeMode | mode () const |
| Returns current mode. More... | |
| void | setMode (ThemeMode mode) |
| Sets current theme mode. More... | |
| const Theme & | theme () const |
| Returns active theme tokens. More... | |
| void | setTheme (Theme theme) |
| Replaces active theme tokens. More... | |
| bool | loadFromFile (const std::string &path, std::string *error=nullptr) |
| Loads theme JSON from path. More... | |
| bool | saveToFile (const std::string &path, std::string *error=nullptr) const |
| Saves current theme JSON to path. More... | |
Public Member Functions inherited from RADCore::RADObject | |
| RADObject () | |
| Creates a RADObject bound to the current thread. More... | |
| virtual | ~RADObject () |
| Disconnects tracked event links and releases lifetime token. More... | |
| void | registerLink (const ConnectionRecord &record) |
| Registers a connection for cleanup when this object is destroyed. More... | |
| std::thread::id | threadId () const |
| Returns the thread id this object is currently associated with. More... | |
| EventLoop * | associatedEventLoop () const |
| Returns the associated event loop, if any. More... | |
| ThreadAffinity | threadAffinity () const |
| Returns both thread id and associated loop atomically. More... | |
| std::weak_ptr< void > | lifetimeToken () const |
| Returns a weak token used to drop queued callbacks after destruction. More... | |
| void | moveToThread (std::thread::id tId, EventLoop *loop=nullptr) |
| Moves the object's affinity to tId and optional loop. More... | |
Static Public Member Functions | |
| static Theme | lightTheme () |
| Returns RADUi's default light theme. More... | |
| static Theme | darkTheme () |
| Returns RADUi's default dark theme. More... | |
| static RADCore::RADJsonValue | toJson (const Theme &theme) |
| Converts a theme to JSON. More... | |
| static Theme | fromJson (const RADCore::RADJsonValue &value, const Theme &defaults=lightTheme()) |
| Converts JSON to a theme, using defaults for missing fields. More... | |
| static std::string | modeName (ThemeMode mode) |
| Converts ThemeMode to stable text. More... | |
| static ThemeMode | modeFromName (const std::string &name) |
| Parses ThemeMode text. More... | |
Public Attributes | |
| RADCore::Event< void() > | changed |
| Raised when mode or theme tokens change. More... | |
Process/application theme manager with RADCore events.
| RADUi::ThemeManager::ThemeManager | ( | ) |
Creates a manager using the default light theme.
|
static |
Converts JSON to a theme, using defaults for missing fields.
| bool RADUi::ThemeManager::loadFromFile | ( | const std::string & | path, |
| std::string * | error = nullptr |
||
| ) |
Loads theme JSON from path.
| ThemeMode RADUi::ThemeManager::mode | ( | ) | const |
Returns current mode.
|
static |
Parses ThemeMode text.
|
static |
Converts ThemeMode to stable text.
| bool RADUi::ThemeManager::saveToFile | ( | const std::string & | path, |
| std::string * | error = nullptr |
||
| ) | const |
Saves current theme JSON to path.
| void RADUi::ThemeManager::setMode | ( | ThemeMode | mode | ) |
Sets current theme mode.
| void RADUi::ThemeManager::setTheme | ( | Theme | theme | ) |
Replaces active theme tokens.
| const Theme& RADUi::ThemeManager::theme | ( | ) | const |
Returns active theme tokens.
|
static |
Converts a theme to JSON.
| RADCore::Event<void () > RADUi::ThemeManager::changed |
Raised when mode or theme tokens change.