diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-02 21:41:56 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-02 21:41:56 +1000 |
| commit | 7d7f7755d17e1e0a2348d75d797097f166b70471 (patch) | |
| tree | 1129eef470a90fc954a0c6f281e8d94fe0339101 /src/tangara/ui/themes.cpp | |
| parent | 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (diff) | |
| download | tangara-fw-7d7f7755d17e1e0a2348d75d797097f166b70471.tar.gz | |
start moving include files into subdirs
Diffstat (limited to 'src/tangara/ui/themes.cpp')
| -rw-r--r-- | src/tangara/ui/themes.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/tangara/ui/themes.cpp b/src/tangara/ui/themes.cpp index b13f226a..44638c55 100644 --- a/src/tangara/ui/themes.cpp +++ b/src/tangara/ui/themes.cpp @@ -1,4 +1,4 @@ -#include "themes.hpp" +#include "ui/themes.hpp" #include "core/lv_obj.h" #include "core/lv_obj_style.h" #include "core/lv_obj_tree.h" @@ -35,9 +35,9 @@ void Theme::Apply(void) { void Theme::Callback(lv_obj_t* obj) { // Find and apply base styles if (auto search = style_map.find("base"); search != style_map.end()) { - for (const auto& pair : search->second) { - lv_obj_add_style(obj, pair.second, pair.first); - } + for (const auto& pair : search->second) { + lv_obj_add_style(obj, pair.second, pair.first); + } } // Determine class name @@ -60,19 +60,18 @@ void Theme::Callback(lv_obj_t* obj) { // Apply all styles from class if (auto search = style_map.find(class_name); search != style_map.end()) { - for (const auto& pair : search->second) { - lv_obj_add_style(obj, pair.second, pair.first); - } + for (const auto& pair : search->second) { + lv_obj_add_style(obj, pair.second, pair.first); + } } - } void Theme::ApplyStyle(lv_obj_t* obj, std::string style_key) { if (auto search = style_map.find(style_key); search != style_map.end()) { - for (const auto& pair : search->second) { - lv_obj_remove_style(obj, pair.second, pair.first); - lv_obj_add_style(obj, pair.second, pair.first); - } + for (const auto& pair : search->second) { + lv_obj_remove_style(obj, pair.second, pair.first); + lv_obj_add_style(obj, pair.second, pair.first); + } } } @@ -85,7 +84,7 @@ void Theme::AddStyle(std::string key, int selector, lv_style_t* style) { style_map.try_emplace(key, std::vector<std::pair<int, lv_style_t*>>{}); if (auto search = style_map.find(key); search != style_map.end()) { // Key exists - auto &vec = search->second; + auto& vec = search->second; // Add it to the list vec.push_back(std::make_pair(selector, style)); } |
