Add files via upload
This commit is contained in:
@@ -75,6 +75,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_mem_assert(ext);
|
||||
if(ext == NULL) return NULL;
|
||||
|
||||
ext->ddlist.roller_ddlist = 0;
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_func(new_roller, lv_roller_signal);
|
||||
lv_obj_set_design_func(new_roller, lv_roller_design);
|
||||
@@ -192,21 +193,17 @@ bool lv_roller_get_hor_fit(const lv_obj_t * roller)
|
||||
* */
|
||||
lv_style_t * lv_roller_get_style(const lv_obj_t * roller, lv_roller_style_t type)
|
||||
{
|
||||
lv_style_t * style = NULL;
|
||||
|
||||
switch(type) {
|
||||
case LV_ROLLER_STYLE_BG:
|
||||
style = lv_obj_get_style(roller);
|
||||
break;
|
||||
return lv_obj_get_style(roller);
|
||||
case LV_ROLLER_STYLE_SEL:
|
||||
style = lv_ddlist_get_style(roller, LV_DDLIST_STYLE_SEL);
|
||||
break;
|
||||
return lv_ddlist_get_style(roller, LV_DDLIST_STYLE_SEL);
|
||||
default:
|
||||
style = NULL;
|
||||
break;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return style;
|
||||
/*To avoid warning*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -319,11 +316,8 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
refr_position(roller, false);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
bool editing = false;
|
||||
#if USE_LV_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
editing = lv_group_get_editing(g);
|
||||
#endif
|
||||
bool editing = lv_group_get_editing(g);
|
||||
lv_hal_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
|
||||
/*Encoders need special handling*/
|
||||
@@ -363,15 +357,11 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_ENTER) {
|
||||
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id; /*Set the entered value as default*/
|
||||
if(ext->ddlist.action) res = ext->ddlist.action(roller);
|
||||
#if USE_LV_GROUP
|
||||
if(res == LV_RES_OK) {
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
if(ext->ddlist.action) ext->ddlist.action(roller);
|
||||
|
||||
if(editing) lv_group_set_editing(g, false); /*In edit mode go to navigate mode if an option is selected*/
|
||||
}
|
||||
#endif
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
if(editing) lv_group_set_editing(g, false); /*In edit mode go to navigate mode if an option is selected*/
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
@@ -420,8 +410,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
if(id < 0) id = 0;
|
||||
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
||||
ext->ddlist.sel_opt_id = id;
|
||||
ext->ddlist.sel_opt_id_ori = id;
|
||||
if(ext->ddlist.action) res = ext->ddlist.action(roller);
|
||||
if(ext->ddlist.action) ext->ddlist.action(roller);
|
||||
} else if(sign == LV_SIGNAL_RELEASED) {
|
||||
/*If picked an option by clicking then set it*/
|
||||
if(!lv_indev_is_dragging(indev)) {
|
||||
@@ -432,13 +421,12 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
|
||||
if(id < 0) id = 0;
|
||||
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
||||
ext->ddlist.sel_opt_id = id;
|
||||
ext->ddlist.sel_opt_id_ori = id;
|
||||
if(ext->ddlist.action) res = ext->ddlist.action(roller);
|
||||
if(ext->ddlist.action) ext->ddlist.action(roller);
|
||||
}
|
||||
}
|
||||
|
||||
/*Position the scrollable according to the new selected option*/
|
||||
if(id != -1 && res == LV_RES_OK) {
|
||||
if(id != -1) {
|
||||
refr_position(roller, true);
|
||||
}
|
||||
|
||||
@@ -511,10 +499,8 @@ static void refr_position(lv_obj_t * roller, bool anim_en)
|
||||
#if USE_LV_ANIMATION == 0
|
||||
anim_en = false;
|
||||
#endif
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
if(ext->ddlist.label == NULL) return; /*Probably the roller is being deleted if the label is NULL.*/
|
||||
|
||||
lv_obj_t * roller_scrl = lv_page_get_scrl(roller);
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
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(font);
|
||||
|
||||
Reference in New Issue
Block a user