blob: 8d3f2c6e0741a83c78daeac222d67f5f3635bac2 (
plain)
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
|
// SPDX-FileCopyrightText: 2023 ailurux <ailuruxx@gmail.com>
//
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "lvgl.h"
namespace ui {
namespace themes {
enum class Style {
kMenuItem,
kMenuSubheadFirst,
kMenuSubhead,
kTopBar,
kPopup,
kTab,
kButtonPrimary,
};
class Theme {
public:
void Apply(void);
void Callback(lv_obj_t* obj);
void ApplyStyle(lv_obj_t* obj, std::string style_key);
void AddStyle(std::string key, int selector, lv_style_t* style);
void Reset();
static auto instance() -> Theme*;
private:
Theme();
std::map<std::string, std::vector<std::pair<int, lv_style_t*>>> style_map;
lv_theme_t theme_;
std::optional<std::string> filename_;
};
} // namespace themes
} // namespace ui
|