From 3bbe46f74f881863e4aa17d166b2b133822d9d7c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 3 May 2021 17:34:45 +0200 Subject: [PATCH] minor fixes --- examples/widgets/checkbox/lv_example_checkbox_1.c | 4 ++-- src/draw/lv_img_buf.h | 10 ++++------ src/extra/themes/default/lv_theme_default.c | 9 +++++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/examples/widgets/checkbox/lv_example_checkbox_1.c b/examples/widgets/checkbox/lv_example_checkbox_1.c index cbd31cbae..ff59bd99c 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_1.c +++ b/examples/widgets/checkbox/lv_example_checkbox_1.c @@ -8,7 +8,7 @@ static void event_handler(lv_event_t * e) if(code == LV_EVENT_VALUE_CHANGED) { const char * txt = lv_checkbox_get_text(obj); const char * state = lv_obj_get_state(obj) & LV_STATE_CHECKED ? "Checked" : "Unchecked"; - LV_LOG_USER("%s: %s\n", txt, state); + LV_LOG_USER("%s: %s", txt, state); } } @@ -34,7 +34,7 @@ void lv_example_checkbox_1(void) cb = lv_checkbox_create(lv_scr_act()); lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); - lv_checkbox_set_text(cb, "Melon"); + lv_checkbox_set_text(cb, "Melon\nand a new line"); lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); lv_obj_update_layout(cb); diff --git a/src/draw/lv_img_buf.h b/src/draw/lv_img_buf.h index d2752ae31..6f339d8cf 100644 --- a/src/draw/lv_img_buf.h +++ b/src/draw/lv_img_buf.h @@ -98,9 +98,7 @@ enum { }; typedef uint8_t lv_img_cf_t; -/** - * LVGL image header - */ + /** * The first 8 bit is very important to distinguish the different source types. * For more info see `lv_img_get_src_type()` in lv_img.c @@ -135,9 +133,9 @@ typedef struct { /** Image header it is compatible with * the result from image converter utility*/ typedef struct { - lv_img_header_t header; - uint32_t data_size; - const uint8_t * data; + lv_img_header_t header; /**< A header describing the basics of the image*/ + uint32_t data_size; /**< Size of the image in bytes*/ + const uint8_t * data; /**< Pointer to the data of the image*/ } lv_img_dsc_t; typedef struct { diff --git a/src/extra/themes/default/lv_theme_default.c b/src/extra/themes/default/lv_theme_default.c index 941d45ab6..c16d0a8f8 100644 --- a/src/extra/themes/default/lv_theme_default.c +++ b/src/extra/themes/default/lv_theme_default.c @@ -89,6 +89,10 @@ typedef struct { lv_style_t chart_series, chart_indic, chart_ticks, chart_bg; #endif +#if LV_USE_DROPDOWN + lv_style_t dropdown_list; +#endif + #if LV_USE_CHECKBOX lv_style_t cb_marker, cb_marker_checked; #endif @@ -390,6 +394,10 @@ static void style_init(void) lv_style_set_arc_color(&styles->arc_indic_primary, theme.color_primary); #endif +#if LV_USE_DROPDOWN + style_init_reset(&styles->dropdown_list); + lv_style_set_max_height(&styles->dropdown_list, LV_DPI_DEF * 2); +#endif #if LV_USE_CHECKBOX style_init_reset(&styles->cb_marker); lv_style_set_pad_all(&styles->cb_marker, LV_DPX(3)); @@ -812,6 +820,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj) else if(lv_obj_check_type(obj, &lv_dropdownlist_class)) { lv_obj_add_style(obj, &styles->card, 0); lv_obj_add_style(obj, &styles->line_space_large, 0); + lv_obj_add_style(obj, &styles->dropdown_list, 0); lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR); lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED); lv_obj_add_style(obj, &styles->bg_color_white, LV_PART_SELECTED);