mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
commit
5ccf31793e
@ -40,6 +40,9 @@
|
||||
static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
|
||||
static void lv_list_btn_single_selected(lv_obj_t * btn);
|
||||
static bool lv_list_is_list_btn(lv_obj_t * list_btn);
|
||||
static bool lv_list_is_list_img(lv_obj_t * list_btn);
|
||||
static bool lv_list_is_list_label(lv_obj_t * list_btn);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -426,7 +429,7 @@ lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn)
|
||||
lv_obj_t * label = lv_obj_get_child(btn, NULL);
|
||||
if(label == NULL) return NULL;
|
||||
|
||||
while(label->signal_cb != label_signal) {
|
||||
while(lv_list_is_list_label(label) == false) {
|
||||
label = lv_obj_get_child(btn, label);
|
||||
if(label == NULL) break;
|
||||
}
|
||||
@ -445,7 +448,7 @@ lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn)
|
||||
lv_obj_t * img = lv_obj_get_child(btn, NULL);
|
||||
if(img == NULL) return NULL;
|
||||
|
||||
while(img->signal_cb != img_signal) {
|
||||
while(lv_list_is_list_img(img) == false) {
|
||||
img = lv_obj_get_child(btn, img);
|
||||
if(img == NULL) break;
|
||||
}
|
||||
@ -473,7 +476,7 @@ lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
|
||||
btn = lv_obj_get_child(scrl, prev_btn);
|
||||
if(btn == NULL) return NULL;
|
||||
|
||||
while(btn->signal_cb != lv_list_btn_signal) {
|
||||
while(lv_list_is_list_btn(btn) == false) {
|
||||
btn = lv_obj_get_child(scrl, btn);
|
||||
if(btn == NULL) break;
|
||||
}
|
||||
@ -498,7 +501,7 @@ lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
|
||||
btn = lv_obj_get_child_back(scrl, prev_btn);
|
||||
if(btn == NULL) return NULL;
|
||||
|
||||
while(btn->signal_cb != lv_list_btn_signal) {
|
||||
while(lv_list_is_list_btn(btn) == false) {
|
||||
btn = lv_obj_get_child_back(scrl, btn);
|
||||
if(btn == NULL) break;
|
||||
}
|
||||
@ -934,4 +937,58 @@ static void lv_list_btn_single_selected(lv_obj_t * btn)
|
||||
} while(e != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is really a list button or another object.
|
||||
* @param list_btn List button
|
||||
*/
|
||||
static bool lv_list_is_list_btn(lv_obj_t * list_btn)
|
||||
{
|
||||
lv_obj_type_t type;
|
||||
|
||||
lv_obj_get_type(list_btn, &type);
|
||||
uint8_t cnt;
|
||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||
if(type.type[cnt] == NULL) break;
|
||||
if(!strcmp(type.type[cnt], "lv_btn"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is really a list label or another object.
|
||||
* @param list_label List label
|
||||
*/
|
||||
static bool lv_list_is_list_label(lv_obj_t * list_label)
|
||||
{
|
||||
lv_obj_type_t type;
|
||||
|
||||
lv_obj_get_type(list_label, &type);
|
||||
uint8_t cnt;
|
||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||
if(type.type[cnt] == NULL) break;
|
||||
if(!strcmp(type.type[cnt], "lv_label"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this is really a list image or another object.
|
||||
* @param list_image List image
|
||||
*/
|
||||
static bool lv_list_is_list_img(lv_obj_t * list_img)
|
||||
{
|
||||
lv_obj_type_t type;
|
||||
|
||||
lv_obj_get_type(list_img, &type);
|
||||
uint8_t cnt;
|
||||
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
|
||||
if(type.type[cnt] == NULL) break;
|
||||
if(!strcmp(type.type[cnt], "lv_img"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user