1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

[lv_list] Replace lv_list_layout_t with lv_layout_t

This commit is contained in:
C47D 2019-07-07 23:41:03 -05:00
parent 1dfded27d4
commit b4b4c764a3
2 changed files with 8 additions and 13 deletions

View File

@ -90,7 +90,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina;
ext->single_mode = false;
ext->size = 0;
ext->layout = LV_LIST_LAYOUT_VER;
ext->layout = LV_LAYOUT_COL_M;
#if LV_USE_GROUP
ext->last_sel = NULL;
@ -372,7 +372,7 @@ void lv_list_set_style(lv_obj_t * list, lv_list_style_t type, const lv_style_t *
* @param list pointer to a list object
* @param layout which layout should be used
*/
void lv_list_set_layout(lv_obj_t * list, lv_list_layout_t layout)
void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout)
{
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
@ -384,7 +384,7 @@ void lv_list_set_style(lv_obj_t * list, lv_list_style_t type, const lv_style_t *
/* Visit all buttons on the list and update their layout */
while(btn != NULL) {
if (LV_LIST_LAYOUT_HOR == layout) {
if (LV_LAYOUT_COL_M == layout) {
lv_btn_set_fit2(list, LV_FIT_FLOOD, LV_FIT_TIGHT);
} else { /* LV_LIST_LAYOUT_VER */
lv_btn_set_fit(list, LV_FIT_TIGHT);
@ -393,6 +393,8 @@ void lv_list_set_style(lv_obj_t * list, lv_list_style_t type, const lv_style_t *
btn = lv_list_get_prev_btn(list, btn);
}
lv_page_set_scr_layout(list, layout == LV_LAYOUT_COL_M ? LV_LAYOUT_COL_M : LV_LAYOUT_ROW_M);
ext->layout = layout;
}
}
@ -567,7 +569,7 @@ lv_obj_t * lv_list_get_btn_selected(const lv_obj_t * list)
* @param list pointer to a list object
* @return layout of the list object
*/
lv_list_layout_t lv_list_get_layout(lv_obj_t * list)
lv_layout_t lv_list_get_layout(lv_obj_t * list)
{
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
return ext->layout;

View File

@ -79,13 +79,6 @@ enum {
};
typedef uint8_t lv_list_style_t;
/** List layouts. */
enum {
LV_LIST_LAYOUT_HOR, /*< List horizontal layout */
LV_LIST_LAYOUT_VER /*< List vertical layout */
}
typedef uint8_t lv_list_layout_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -202,7 +195,7 @@ void lv_list_set_style(lv_obj_t * list, lv_list_style_t type, const lv_style_t *
* @param list pointer to a list object
* @param layout which layout should be used
*/
void lv_list_set_layout(lv_obj_t * list, lv_list_layout_t layout);
void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout);
/*=====================
* Getter functions
@ -279,7 +272,7 @@ lv_obj_t * lv_list_get_btn_selected(const lv_obj_t * list);
* @param list pointer to a list object
* @return layout of the list object
*/
lv_list_layout_t lv_list_get_layout(lv_obj_t * list);
lv_layout_t lv_list_get_layout(lv_obj_t * list);
/**
* Get the scroll bar mode of a list