1 /**
2  *@file lv_themes.h
3  *
4  */
5 
6 #ifndef LV_THEMES_H
7 #define LV_THEMES_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *    INCLUDES
15  *********************/
16 #ifdef LV_CONF_INCLUDE_SIMPLE
17 #include "lv_conf.h"
18 #else
19 #include "../../lv_conf.h"
20 #endif
21 
22 #include "../lv_core/lv_style.h"
23 #include "../lv_core/lv_group.h"
24 
25 /*********************
26  *    DEFINES
27  *********************/
28 
29 /**********************
30  *    TYPEDEFS
31  **********************/
32 
33 /**
34  * A theme in LittlevGL consists of many styles bound together.
35  *
36  * There is a style for each object type, as well as a generic style for
37  * backgrounds and panels.
38  */
39 typedef struct
40 {
41     struct
42     {
43         lv_style_t * scr;
44         lv_style_t * bg;
45         lv_style_t * panel;
46 
47 #if LV_USE_CONT != 0
48         lv_style_t * cont;
49 #endif
50 
51 #if LV_USE_BTN != 0
52         struct
53         {
54             lv_style_t * rel;
55             lv_style_t * pr;
56             lv_style_t * tgl_rel;
57             lv_style_t * tgl_pr;
58             lv_style_t * ina;
59         } btn;
60 #endif
61 
62 #if LV_USE_IMGBTN != 0
63         struct
64         {
65             lv_style_t * rel;
66             lv_style_t * pr;
67             lv_style_t * tgl_rel;
68             lv_style_t * tgl_pr;
69             lv_style_t * ina;
70         } imgbtn;
71 #endif
72 
73 #if LV_USE_LABEL != 0
74         struct
75         {
76             lv_style_t * prim;
77             lv_style_t * sec;
78             lv_style_t * hint;
79         } label;
80 #endif
81 
82 #if LV_USE_IMG != 0
83         struct
84         {
85             lv_style_t * light;
86             lv_style_t * dark;
87         } img;
88 #endif
89 
90 #if LV_USE_LINE != 0
91         struct
92         {
93             lv_style_t * decor;
94         } line;
95 #endif
96 
97 #if LV_USE_LED != 0
98         lv_style_t * led;
99 #endif
100 
101 #if LV_USE_BAR != 0
102         struct
103         {
104             lv_style_t * bg;
105             lv_style_t * indic;
106         } bar;
107 #endif
108 
109 #if LV_USE_SLIDER != 0
110         struct
111         {
112             lv_style_t * bg;
113             lv_style_t * indic;
114             lv_style_t * knob;
115         } slider;
116 #endif
117 
118 #if LV_USE_LMETER != 0
119         lv_style_t * lmeter;
120 #endif
121 
122 #if LV_USE_GAUGE != 0
123         lv_style_t * gauge;
124 #endif
125 
126 #if LV_USE_ARC != 0
127         lv_style_t * arc;
128 #endif
129 
130 #if LV_USE_PRELOAD != 0
131         lv_style_t * preload;
132 #endif
133 
134 #if LV_USE_SW != 0
135         struct
136         {
137             lv_style_t * bg;
138             lv_style_t * indic;
139             lv_style_t * knob_off;
140             lv_style_t * knob_on;
141         } sw;
142 #endif
143 
144 #if LV_USE_CHART != 0
145         lv_style_t * chart;
146 #endif
147 
148 #if LV_USE_CALENDAR != 0
149         struct
150         {
151             lv_style_t * bg;
152             lv_style_t * header;
153             lv_style_t * header_pr;
154             lv_style_t * day_names;
155             lv_style_t * highlighted_days;
156             lv_style_t * inactive_days;
157             lv_style_t * week_box;
158             lv_style_t * today_box;
159         } calendar;
160 #endif
161 
162 #if LV_USE_CB != 0
163         struct
164         {
165             lv_style_t * bg;
166             struct
167             {
168                 lv_style_t * rel;
169                 lv_style_t * pr;
170                 lv_style_t * tgl_rel;
171                 lv_style_t * tgl_pr;
172                 lv_style_t * ina;
173             } box;
174         } cb;
175 #endif
176 
177 #if LV_USE_BTNM != 0
178         struct
179         {
180             lv_style_t * bg;
181             struct
182             {
183                 lv_style_t * rel;
184                 lv_style_t * pr;
185                 lv_style_t * tgl_rel;
186                 lv_style_t * tgl_pr;
187                 lv_style_t * ina;
188             } btn;
189         } btnm;
190 #endif
191 
192 #if LV_USE_KB != 0
193         struct
194         {
195             lv_style_t * bg;
196             struct
197             {
198                 lv_style_t * rel;
199                 lv_style_t * pr;
200                 lv_style_t * tgl_rel;
201                 lv_style_t * tgl_pr;
202                 lv_style_t * ina;
203             } btn;
204         } kb;
205 #endif
206 
207 #if LV_USE_MBOX != 0
208         struct
209         {
210             lv_style_t * bg;
211             struct
212             {
213                 lv_style_t * bg;
214                 lv_style_t * rel;
215                 lv_style_t * pr;
216             } btn;
217         } mbox;
218 #endif
219 
220 #if LV_USE_PAGE != 0
221         struct
222         {
223             lv_style_t * bg;
224             lv_style_t * scrl;
225             lv_style_t * sb;
226         } page;
227 #endif
228 
229 #if LV_USE_TA != 0
230         struct
231         {
232             lv_style_t * area;
233             lv_style_t * oneline;
234             lv_style_t * cursor;
235             lv_style_t * sb;
236         } ta;
237 #endif
238 
239 #if LV_USE_SPINBOX != 0
240         struct
241         {
242             lv_style_t * bg;
243             lv_style_t * cursor;
244             lv_style_t * sb;
245         } spinbox;
246 #endif
247 
248 #if LV_USE_LIST
249         struct
250         {
251             lv_style_t * bg;
252             lv_style_t * scrl;
253             lv_style_t * sb;
254             struct
255             {
256                 lv_style_t * rel;
257                 lv_style_t * pr;
258                 lv_style_t * tgl_rel;
259                 lv_style_t * tgl_pr;
260                 lv_style_t * ina;
261             } btn;
262         } list;
263 #endif
264 
265 #if LV_USE_DDLIST != 0
266         struct
267         {
268             lv_style_t * bg;
269             lv_style_t * sel;
270             lv_style_t * sb;
271         } ddlist;
272 #endif
273 
274 #if LV_USE_ROLLER != 0
275         struct
276         {
277             lv_style_t * bg;
278             lv_style_t * sel;
279         } roller;
280 #endif
281 
282 #if LV_USE_TABVIEW != 0
283         struct
284         {
285             lv_style_t * bg;
286             lv_style_t * indic;
287             struct
288             {
289                 lv_style_t * bg;
290                 lv_style_t * rel;
291                 lv_style_t * pr;
292                 lv_style_t * tgl_rel;
293                 lv_style_t * tgl_pr;
294             } btn;
295         } tabview;
296 #endif
297 
298 #if LV_USE_TILEVIEW != 0
299         struct
300         {
301             lv_style_t * bg;
302             lv_style_t * scrl;
303             lv_style_t * sb;
304         } tileview;
305 #endif
306 
307 #if LV_USE_TABLE != 0
308         struct
309         {
310             lv_style_t * bg;
311             lv_style_t * cell;
312         } table;
313 #endif
314 
315 #if LV_USE_WIN != 0
316         struct
317         {
318             lv_style_t * bg;
319             lv_style_t * sb;
320             lv_style_t * header;
321             lv_style_t * content;
322             struct
323             {
324                 lv_style_t * rel;
325                 lv_style_t * pr;
326             } btn;
327         } win;
328 #endif
329     } style;
330 
331 #if LV_USE_GROUP
332     struct
333     {
334         /* The `x` in the names inidicates that inconsistence becasue
335          * the group related function are stored in the theme.*/
336         lv_group_style_mod_cb_t style_mod_xcb;
337         lv_group_style_mod_cb_t style_mod_edit_xcb;
338     } group;
339 #endif
340 } lv_theme_t;
341 
342 /**********************
343  *  GLOBAL PROTOTYPES
344  **********************/
345 
346 /**
347  * Set a theme for the system.
348  * From now, all the created objects will use styles from this theme by default
349  * @param th pointer to theme (return value of: 'lv_theme_init_xxx()')
350  */
351 void lv_theme_set_current(lv_theme_t * th);
352 
353 /**
354  * Get the current system theme.
355  * @return pointer to the current system theme. NULL if not set.
356  */
357 lv_theme_t * lv_theme_get_current(void);
358 
359 /**********************
360  *    MACROS
361  **********************/
362 
363 /* Returns number of styles within the `lv_theme_t` structure. */
364 #define LV_THEME_STYLE_COUNT (sizeof(((lv_theme_t *)0)->style) / sizeof(lv_style_t *))
365 
366 /**********************
367  *     POST INCLUDE
368  *********************/
369 #include "lv_theme_templ.h"
370 #include "lv_theme_default.h"
371 #include "lv_theme_alien.h"
372 #include "lv_theme_night.h"
373 #include "lv_theme_zen.h"
374 #include "lv_theme_mono.h"
375 #include "lv_theme_nemo.h"
376 #include "lv_theme_material.h"
377 
378 #ifdef __cplusplus
379 } /* extern "C" */
380 #endif
381 
382 #endif /*LV_THEMES_H*/
383