minor fixes for objects
This commit is contained in:
@@ -460,11 +460,15 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
res = ancestor_signal(ddlist, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_ddlist_refr_size(ddlist, 0);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
ext->label = NULL;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_FOCUS) {
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
if(ext->opened == false) {
|
||||
ext->opened = true;
|
||||
lv_ddlist_refr_size(ddlist, true);
|
||||
@@ -522,13 +526,18 @@ static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void *
|
||||
res = ancestor_scrl_signal(scrl, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
lv_obj_t *ddlist = lv_obj_get_parent(scrl);
|
||||
|
||||
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
/* Because of the wider selected rectangle ext. size
|
||||
* In this way by dragging the scrollable part the wider rectangle area can be redrawn too*/
|
||||
lv_obj_t *ddlist = lv_obj_get_parent(scrl);
|
||||
lv_style_t *style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
|
||||
if(scrl->ext_size < style->body.padding.hor) scrl->ext_size = style->body.padding.hor;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_ddlist_ext_t *ext = lv_obj_get_ext_attr(ddlist);
|
||||
ext->label = NULL; /*The label is already deleted*/
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
* @param needle_cnt new count of needles
|
||||
* @param colors an array of colors for needles (with 'num' elements)
|
||||
*/
|
||||
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, lv_color_t * colors)
|
||||
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_color_t * colors)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
if(ext->values != NULL) {
|
||||
|
||||
@@ -67,7 +67,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
* @param needle_cnt new count of needles
|
||||
* @param colors an array of colors for needles (with 'num' elements)
|
||||
*/
|
||||
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, lv_color_t * colors);
|
||||
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_color_t * colors);
|
||||
|
||||
/**
|
||||
* Set the value of a needle
|
||||
|
||||
@@ -165,8 +165,13 @@ void lv_img_set_file(lv_obj_t * img, const char * fn)
|
||||
}
|
||||
|
||||
if(fn != NULL) {
|
||||
ext->fn = lv_mem_realloc(ext->fn, strlen(fn) + 1);
|
||||
strcpy(ext->fn, fn);
|
||||
/* Don't refresh if set the the current 'fn'
|
||||
* 'lv_mem_realloc' first allocates a new mem and then frees the old
|
||||
* in this case it would free itself so it wouldn't be anything to 'strcpy' */
|
||||
if(ext->fn != fn) {
|
||||
ext->fn = lv_mem_realloc(ext->fn, strlen(fn) + 1);
|
||||
strcpy(ext->fn, fn);
|
||||
}
|
||||
} else {
|
||||
ext->fn = NULL;
|
||||
}
|
||||
|
||||
@@ -169,8 +169,9 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
|
||||
|
||||
lv_obj_set_width(liste, w);
|
||||
#if USE_LV_IMG != 0
|
||||
lv_obj_t * img = NULL;
|
||||
if(img_fn != NULL && img_fn[0] != '\0') {
|
||||
lv_obj_t * img = lv_img_create(liste, NULL);
|
||||
img = lv_img_create(liste, NULL);
|
||||
lv_img_set_file(img, img_fn);
|
||||
lv_obj_set_style(img, ext->style_img);
|
||||
lv_obj_set_click(img, false);
|
||||
|
||||
@@ -315,6 +315,9 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
int32_t id = -1;
|
||||
lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
|
||||
if(ext->ddlist.label == NULL) return LV_RES_INV; /*On delete the ddlist signal deletes the label so nothing left to do here*/
|
||||
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.label);
|
||||
const lv_font_t * font = style_label->text.font;
|
||||
lv_coord_t font_h = lv_font_get_height_scale(font);
|
||||
|
||||
@@ -91,6 +91,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->cursor.pos = 0;
|
||||
ext->cursor.type = LV_CURSOR_LINE;
|
||||
ext->cursor.valid_x = 0;
|
||||
ext->one_line = 0;
|
||||
ext->label = NULL;
|
||||
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->anim_time = LV_TABVIEW_ANIM_TIME;
|
||||
ext->tab_name_ptr = lv_mem_alloc(sizeof(char*));
|
||||
ext->tab_name_ptr[0] = "";
|
||||
ext->tab_cnt = 0;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_func(new_tabview, lv_tabview_signal);
|
||||
@@ -503,6 +504,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
|
||||
lv_mem_free(ext->tab_name_ptr);
|
||||
ext->tab_name_ptr = NULL;
|
||||
ext->btns = NULL; /*These objects were children so they are already invalid*/
|
||||
ext->content= NULL;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
if(ext->content != NULL &&
|
||||
|
||||
@@ -448,6 +448,12 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
|
||||
lv_win_realign(win);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
ext->header = NULL; /*These objects were children so they are already invalid*/
|
||||
ext->page = NULL;
|
||||
ext->title = NULL;
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user