1 /** 2 * @file lv_demo_high_res_private.h 3 * 4 */ 5 6 #ifndef LV_DEMO_HIGH_RES_PRIVATE_H 7 #define LV_DEMO_HIGH_RES_PRIVATE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "../../src/lv_conf_internal.h" 18 #if LV_USE_DEMO_HIGH_RES 19 20 #include "lv_demo_high_res.h" 21 #include "../../src/core/lv_obj.h" 22 #include "../../src/others/observer/lv_observer.h" 23 24 /********************* 25 * DEFINES 26 *********************/ 27 28 #define EV_CHARGING_RANGE_END 10000 29 30 /********************** 31 * TYPEDEFS 32 **********************/ 33 34 enum { 35 IMG_ABOUT_APP_ICON = 0, 36 IMG_ALBUM_ART, 37 IMG_ARROW_LEFT, 38 IMG_BACKWARD_ICON, 39 IMG_COLD_ICON, 40 IMG_DRY_ICON, 41 IMG_ENERGY_ICON, 42 IMG_EV_CHARGING_APP_ICON, 43 IMG_EV_CHARGING_WIDGET3_1_BG, 44 IMG_EV_CHARGING_WIDGET3_BG, 45 IMG_FAN, 46 IMG_FORWARD_ICON, 47 IMG_HEALTH_ICON, 48 IMG_HEALTH_ICON_BOLD, 49 IMG_HEAT_ICON, 50 IMG_LAMP, 51 IMG_LOGOUT_ICON, 52 IMG_MAIN_LIGHT_SLIDER, 53 IMG_MINUS, 54 IMG_PAGER_LEFT, 55 IMG_PAGER_PAUSE, 56 IMG_PAGER_PLAY, 57 IMG_PAGER_RIGHT, 58 IMG_PLAY_ICON, 59 IMG_PLAY_ICON_1, 60 IMG_PLUS, 61 IMG_RANGE_ICON, 62 IMG_SETTING_ICON, 63 IMG_SETTING_ICON_BOLD, 64 IMG_SMART_HOME_APP_ICON, 65 IMG_SMART_HOME_WIDGET1_BG, 66 IMG_SMART_HOME_WIDGET2_BG, 67 IMG_SMART_METER_APP_ICON, 68 IMG_THERMOSTAT_APP_ICON, 69 IMG_TIME_ICON, 70 IMG_UNLOCK, 71 IMG_VOLUME, 72 IMG_WEATHER, 73 IMG_WIFI_ICON, 74 IMG_LIGHT_BG_ABOUT, 75 IMG_DARK_BG_ABOUT, 76 IMG_LIGHT_BG_EV_CHARGING, 77 IMG_DARK_BG_EV_CHARGING, 78 IMG_LIGHT_BG_HOME, 79 IMG_DARK_BG_HOME, 80 IMG_LIGHT_BG_SMART_HOME, 81 IMG_DARK_BG_SMART_HOME, 82 IMG_LIGHT_BG_SMART_METER, 83 IMG_DARK_BG_SMART_METER, 84 IMG_LIGHT_BG_THERMOSTAT, 85 IMG_DARK_BG_THERMOSTAT, 86 IMG_LIGHT_DARK_THEME_ICON, 87 IMG_DARK_DARK_THEME_ICON, 88 IMG_LIGHT_LIGHT_THEME_ICON, 89 IMG_DARK_LIGHT_THEME_ICON, 90 IMG_LIGHT_WIDGET1_BG, 91 IMG_DARK_WIDGET1_BG, 92 IMG_LIGHT_WIDGET2_BG, 93 IMG_DARK_WIDGET2_BG, 94 IMG_LIGHT_WIDGET3_BG, 95 IMG_DARK_WIDGET3_BG, 96 IMG_LIGHT_WIDGET4_BG, 97 IMG_DARK_WIDGET4_BG, 98 IMG_LIGHT_WIDGET5_BG, 99 IMG_DARK_WIDGET5_BG, 100 IMG_COUNT 101 }; 102 103 enum { 104 STYLE_COLOR_BASE = 0, 105 STYLE_COLOR_ACCENT, 106 STYLE_COLOR_COUNT 107 }; 108 109 enum { 110 STYLE_TYPE_OBJ = 0, 111 STYLE_TYPE_TEXT, 112 STYLE_TYPE_A8_IMG, 113 STYLE_TYPE_COUNT 114 }; 115 116 enum { 117 FONT_HEADING_MD = 0, 118 FONT_HEADING_LG, 119 FONT_HEADING_XL, 120 FONT_HEADING_XXL, 121 FONT_LABEL_XS, 122 FONT_LABEL_SM, 123 FONT_LABEL_MD, 124 FONT_LABEL_LG, 125 FONT_LABEL_XL, 126 FONT_LABEL_2XL, 127 FONT_COUNT 128 }; 129 130 enum { 131 SIZE_SM = 0, 132 SIZE_MD, 133 SIZE_LG, 134 SIZE_COUNT 135 }; 136 137 enum { 138 ICON_SM = 0, 139 ICON_MD, 140 ICON_LG, 141 ICON_XL, 142 ICON_2XL, 143 ICON_COUNT 144 }; 145 146 typedef struct { 147 lv_color_t base; 148 lv_color_t accent; 149 } lv_demo_high_res_theme_t; 150 151 typedef struct { 152 int32_t gap[10 + 1]; 153 int32_t icon[ICON_COUNT]; 154 int32_t card_long_edge; 155 int32_t widget_long_edge; 156 int32_t card_short_edge; 157 int32_t smart_home_arc_diameter; 158 int32_t ev_charging_arc_diameter; 159 int32_t smart_meter_collapsed_part_height; 160 int32_t slider_width; 161 int32_t small_chart_height; 162 int32_t large_chart_height; 163 int32_t card_radius; 164 int32_t health_panel_width; 165 int32_t settings_panel_width; 166 int32_t home_bottom_margin_height; 167 void (*init_fonts_cb)(lv_style_t * fonts); 168 } lv_demo_high_res_sizes_t; 169 170 typedef struct { 171 struct { 172 lv_subject_t group; 173 lv_subject_t * members[2]; 174 } time; 175 struct { 176 lv_subject_t group; 177 lv_subject_t * members[3]; 178 } date; 179 struct { 180 lv_subject_t group; 181 lv_subject_t * members[2]; 182 } wifi; 183 } lv_demo_high_res_subject_groups_t; 184 185 typedef struct { 186 const lv_demo_high_res_sizes_t * sz; 187 lv_image_dsc_t * imgs[IMG_COUNT]; 188 lv_style_t styles[STYLE_COLOR_COUNT][STYLE_TYPE_COUNT]; 189 lv_style_t fonts[FONT_COUNT]; 190 lv_subject_t th; 191 char * logo_path; 192 char * slides_path; 193 lv_demo_high_res_exit_cb_t exit_cb; 194 lv_subject_t temperature_units_are_celsius; 195 lv_obj_t * ev_charging_bg_cont; 196 lv_subject_t ev_charging_progress; 197 lv_subject_t smart_meter_selected_bar; 198 bool top_margin_subjects_are_init; 199 lv_subject_t top_margin_wifi_subject; 200 lv_subject_t top_margin_health_subject; 201 lv_subject_t top_margin_setting_subject; 202 lv_demo_high_res_api_t api; 203 lv_demo_high_res_subject_groups_t subject_groups; 204 lv_array_t about_slides_array; 205 bool about_slides_dir_exists; 206 } lv_demo_high_res_ctx_t; 207 208 LV_ATTRIBUTE_EXTERN_DATA extern const lv_demo_high_res_theme_t lv_demo_high_res_theme_light; 209 LV_ATTRIBUTE_EXTERN_DATA extern const lv_demo_high_res_theme_t lv_demo_high_res_theme_dark; 210 LV_ATTRIBUTE_EXTERN_DATA extern const lv_demo_high_res_sizes_t lv_demo_high_res_sizes_all[SIZE_COUNT]; 211 212 /********************** 213 * GLOBAL PROTOTYPES 214 **********************/ 215 216 lv_obj_t * lv_demo_high_res_base_obj_create(const char * assets_path, 217 const char * logo_path, 218 const char * slides_path, 219 lv_demo_high_res_exit_cb_t exit_cb); 220 221 void lv_demo_high_res_home(lv_obj_t * base_obj); 222 void lv_demo_high_res_app_smart_home(lv_obj_t * base_obj); 223 void lv_demo_high_res_app_ev_charging(lv_obj_t * base_obj); 224 void lv_demo_high_res_app_smart_meter(lv_obj_t * base_obj); 225 void lv_demo_high_res_app_thermostat(lv_obj_t * base_obj); 226 void lv_demo_high_res_app_about(lv_obj_t * base_obj); 227 lv_obj_t * lv_demo_high_res_top_margin_create(lv_obj_t * parent, int32_t pad_hor, bool show_time, 228 lv_demo_high_res_ctx_t * c); 229 void lv_demo_high_res_top_margin_deinit_subjects(lv_demo_high_res_ctx_t * c); 230 231 lv_obj_t * lv_demo_high_res_simple_container_create(lv_obj_t * parent, bool vertical, int32_t pad, 232 lv_flex_align_t align_cross_place); 233 void lv_demo_high_res_label_bind_temperature(lv_obj_t * label, lv_subject_t * subject, lv_demo_high_res_ctx_t * c); 234 void lv_demo_high_res_theme_observer_image_src_cb(lv_observer_t * observer, lv_subject_t * subject); 235 void lv_demo_high_res_theme_observer_obj_bg_image_src_cb(lv_observer_t * observer, lv_subject_t * subject); 236 lv_image_dsc_t * lv_demo_high_res_image_preload(const void * src, lv_color_format_t cf, int32_t scale); 237 238 /********************** 239 * MACROS 240 **********************/ 241 242 #endif /*LV_USE_DEMO_HIGH_RES*/ 243 244 #ifdef __cplusplus 245 } /*extern "C"*/ 246 #endif 247 248 #endif /*LV_DEMO_HIGH_RES_PRIVATE_H*/ 249