1 /**
2  *@file lv_theme.h
3  *
4  */
5 
6 #ifndef LV_THEME_H
7 #define LV_THEME_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *    INCLUDES
15  *********************/
16 #include "../core/lv_obj.h"
17 
18 /*********************
19  *    DEFINES
20  *********************/
21 
22 /**********************
23  *    TYPEDEFS
24  **********************/
25 
26 typedef void (*lv_theme_apply_cb_t)(lv_theme_t *, lv_obj_t *);
27 
28 /**********************
29  *  GLOBAL PROTOTYPES
30  **********************/
31 
32 /**
33  * Get the theme assigned to the display of the object
34  * @param obj       pointer to a theme object
35  * @return          the theme of the object's display (can be NULL)
36  */
37 lv_theme_t  * lv_theme_get_from_obj(lv_obj_t * obj);
38 
39 /**
40  * Apply the active theme on an object
41  * @param obj pointer to an object
42  */
43 void lv_theme_apply(lv_obj_t * obj);
44 
45 /**
46  * Set a base theme for a theme.
47  * The styles from the base them will be added before the styles of the current theme.
48  * Arbitrary long chain of themes can be created by setting base themes.
49  * @param new_theme pointer to theme which base should be set
50  * @param parent pointer to the base theme
51  */
52 void lv_theme_set_parent(lv_theme_t * new_theme, lv_theme_t * parent);
53 
54 /**
55  * Set an apply callback for a theme.
56  * The apply callback is used to add styles to different objects
57  * @param theme pointer to theme which callback should be set
58  * @param apply_cb pointer to the callback
59  */
60 void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb);
61 
62 /**
63  * Get the small font of the theme
64  * @param obj pointer to an object
65  * @return pointer to the font
66  */
67 const lv_font_t * lv_theme_get_font_small(lv_obj_t * obj);
68 /**
69  * Get the normal font of the theme
70  * @param obj pointer to an object
71  * @return pointer to the font
72  */
73 const lv_font_t * lv_theme_get_font_normal(lv_obj_t * obj);
74 
75 /**
76  * Get the subtitle font of the theme
77  * @param obj pointer to an object
78  * @return pointer to the font
79  */
80 const lv_font_t * lv_theme_get_font_large(lv_obj_t * obj);
81 
82 /**
83  * Get the primary color of the theme
84  * @param obj pointer to an object
85  * @return the color
86  */
87 lv_color_t lv_theme_get_color_primary(lv_obj_t * obj);
88 
89 /**
90  * Get the secondary color of the theme
91  * @param obj pointer to an object
92  * @return the color
93  */
94 lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj);
95 
96 /**********************
97  *    MACROS
98  **********************/
99 
100 #include "default/lv_theme_default.h"
101 #include "mono/lv_theme_mono.h"
102 #include "simple/lv_theme_simple.h"
103 
104 #ifdef __cplusplus
105 } /*extern "C"*/
106 #endif
107 
108 #endif /*LV_THEME_H*/
109