1 /**
2  * @file lv_theme_mono.c
3  *
4  */
5 
6 /*********************
7  *      INCLUDES
8  *********************/
9 #include "../lv_theme_private.h"
10 #include "../../../lvgl.h"
11 
12 #if LV_USE_THEME_MONO
13 
14 #include "lv_theme_mono.h"
15 #include "../../core/lv_global.h"
16 
17 /*********************
18  *      DEFINES
19  *********************/
20 struct _my_theme_t;
21 typedef struct _my_theme_t my_theme_t;
22 
23 #define theme_def (*(my_theme_t **)(&LV_GLOBAL_DEFAULT()->theme_mono))
24 
25 #define COLOR_FG      dark_bg ? lv_color_white() : lv_color_black()
26 #define COLOR_BG      dark_bg ? lv_color_black() : lv_color_white()
27 
28 #define BORDER_W_NORMAL  1
29 #define BORDER_W_PR      3
30 #define BORDER_W_DIS     0
31 #define BORDER_W_FOCUS   1
32 #define BORDER_W_EDIT    2
33 #define PAD_DEF          4
34 
35 /**********************
36  *      TYPEDEFS
37  **********************/
38 typedef struct {
39     lv_style_t scr;
40     lv_style_t card;
41     lv_style_t scrollbar;
42     lv_style_t pr;
43     lv_style_t inv;
44     lv_style_t disabled;
45     lv_style_t focus;
46     lv_style_t edit;
47     lv_style_t pad_gap;
48     lv_style_t pad_zero;
49     lv_style_t no_radius;
50     lv_style_t radius_circle;
51     lv_style_t large_border;
52     lv_style_t large_line_space;
53     lv_style_t underline;
54 #if LV_USE_TEXTAREA
55     lv_style_t ta_cursor;
56 #endif
57 #if LV_USE_CHART
58     lv_style_t chart_indic;
59 #endif
60 } my_theme_styles_t;
61 
62 struct _my_theme_t {
63     lv_theme_t base;
64     my_theme_styles_t styles;
65     bool inited;
66 };
67 
68 /**********************
69  *  STATIC PROTOTYPES
70  **********************/
71 static void style_init_reset(lv_style_t * style);
72 static void theme_apply(lv_theme_t * th, lv_obj_t * obj);
73 
74 /**********************
75  *  STATIC VARIABLES
76  **********************/
77 
78 /**********************
79  *      MACROS
80  **********************/
81 
82 /**********************
83  *   STATIC FUNCTIONS
84  **********************/
85 
style_init(my_theme_t * theme,bool dark_bg,const lv_font_t * font)86 static void style_init(my_theme_t * theme, bool dark_bg, const lv_font_t * font)
87 {
88     style_init_reset(&theme->styles.scrollbar);
89     lv_style_set_bg_opa(&theme->styles.scrollbar, LV_OPA_COVER);
90     lv_style_set_bg_color(&theme->styles.scrollbar, COLOR_FG);
91     lv_style_set_width(&theme->styles.scrollbar,  PAD_DEF);
92 
93     style_init_reset(&theme->styles.scr);
94     lv_style_set_bg_opa(&theme->styles.scr, LV_OPA_COVER);
95     lv_style_set_bg_color(&theme->styles.scr, COLOR_BG);
96     lv_style_set_text_color(&theme->styles.scr, COLOR_FG);
97     lv_style_set_pad_row(&theme->styles.scr, PAD_DEF);
98     lv_style_set_pad_column(&theme->styles.scr, PAD_DEF);
99     lv_style_set_text_font(&theme->styles.scr, font);
100 
101     style_init_reset(&theme->styles.card);
102     lv_style_set_bg_opa(&theme->styles.card, LV_OPA_COVER);
103     lv_style_set_bg_color(&theme->styles.card, COLOR_BG);
104     lv_style_set_border_color(&theme->styles.card, COLOR_FG);
105     lv_style_set_radius(&theme->styles.card, 2);
106     lv_style_set_border_width(&theme->styles.card, BORDER_W_NORMAL);
107     lv_style_set_pad_all(&theme->styles.card, PAD_DEF);
108     lv_style_set_pad_gap(&theme->styles.card, PAD_DEF);
109     lv_style_set_text_color(&theme->styles.card, COLOR_FG);
110     lv_style_set_line_width(&theme->styles.card, 2);
111     lv_style_set_line_color(&theme->styles.card, COLOR_FG);
112     lv_style_set_arc_width(&theme->styles.card, 2);
113     lv_style_set_arc_color(&theme->styles.card, COLOR_FG);
114     lv_style_set_outline_color(&theme->styles.card, COLOR_FG);
115     lv_style_set_anim_duration(&theme->styles.card, 300);
116 
117     style_init_reset(&theme->styles.pr);
118     lv_style_set_border_width(&theme->styles.pr, BORDER_W_PR);
119 
120     style_init_reset(&theme->styles.inv);
121     lv_style_set_bg_opa(&theme->styles.inv, LV_OPA_COVER);
122     lv_style_set_bg_color(&theme->styles.inv, COLOR_FG);
123     lv_style_set_border_color(&theme->styles.inv, COLOR_BG);
124     lv_style_set_line_color(&theme->styles.inv, COLOR_BG);
125     lv_style_set_arc_color(&theme->styles.inv, COLOR_BG);
126     lv_style_set_text_color(&theme->styles.inv, COLOR_BG);
127     lv_style_set_outline_color(&theme->styles.inv, COLOR_BG);
128 
129     style_init_reset(&theme->styles.disabled);
130     lv_style_set_border_width(&theme->styles.disabled, BORDER_W_DIS);
131 
132     style_init_reset(&theme->styles.focus);
133     lv_style_set_outline_width(&theme->styles.focus, 1);
134     lv_style_set_outline_pad(&theme->styles.focus, BORDER_W_FOCUS);
135 
136     style_init_reset(&theme->styles.edit);
137     lv_style_set_outline_width(&theme->styles.edit, BORDER_W_EDIT);
138 
139     style_init_reset(&theme->styles.large_border);
140     lv_style_set_border_width(&theme->styles.large_border, BORDER_W_EDIT);
141 
142     style_init_reset(&theme->styles.pad_gap);
143     lv_style_set_pad_gap(&theme->styles.pad_gap, PAD_DEF);
144 
145     style_init_reset(&theme->styles.pad_zero);
146     lv_style_set_pad_all(&theme->styles.pad_zero, 0);
147     lv_style_set_pad_gap(&theme->styles.pad_zero, 0);
148 
149     style_init_reset(&theme->styles.no_radius);
150     lv_style_set_radius(&theme->styles.no_radius, 0);
151 
152     style_init_reset(&theme->styles.radius_circle);
153     lv_style_set_radius(&theme->styles.radius_circle, LV_RADIUS_CIRCLE);
154 
155     style_init_reset(&theme->styles.large_line_space);
156     lv_style_set_text_line_space(&theme->styles.large_line_space, 6);
157 
158     style_init_reset(&theme->styles.underline);
159     lv_style_set_text_decor(&theme->styles.underline, LV_TEXT_DECOR_UNDERLINE);
160 
161 #if LV_USE_TEXTAREA
162     style_init_reset(&theme->styles.ta_cursor);
163     lv_style_set_border_side(&theme->styles.ta_cursor, LV_BORDER_SIDE_LEFT);
164     lv_style_set_border_color(&theme->styles.ta_cursor, COLOR_FG);
165     lv_style_set_border_width(&theme->styles.ta_cursor, 2);
166     lv_style_set_bg_opa(&theme->styles.ta_cursor, LV_OPA_TRANSP);
167     lv_style_set_anim_duration(&theme->styles.ta_cursor, 500);
168 #endif
169 
170 #if LV_USE_CHART
171     style_init_reset(&theme->styles.chart_indic);
172     lv_style_set_radius(&theme->styles.chart_indic, LV_RADIUS_CIRCLE);
173     lv_style_set_size(&theme->styles.chart_indic, lv_display_dpx(theme->base.disp, 8), lv_display_dpx(theme->base.disp, 8));
174     lv_style_set_bg_color(&theme->styles.chart_indic, COLOR_FG);
175     lv_style_set_bg_opa(&theme->styles.chart_indic, LV_OPA_COVER);
176 #endif
177 }
178 
179 /**********************
180  *   GLOBAL FUNCTIONS
181  **********************/
182 
lv_theme_mono_is_inited(void)183 bool lv_theme_mono_is_inited(void)
184 {
185     my_theme_t * theme = theme_def;
186     if(theme == NULL) return false;
187     return theme->inited;
188 }
189 
lv_theme_mono_deinit(void)190 void lv_theme_mono_deinit(void)
191 {
192     my_theme_t * theme = theme_def;
193     if(theme) {
194         if(theme->inited) {
195             lv_style_t * theme_styles = (lv_style_t *)(&(theme->styles));
196             uint32_t i;
197             for(i = 0; i < sizeof(my_theme_styles_t) / sizeof(lv_style_t); i++) {
198                 lv_style_reset(theme_styles + i);
199             }
200         }
201         lv_free(theme_def);
202         theme_def = NULL;
203     }
204 }
205 
lv_theme_mono_init(lv_display_t * disp,bool dark_bg,const lv_font_t * font)206 lv_theme_t * lv_theme_mono_init(lv_display_t * disp, bool dark_bg, const lv_font_t * font)
207 {
208     /*This trick is required only to avoid the garbage collection of
209      *styles' data if LVGL is used in a binding (e.g. MicroPython)
210      *In a general case styles could be in simple `static lv_style_t my_style...` variables*/
211     if(!lv_theme_mono_is_inited()) {
212         theme_def = lv_malloc_zeroed(sizeof(my_theme_t));
213     }
214 
215     my_theme_t * theme = theme_def;
216 
217     theme->base.disp = disp;
218     theme->base.font_small = LV_FONT_DEFAULT;
219     theme->base.font_normal = LV_FONT_DEFAULT;
220     theme->base.font_large = LV_FONT_DEFAULT;
221     theme->base.apply_cb = theme_apply;
222 
223     style_init(theme, dark_bg, font);
224 
225     if(disp == NULL || lv_display_get_theme(disp) == (lv_theme_t *) theme) lv_obj_report_style_change(NULL);
226 
227     theme->inited = true;
228 
229     return (lv_theme_t *)theme_def;
230 }
231 
theme_apply(lv_theme_t * th,lv_obj_t * obj)232 static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
233 {
234     LV_UNUSED(th);
235 
236     my_theme_t * theme = theme_def;
237     lv_obj_t * parent = lv_obj_get_parent(obj);
238 
239     if(parent == NULL) {
240         lv_obj_add_style(obj, &theme->styles.scr, 0);
241         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
242         return;
243     }
244 
245     if(lv_obj_check_type(obj, &lv_obj_class)) {
246 #if LV_USE_TABVIEW
247         /*Tabview content area*/
248         if(lv_obj_check_type(parent, &lv_tabview_class)) {
249             return;
250         }
251         /*Tabview pages*/
252         else if(lv_obj_check_type(lv_obj_get_parent(parent), &lv_tabview_class)) {
253             lv_obj_add_style(obj, &theme->styles.card, 0);
254             lv_obj_add_style(obj, &theme->styles.no_radius, 0);
255             lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
256             return;
257         }
258 #endif
259 
260 #if LV_USE_WIN
261         /*Header*/
262         if(lv_obj_check_type(parent, &lv_win_class) && lv_obj_get_child(parent, 0) == 0) {
263             lv_obj_add_style(obj, &theme->styles.card, 0);
264             lv_obj_add_style(obj, &theme->styles.no_radius, 0);
265             return;
266         }
267         /*Content*/
268         else if(lv_obj_check_type(parent, &lv_win_class) && lv_obj_get_child(parent, 1) == obj) {
269             lv_obj_add_style(obj, &theme->styles.card, 0);
270             lv_obj_add_style(obj, &theme->styles.no_radius, 0);
271             lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
272             return;
273         }
274 #endif
275         lv_obj_add_style(obj, &theme->styles.card, 0);
276         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
277     }
278 #if LV_USE_BUTTON
279     else if(lv_obj_check_type(obj, &lv_button_class)) {
280         lv_obj_add_style(obj, &theme->styles.card, 0);
281         lv_obj_add_style(obj, &theme->styles.pr, LV_STATE_PRESSED);
282         lv_obj_add_style(obj, &theme->styles.inv, LV_STATE_CHECKED);
283         lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
284         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
285         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
286     }
287 #endif
288 
289 #if LV_USE_BUTTONMATRIX
290     else if(lv_obj_check_type(obj, &lv_buttonmatrix_class)) {
291 #if LV_USE_MSGBOX
292         if(lv_obj_check_type(parent, &lv_msgbox_class)) {
293             lv_obj_add_style(obj, &theme->styles.pad_gap, 0);
294             lv_obj_add_style(obj, &theme->styles.card, LV_PART_ITEMS);
295             lv_obj_add_style(obj, &theme->styles.pr, LV_PART_ITEMS | LV_STATE_PRESSED);
296             lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
297             lv_obj_add_style(obj, &theme->styles.underline, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
298             lv_obj_add_style(obj, &theme->styles.large_border, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
299             return;
300         }
301 #endif
302 #if LV_USE_TABVIEW
303         if(lv_obj_check_type(parent, &lv_tabview_class)) {
304             lv_obj_add_style(obj, &theme->styles.pad_gap, 0);
305             lv_obj_add_style(obj, &theme->styles.card, LV_PART_ITEMS);
306             lv_obj_add_style(obj, &theme->styles.pr, LV_PART_ITEMS | LV_STATE_PRESSED);
307             lv_obj_add_style(obj, &theme->styles.inv, LV_PART_ITEMS | LV_STATE_CHECKED);
308             lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
309             lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
310             lv_obj_add_style(obj, &theme->styles.underline, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
311             lv_obj_add_style(obj, &theme->styles.large_border, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
312             return;
313         }
314 #endif
315         lv_obj_add_style(obj, &theme->styles.card, 0);
316         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
317         lv_obj_add_style(obj, &theme->styles.card, LV_PART_ITEMS);
318         lv_obj_add_style(obj, &theme->styles.pr, LV_PART_ITEMS | LV_STATE_PRESSED);
319         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_ITEMS | LV_STATE_CHECKED);
320         lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
321         lv_obj_add_style(obj, &theme->styles.underline, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
322         lv_obj_add_style(obj, &theme->styles.large_border, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
323     }
324 #endif
325 
326 #if LV_USE_BAR
327     else if(lv_obj_check_type(obj, &lv_bar_class)) {
328         lv_obj_add_style(obj, &theme->styles.card, 0);
329         lv_obj_add_style(obj, &theme->styles.pad_zero, 0);
330         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_INDICATOR);
331         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
332     }
333 #endif
334 
335 #if LV_USE_SLIDER
336     else if(lv_obj_check_type(obj, &lv_slider_class)) {
337         lv_obj_add_style(obj, &theme->styles.card, 0);
338         lv_obj_add_style(obj, &theme->styles.pad_zero, 0);
339         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_INDICATOR);
340         lv_obj_add_style(obj, &theme->styles.card, LV_PART_KNOB);
341         lv_obj_add_style(obj, &theme->styles.radius_circle, LV_PART_KNOB);
342         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
343         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
344     }
345 #endif
346 
347 #if LV_USE_TABLE
348     else if(lv_obj_check_type(obj, &lv_table_class)) {
349         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
350         lv_obj_add_style(obj, &theme->styles.card, LV_PART_ITEMS);
351         lv_obj_add_style(obj, &theme->styles.no_radius, LV_PART_ITEMS);
352         lv_obj_add_style(obj, &theme->styles.pr, LV_PART_ITEMS | LV_STATE_PRESSED);
353         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
354         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
355         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
356     }
357 #endif
358 
359 #if LV_USE_CHECKBOX
360     else if(lv_obj_check_type(obj, &lv_checkbox_class)) {
361         lv_obj_add_style(obj, &theme->styles.pad_gap, LV_PART_MAIN);
362         lv_obj_add_style(obj, &theme->styles.card, LV_PART_INDICATOR);
363         lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_INDICATOR | LV_STATE_DISABLED);
364         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_INDICATOR | LV_STATE_CHECKED);
365         lv_obj_add_style(obj, &theme->styles.pr, LV_PART_INDICATOR | LV_STATE_PRESSED);
366         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
367         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
368     }
369 #endif
370 
371 #if LV_USE_SWITCH
372     else if(lv_obj_check_type(obj, &lv_switch_class)) {
373         lv_obj_add_style(obj, &theme->styles.card, 0);
374         lv_obj_add_style(obj, &theme->styles.radius_circle, 0);
375         lv_obj_add_style(obj, &theme->styles.pad_zero, 0);
376         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_INDICATOR);
377         lv_obj_add_style(obj, &theme->styles.radius_circle, LV_PART_INDICATOR);
378         lv_obj_add_style(obj, &theme->styles.card, LV_PART_KNOB);
379         lv_obj_add_style(obj, &theme->styles.radius_circle, LV_PART_KNOB);
380         lv_obj_add_style(obj, &theme->styles.pad_zero, LV_PART_KNOB);
381         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
382         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
383     }
384 #endif
385 
386 #if LV_USE_CHART
387     else if(lv_obj_check_type(obj, &lv_chart_class)) {
388         lv_obj_add_style(obj, &theme->styles.card, 0);
389         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
390         lv_obj_add_style(obj, &theme->styles.chart_indic, LV_PART_INDICATOR);
391         lv_obj_add_style(obj, &theme->styles.card, LV_PART_ITEMS);
392         lv_obj_add_style(obj, &theme->styles.card, LV_PART_CURSOR);
393         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
394     }
395 #endif
396 
397 #if LV_USE_ROLLER
398     else if(lv_obj_check_type(obj, &lv_roller_class)) {
399         lv_obj_add_style(obj, &theme->styles.card, 0);
400         lv_obj_add_style(obj, &theme->styles.large_line_space, 0);
401         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_SELECTED);
402         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
403         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
404     }
405 #endif
406 
407 #if LV_USE_DROPDOWN
408     else if(lv_obj_check_type(obj, &lv_dropdown_class)) {
409         lv_obj_add_style(obj, &theme->styles.card, 0);
410         lv_obj_add_style(obj, &theme->styles.pr, LV_STATE_PRESSED);
411         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
412         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
413     }
414     else if(lv_obj_check_type(obj, &lv_dropdownlist_class)) {
415         lv_obj_add_style(obj, &theme->styles.card, 0);
416         lv_obj_add_style(obj, &theme->styles.large_line_space, 0);
417         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
418         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_SELECTED | LV_STATE_CHECKED);
419         lv_obj_add_style(obj, &theme->styles.pr, LV_PART_SELECTED | LV_STATE_PRESSED);
420         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
421         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
422     }
423 #endif
424 
425 #if LV_USE_ARC
426     else if(lv_obj_check_type(obj, &lv_arc_class)) {
427         lv_obj_add_style(obj, &theme->styles.card, 0);
428         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_INDICATOR);
429         lv_obj_add_style(obj, &theme->styles.pad_zero, LV_PART_INDICATOR);
430         lv_obj_add_style(obj, &theme->styles.card, LV_PART_KNOB);
431         lv_obj_add_style(obj, &theme->styles.radius_circle, LV_PART_KNOB);
432         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
433         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
434     }
435 #endif
436 
437 #if LV_USE_TEXTAREA
438     else if(lv_obj_check_type(obj, &lv_textarea_class)) {
439         lv_obj_add_style(obj, &theme->styles.card, 0);
440         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
441         lv_obj_add_style(obj, &theme->styles.ta_cursor, LV_PART_CURSOR | LV_STATE_FOCUSED);
442         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUSED);
443         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
444     }
445 #endif
446 
447 #if LV_USE_CALENDAR
448     else if(lv_obj_check_type(obj, &lv_calendar_class)) {
449         lv_obj_add_style(obj, &theme->styles.card, 0);
450         lv_obj_add_style(obj, &theme->styles.no_radius, 0);
451         lv_obj_add_style(obj, &theme->styles.pr, LV_PART_ITEMS | LV_STATE_PRESSED);
452         lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
453         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
454         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
455         lv_obj_add_style(obj, &theme->styles.large_border, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
456     }
457 #endif
458 
459 #if LV_USE_KEYBOARD
460     else if(lv_obj_check_type(obj, &lv_keyboard_class)) {
461         lv_obj_add_style(obj, &theme->styles.card, 0);
462         lv_obj_add_style(obj, &theme->styles.card, LV_PART_ITEMS);
463         lv_obj_add_style(obj, &theme->styles.pr, LV_PART_ITEMS | LV_STATE_PRESSED);
464         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_ITEMS | LV_STATE_CHECKED);
465         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
466         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
467         lv_obj_add_style(obj, &theme->styles.large_border, LV_PART_ITEMS | LV_STATE_EDITED);
468     }
469 #endif
470 #if LV_USE_LIST
471     else if(lv_obj_check_type(obj, &lv_list_class)) {
472         lv_obj_add_style(obj, &theme->styles.card, 0);
473         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
474         return;
475     }
476     else if(lv_obj_check_type(obj, &lv_list_text_class)) {
477 
478     }
479     else if(lv_obj_check_type(obj, &lv_list_button_class)) {
480         lv_obj_add_style(obj, &theme->styles.card, 0);
481         lv_obj_add_style(obj, &theme->styles.pr, LV_STATE_PRESSED);
482         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
483         lv_obj_add_style(obj, &theme->styles.large_border, LV_STATE_EDITED);
484 
485     }
486 #endif
487 #if LV_USE_MSGBOX
488     else if(lv_obj_check_type(obj, &lv_msgbox_class)) {
489         lv_obj_add_style(obj, &theme->styles.card, 0);
490         return;
491     }
492 #endif
493 #if LV_USE_SPINBOX
494     else if(lv_obj_check_type(obj, &lv_spinbox_class)) {
495         lv_obj_add_style(obj, &theme->styles.card, 0);
496         lv_obj_add_style(obj, &theme->styles.inv, LV_PART_CURSOR);
497         lv_obj_add_style(obj, &theme->styles.focus, LV_STATE_FOCUS_KEY);
498         lv_obj_add_style(obj, &theme->styles.edit, LV_STATE_EDITED);
499     }
500 #endif
501 #if LV_USE_TILEVIEW
502     else if(lv_obj_check_type(obj, &lv_tileview_class)) {
503         lv_obj_add_style(obj, &theme->styles.scr, 0);
504         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
505     }
506     else if(lv_obj_check_type(obj, &lv_tileview_tile_class)) {
507         lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
508     }
509 #endif
510 
511 #if LV_USE_LED
512     else if(lv_obj_check_type(obj, &lv_led_class)) {
513         lv_obj_add_style(obj, &theme->styles.card, 0);
514     }
515 #endif
516 }
517 
518 /**********************
519  *   STATIC FUNCTIONS
520  **********************/
521 
style_init_reset(lv_style_t * style)522 static void style_init_reset(lv_style_t * style)
523 {
524     if(lv_theme_mono_is_inited()) {
525         lv_style_reset(style);
526     }
527     else {
528         lv_style_init(style);
529     }
530 }
531 
532 #endif
533