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