mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
commit
232bbc5270
@ -93,7 +93,7 @@ You can use the [Simulators](https://docs.littlevgl.com/en/html/get-started/pc-s
|
||||
|
||||
1. [Download](https://littlevgl.com/download) or [Clone](https://github.com/littlevgl/lvgl) the library
|
||||
2. Copy the `lvgl` folder into your project
|
||||
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`.
|
||||
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. Don't forget to **change the `#if 0` statement near the top of the file to `#if 1`**, otherwise you will get compilation errors.
|
||||
4. Include `lvgl/lvgl.h` where you need to use LittlevGL related functions.
|
||||
5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL.
|
||||
6. Call `lv_init()`
|
||||
|
@ -63,6 +63,7 @@ bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
|
||||
if(types.type[i] == NULL) break;
|
||||
if(strcmp(types.type[i], obj_type) == 0) return true;
|
||||
}
|
||||
|
||||
|
@ -860,11 +860,11 @@ static inline lv_color_t color_blend_true_color_additive(lv_color_t fg, lv_color
|
||||
fg.ch.red = LV_MATH_MIN(tmp, 255);
|
||||
#endif
|
||||
|
||||
tmp = bg.ch.green + fg.ch.green;
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
fg.ch.green = LV_MATH_MIN(tmp, 7);
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
#if LV_COLOR_16_SWAP == 0
|
||||
tmp = bg.ch.green + fg.ch.green;
|
||||
fg.ch.green = LV_MATH_MIN(tmp, 63);
|
||||
#else
|
||||
tmp = (bg.ch.green_h << 3) + bg.ch.green_l + (fg.ch.green_h << 3) + fg.ch.green_l;
|
||||
|
@ -274,10 +274,12 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_re
|
||||
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
|
||||
/*Center part*/
|
||||
fill_area2.x1 = coords_bg.x1 + rout;
|
||||
fill_area2.x2 = coords_bg.x2 - rout;
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
|
||||
fill_area2.x1 = coords_bg.x1 + rout;
|
||||
fill_area2.x2 = coords_bg.x2 - rout;
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
}
|
||||
|
||||
/*Right part*/
|
||||
fill_area2.x1 = coords_bg.x2 - rout + 1;
|
||||
|
@ -62,7 +62,7 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco
|
||||
lv_style_init(&opa_cover);
|
||||
lv_style_set_bg_opa(&opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
|
||||
theme.apply_cb = lv_theme_empty_apply;
|
||||
theme.apply_xcb = lv_theme_empty_apply;
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
@ -1095,12 +1095,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &pad_inner);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
break;
|
||||
#endif
|
||||
@ -1128,8 +1128,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &tabview_page_scrl);
|
||||
|
||||
break;
|
||||
@ -1265,12 +1265,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
lv_style_list_add_style(list, &scr);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &tabview_page_scrl);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
||||
|
@ -760,12 +760,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &style_pad_inner);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
break;
|
||||
#endif
|
||||
@ -794,8 +794,8 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &style_pad_normal);
|
||||
|
||||
break;
|
||||
@ -939,12 +939,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
||||
|
@ -382,7 +382,7 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_cb = lv_theme_material_apply;
|
||||
theme.apply_xcb = lv_theme_material_apply;
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
@ -137,27 +137,26 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
|
||||
|
||||
switch(state) {
|
||||
case LV_BTN_STATE_RELEASED:
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
|
||||
break;
|
||||
case LV_BTN_STATE_PRESSED:
|
||||
lv_obj_clear_state(btn, LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
lv_obj_clear_state(btn, LV_STATE_CHECKED);
|
||||
lv_obj_add_state(btn, LV_STATE_PRESSED);
|
||||
break;
|
||||
case LV_BTN_STATE_CHECKED_RELEASED:
|
||||
lv_obj_add_state(btn, LV_STATE_CHECKED);
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_DISABLED);
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED);
|
||||
break;
|
||||
case LV_BTN_STATE_CHECKED_PRESSED:
|
||||
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
|
||||
break;
|
||||
case LV_BTN_STATE_DISABLED:
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
|
||||
lv_obj_add_state(btn, LV_STATE_DISABLED);
|
||||
break;
|
||||
case LV_BTN_STATE_ACTIVE:
|
||||
lv_obj_clear_state(btn, LV_STATE_DISABLED);
|
||||
break;
|
||||
}
|
||||
|
||||
// /*Make the state change happen immediately, without transition*/
|
||||
// btn->prev_state = btn->state;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,26 +184,25 @@ void lv_btn_toggle(lv_obj_t * btn)
|
||||
/**
|
||||
* Get the current state of the button
|
||||
* @param btn pointer to a button object
|
||||
* @return the state of the button (from lv_btn_state_t enum)
|
||||
* @return the state of the button (from lv_btn_state_t enum).
|
||||
* If the button is in disabled state `LV_BTN_STATE_DISABLED` will be ORed to the other button states.
|
||||
*/
|
||||
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
|
||||
{
|
||||
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
|
||||
|
||||
lv_state_t state = lv_obj_get_state(btn, LV_BTN_PART_MAIN);
|
||||
lv_state_t obj_state = lv_obj_get_state(btn, LV_BTN_PART_MAIN);
|
||||
lv_btn_state_t btn_state = 0;
|
||||
if(obj_state & LV_STATE_DISABLED) btn_state = LV_BTN_STATE_DISABLED;
|
||||
|
||||
if(state & LV_STATE_DISABLED) {
|
||||
return LV_BTN_STATE_DISABLED;
|
||||
}
|
||||
else if(state & LV_STATE_CHECKED) {
|
||||
if(state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED;
|
||||
else return LV_BTN_STATE_CHECKED_RELEASED;
|
||||
if(obj_state & LV_STATE_CHECKED) {
|
||||
if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_CHECKED_PRESSED;
|
||||
else return btn_state | LV_BTN_STATE_CHECKED_RELEASED;
|
||||
}
|
||||
else {
|
||||
if(state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED;
|
||||
else return LV_BTN_STATE_RELEASED;
|
||||
if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_PRESSED;
|
||||
else return btn_state | LV_BTN_STATE_RELEASED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,11 +36,12 @@ extern "C" {
|
||||
/** Possible states of a button.
|
||||
* It can be used not only by buttons but other button-like objects too*/
|
||||
enum {
|
||||
LV_BTN_STATE_ACTIVE,
|
||||
LV_BTN_STATE_RELEASED,
|
||||
LV_BTN_STATE_PRESSED,
|
||||
LV_BTN_STATE_CHECKED_RELEASED,
|
||||
LV_BTN_STATE_CHECKED_PRESSED,
|
||||
LV_BTN_STATE_DISABLED,
|
||||
LV_BTN_STATE_DISABLED = 0x80,
|
||||
_LV_BTN_STATE_LAST, /* Number of states*/
|
||||
};
|
||||
typedef uint8_t lv_btn_state_t;
|
||||
@ -153,6 +154,7 @@ static inline void lv_btn_set_fit(lv_obj_t * btn, lv_fit_t fit)
|
||||
* Get the current state of the button
|
||||
* @param btn pointer to a button object
|
||||
* @return the state of the button (from lv_btn_state_t enum)
|
||||
* If the button is in disabled state `LV_BTN_STATE_DISABLED` will be ORed to the other button states.
|
||||
*/
|
||||
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn);
|
||||
|
||||
|
@ -604,8 +604,8 @@ void lv_dropdown_open(lv_obj_t * ddlist)
|
||||
lv_obj_set_signal_cb(lv_page_get_scrl(ext->page), lv_dropdown_page_scrl_signal);
|
||||
|
||||
lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_BG), &ext->style_page);
|
||||
lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCRLBAR), &ext->style_scrlbar);
|
||||
lv_obj_clean_style_list(ext->page, LV_PAGE_PART_SCRL);
|
||||
lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLBAR), &ext->style_scrlbar);
|
||||
lv_obj_clean_style_list(ext->page, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_obj_refresh_style(ext->page, LV_STYLE_PROP_ALL);
|
||||
|
||||
lv_page_set_scrl_fit(ext->page, LV_FIT_TIGHT);
|
||||
|
@ -57,10 +57,10 @@ typedef struct {
|
||||
/** List styles. */
|
||||
enum {
|
||||
LV_LIST_PART_BG = LV_PAGE_PART_BG, /**< List background style */
|
||||
LV_LIST_PART_SCRLBAR = LV_PAGE_PART_SCRLBAR, /**< List scrollbar style. */
|
||||
LV_LIST_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR, /**< List scrollbar style. */
|
||||
LV_LIST_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< List edge flash style. */
|
||||
_LV_LIST_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
|
||||
LV_LIST_PART_SCRL = LV_PAGE_PART_SCRL, /**< List scrollable area style. */
|
||||
LV_LIST_PART_SCRL = LV_PAGE_PART_SCROLLABLE, /**< List scrollable area style. */
|
||||
_LV_LIST_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST,
|
||||
};
|
||||
typedef uint8_t lv_list_style_t;
|
||||
|
@ -391,7 +391,7 @@ lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span)
|
||||
{
|
||||
|
||||
lv_coord_t obj_w = lv_page_get_width_fit(page);
|
||||
lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCRL);
|
||||
lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCROLLABLE);
|
||||
|
||||
lv_coord_t r = (obj_w - (div - 1) * pinner) / div;
|
||||
|
||||
@ -413,7 +413,7 @@ lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span)
|
||||
lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span)
|
||||
{
|
||||
lv_coord_t obj_h = lv_page_get_height_fit(page);
|
||||
lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCRL);
|
||||
lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCROLLABLE);
|
||||
|
||||
lv_coord_t r = (obj_h - (div - 1) * pinner) / div;
|
||||
|
||||
@ -704,7 +704,7 @@ static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_ar
|
||||
/*Draw the scrollbars*/
|
||||
lv_draw_rect_dsc_t rect_dsc;
|
||||
lv_draw_rect_dsc_init(&rect_dsc);
|
||||
lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_SCRLBAR, &rect_dsc);
|
||||
lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_SCROLLBAR, &rect_dsc);
|
||||
if(ext->scrlbar.hor_draw && (ext->scrlbar.mode & LV_SCRLBAR_MODE_HIDE) == 0) {
|
||||
lv_draw_rect(&sb_hor_area, clip_area, &rect_dsc);
|
||||
}
|
||||
@ -781,7 +781,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
|
||||
lv_get_state_info_t * info = param;
|
||||
if(info->part == LV_PAGE_PART_SCRL) info->result = lv_obj_get_state(lv_page_get_scrl(page), LV_CONT_PART_MAIN);
|
||||
if(info->part == LV_PAGE_PART_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrl(page), LV_CONT_PART_MAIN);
|
||||
else info->result = lv_obj_get_state(page, info->part);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@ -802,7 +802,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_clean_style_list(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(page, LV_PAGE_PART_SCROLLBAR);
|
||||
#if LV_USE_ANIMATION
|
||||
lv_obj_clean_style_list(page, LV_PAGE_PART_EDGE_FLASH);
|
||||
#endif
|
||||
@ -853,7 +853,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_area_set_height(&ext->scrlbar.hor_area, sb_width);
|
||||
lv_area_set_width(&ext->scrlbar.ver_area, sb_width);
|
||||
|
||||
@ -1091,10 +1091,10 @@ static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part)
|
||||
case LV_PAGE_PART_BG:
|
||||
style_dsc_p = &page->style_list;
|
||||
break;
|
||||
case LV_PAGE_PART_SCRL:
|
||||
case LV_PAGE_PART_SCROLLABLE:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->scrl, LV_CONT_PART_MAIN);
|
||||
break;
|
||||
case LV_PAGE_PART_SCRLBAR:
|
||||
case LV_PAGE_PART_SCROLLBAR:
|
||||
style_dsc_p = &ext->scrlbar.style;
|
||||
break;
|
||||
#if LV_USE_ANIMATION
|
||||
@ -1190,9 +1190,9 @@ static void scrlbar_refresh(lv_obj_t * page)
|
||||
lv_coord_t obj_w = lv_obj_get_width(page);
|
||||
lv_coord_t obj_h = lv_obj_get_height(page);
|
||||
|
||||
lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCROLLBAR);
|
||||
|
||||
lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
|
||||
lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
|
||||
@ -1314,8 +1314,8 @@ static void scrlbar_refresh(lv_obj_t * page)
|
||||
|
||||
static void refr_ext_draw_pad(lv_obj_t * page)
|
||||
{
|
||||
lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCRLBAR);
|
||||
lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCROLLBAR);
|
||||
|
||||
/*Ensure ext. size for the scrollbars if they are out of the page*/
|
||||
if(page->ext_draw_pad < (-sb_right)) page->ext_draw_pad = -sb_right;
|
||||
|
@ -85,11 +85,11 @@ typedef struct {
|
||||
|
||||
enum {
|
||||
LV_PAGE_PART_BG = LV_CONT_PART_MAIN,
|
||||
LV_PAGE_PART_SCRLBAR = _LV_OBJ_PART_VIRTUAL_LAST,
|
||||
LV_PAGE_PART_SCROLLBAR = _LV_OBJ_PART_VIRTUAL_LAST,
|
||||
LV_PAGE_PART_EDGE_FLASH,
|
||||
_LV_PAGE_PART_VIRTUAL_LAST,
|
||||
|
||||
LV_PAGE_PART_SCRL = _LV_OBJ_PART_REAL_LAST,
|
||||
LV_PAGE_PART_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,
|
||||
_LV_PAGE_PART_REAL_LAST,
|
||||
};
|
||||
typedef uint8_t lv_part_style_t;
|
||||
|
@ -111,7 +111,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal);
|
||||
|
||||
lv_obj_clean_style_list(roller, LV_PAGE_PART_SCRL); /*Use a transparent scrollable*/
|
||||
lv_obj_clean_style_list(roller, LV_PAGE_PART_SCROLLABLE); /*Use a transparent scrollable*/
|
||||
lv_theme_apply(roller, LV_THEME_ROLLER);
|
||||
refr_height(roller);
|
||||
|
||||
|
@ -108,10 +108,9 @@ static inline void lv_slider_set_range(lv_obj_t * slider, int16_t min, int16_t m
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum
|
||||
* position.
|
||||
* @param slider pointer to a slider object
|
||||
* @param en true: enable disable symmetric behavior; false: disable
|
||||
* Set the animation time of the slider
|
||||
* @param slider pointer to a bar object
|
||||
* @param anim_time the animation time in milliseconds.
|
||||
*/
|
||||
static inline void lv_slider_set_anim_time(lv_obj_t * slider, uint16_t anim_time)
|
||||
{
|
||||
@ -119,9 +118,10 @@ static inline void lv_slider_set_anim_time(lv_obj_t * slider, uint16_t anim_time
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the animation time of the slider
|
||||
* @param slider pointer to a bar object
|
||||
* @param anim_time the animation time in milliseconds.
|
||||
* Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum
|
||||
* position.
|
||||
* @param slider pointer to a slider object
|
||||
* @param en true: enable disable symmetric behavior; false: disable
|
||||
*/
|
||||
static inline void lv_slider_set_type(lv_obj_t * slider, lv_slider_type_t type)
|
||||
{
|
||||
|
@ -176,10 +176,10 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
for(i = 0; i < copy_ext->tab_cnt; i++) {
|
||||
lv_obj_t * new_tab = lv_tabview_add_tab(tabview, copy_ext->tab_name_ptr[i]);
|
||||
lv_obj_t * copy_tab = lv_tabview_get_tab(copy, i);
|
||||
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCRL), lv_obj_get_style_list(copy_tab,
|
||||
LV_PAGE_PART_SCRL));
|
||||
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCRLBAR), lv_obj_get_style_list(copy_tab,
|
||||
LV_PAGE_PART_SCRLBAR));
|
||||
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLABLE), lv_obj_get_style_list(copy_tab,
|
||||
LV_PAGE_PART_SCROLLABLE));
|
||||
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLBAR), lv_obj_get_style_list(copy_tab,
|
||||
LV_PAGE_PART_SCROLLBAR));
|
||||
lv_obj_refresh_style(new_tab, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
@ -340,8 +340,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
|
||||
}
|
||||
|
||||
lv_coord_t cont_x;
|
||||
lv_style_int_t scrl_inner = lv_obj_get_style_pad_inner(ext->content, LV_PAGE_PART_SCRL);
|
||||
lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->content, LV_PAGE_PART_SCRL);
|
||||
lv_style_int_t scrl_inner = lv_obj_get_style_pad_inner(ext->content, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->content, LV_PAGE_PART_SCROLLABLE);
|
||||
|
||||
switch(ext->btns_pos) {
|
||||
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
|
||||
@ -599,7 +599,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BG);
|
||||
else if(info->part == LV_TABVIEW_PART_TAB_BTN) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN);
|
||||
else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state(ext->indic, LV_OBJ_PART_MAIN);
|
||||
else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCRL);
|
||||
else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCROLLABLE);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
@ -751,7 +751,7 @@ static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part)
|
||||
style_dsc_p = &tabview->style_list;
|
||||
break;
|
||||
case LV_TABVIEW_PART_BG_SCRL:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->content, LV_PAGE_PART_SCRL);
|
||||
style_dsc_p = lv_obj_get_style_list(ext->content, LV_PAGE_PART_SCROLLABLE);
|
||||
break;
|
||||
case LV_TABVIEW_PART_TAB_BG:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->btns, LV_BTNMATRIX_PART_BG);
|
||||
@ -782,6 +782,8 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event)
|
||||
uint16_t btn_id = lv_btnmatrix_get_active_btn(tab_btnm);
|
||||
if(btn_id == LV_BTNMATRIX_BTN_NONE) return;
|
||||
|
||||
if(lv_btnmatrix_get_btn_ctrl(tab_btnm, btn_id, LV_BTNMATRIX_CTRL_DISABLED)) return;
|
||||
|
||||
lv_btnmatrix_clear_btn_ctrl_all(tab_btnm, LV_BTNMATRIX_CTRL_CHECK_STATE);
|
||||
lv_btnmatrix_set_btn_ctrl(tab_btnm, btn_id, LV_BTNMATRIX_CTRL_CHECK_STATE);
|
||||
|
||||
|
@ -150,7 +150,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_size(ta, LV_TEXTAREA_DEF_WIDTH, LV_TEXTAREA_DEF_HEIGHT);
|
||||
lv_textarea_set_sb_mode(ta, LV_SCRLBAR_MODE_DRAG);
|
||||
|
||||
lv_obj_reset_style_list(ta, LV_PAGE_PART_SCRL);
|
||||
lv_obj_reset_style_list(ta, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_theme_apply(ta, LV_THEME_TEXTAREA);
|
||||
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ typedef struct {
|
||||
/** Possible text areas tyles. */
|
||||
enum {
|
||||
LV_TEXTAREA_PART_BG = LV_PAGE_PART_BG, /**< Text area background style */
|
||||
LV_TEXTAREA_PART_SCRLBAR = LV_PAGE_PART_SCRLBAR, /**< Scrollbar style */
|
||||
LV_TEXTAREA_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR, /**< Scrollbar style */
|
||||
LV_TEXTAREA_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< Edge flash style */
|
||||
LV_TEXTAREA_PART_CURSOR = _LV_PAGE_PART_VIRTUAL_LAST, /**< Cursor style */
|
||||
LV_TEXTAREA_PART_PLACEHOLDER, /**< Placeholder style */
|
||||
|
@ -118,7 +118,7 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_page_set_scrl_fit(new_tileview, LV_FIT_TIGHT);
|
||||
|
||||
lv_obj_reset_style_list(new_tileview, LV_PAGE_PART_SCRL);
|
||||
lv_obj_reset_style_list(new_tileview, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_theme_apply(new_tileview, LV_THEME_TILEVIEW);
|
||||
}
|
||||
/*Copy an existing tileview*/
|
||||
|
@ -46,7 +46,7 @@ typedef struct {
|
||||
/*Parts of the Tileview*/
|
||||
enum {
|
||||
LV_TILEVIEW_PART_BG = LV_PAGE_PART_BG,
|
||||
LV_TILEVIEW_PART_SCRLBAR = LV_PAGE_PART_SCRLBAR,
|
||||
LV_TILEVIEW_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR,
|
||||
LV_TILEVIEW_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH,
|
||||
_LV_TILEVIEW_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
|
||||
_LV_TILEVIEW_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST
|
||||
|
@ -544,9 +544,9 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
|
||||
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
lv_get_state_info_t * info = param;
|
||||
if(info->part == LV_WIN_PART_CONTENT_SCRL) info->result = lv_obj_get_state(lv_page_get_scrl(ext->page),
|
||||
if(info->part == LV_WIN_PART_CONTENT_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrl(ext->page),
|
||||
LV_CONT_PART_MAIN);
|
||||
else if(info->part == LV_WIN_PART_SCRLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCRLBAR);
|
||||
else if(info->part == LV_WIN_PART_SCROLLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCROLLBAR);
|
||||
else if(info->part == LV_WIN_PART_HEADER) info->result = lv_obj_get_state(ext->header, LV_OBJ_PART_MAIN);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@ -616,11 +616,11 @@ static lv_style_list_t * lv_win_get_style(lv_obj_t * win, uint8_t part)
|
||||
case LV_WIN_PART_HEADER:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->header, LV_OBJ_PART_MAIN);
|
||||
break;
|
||||
case LV_WIN_PART_SCRLBAR:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCRLBAR);
|
||||
case LV_WIN_PART_SCROLLBAR:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLBAR);
|
||||
break;
|
||||
case LV_WIN_PART_CONTENT_SCRL:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCRL);
|
||||
case LV_WIN_PART_CONTENT_SCROLLABLE:
|
||||
style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLABLE);
|
||||
break;
|
||||
default:
|
||||
style_dsc_p = NULL;
|
||||
|
@ -64,8 +64,8 @@ enum {
|
||||
LV_WIN_PART_BG = LV_OBJ_PART_MAIN, /**< Window object background style. */
|
||||
_LV_WIN_PART_VIRTUAL_LAST,
|
||||
LV_WIN_PART_HEADER = _LV_OBJ_PART_REAL_LAST, /**< Window titlebar background style. */
|
||||
LV_WIN_PART_CONTENT_SCRL, /**< Window content style. */
|
||||
LV_WIN_PART_SCRLBAR, /**< Window scrollbar style. */
|
||||
LV_WIN_PART_CONTENT_SCROLLABLE, /**< Window content style. */
|
||||
LV_WIN_PART_SCROLLBAR, /**< Window scrollbar style. */
|
||||
_LV_WIN_PART_REAL_LAST
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@ CC ?= gcc
|
||||
LVGL_DIR ?= ${shell pwd}/../..
|
||||
LVGL_DIR_NAME ?= lvgl
|
||||
|
||||
WARNINGS ?= -Werror -Wall -Wextra -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function -Wundef -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default -Wno-switch-enum -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body -Wtype-limits -Wshift-negative-value -Wstack-usage=1024 -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes -Wunreachable-code -Wno-switch-default -Wswitch-enum -Wreturn-type -Wmultichar -Wno-discarded-qualifiers -Wformat-security -Wno-ignored-qualifiers -Wno-sign-compare
|
||||
WARNINGS ?= -Werror -Wall -Wextra -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function -Wundef -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default -Wno-switch-enum -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body -Wtype-limits -Wshift-negative-value -Wstack-usage=2048 -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes -Wunreachable-code -Wno-switch-default -Wswitch-enum -Wreturn-type -Wmultichar -Wno-discarded-qualifiers -Wformat-security -Wno-ignored-qualifiers -Wno-sign-compare
|
||||
OPTIMIZATION ?= -O3 -g0
|
||||
|
||||
|
||||
|
@ -204,7 +204,7 @@ all_obj_all_features = {
|
||||
"LV_MEM_SIZE":32*1024,
|
||||
"LV_HOR_RES_MAX":480,
|
||||
"LV_VER_RES_MAX":320,
|
||||
"LV_COLOR_DEPTH":16,
|
||||
"LV_COLOR_DEPTH":32,
|
||||
"LV_USE_GROUP":1,
|
||||
"LV_USE_ANIMATION":1,
|
||||
"LV_ANTIALIAS":1,
|
||||
@ -281,6 +281,7 @@ advanced_features = {
|
||||
"LV_HOR_RES_MAX":800,
|
||||
"LV_VER_RES_MAX":480,
|
||||
"LV_COLOR_DEPTH":16,
|
||||
"LV_COLOR_16_SWAP":1,
|
||||
"LV_COLOR_SCREEN_TRANSP":1,
|
||||
"LV_USE_GROUP":1,
|
||||
"LV_USE_ANIMATION":1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user