mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
minor renames and fixes
This commit is contained in:
parent
27621e0945
commit
d1f1332555
@ -2580,7 +2580,7 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
|
||||
switch(prop) {
|
||||
case LV_STYLE_TEXT_FONT:
|
||||
case LV_STYLE_VALUE_FONT:
|
||||
return LV_THEME_DEFAULT_FONT_NORMAL;
|
||||
return lv_theme_get_font_normal();
|
||||
#if LV_USE_ANIMATION
|
||||
case LV_STYLE_TRANSITION_PATH:
|
||||
return &lv_anim_path_def;
|
||||
|
@ -141,6 +141,11 @@ typedef enum {
|
||||
LV_THEME_WIN,
|
||||
LV_THEME_WIN_BTN, /*The buttons are initialized separately*/
|
||||
#endif
|
||||
|
||||
_LV_THEME_BUILTIN_LAST,
|
||||
_LV_THEME_CUSTOM_START = _LV_THEME_BUILTIN_LAST,
|
||||
_LV_THEME_CUSTOM_LAST = 0xFFFF,
|
||||
|
||||
} lv_theme_style_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -1205,10 +1205,10 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &list_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
break;
|
||||
|
||||
|
@ -850,10 +850,10 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
break;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
|
||||
|
||||
/**********************
|
||||
@ -377,13 +377,13 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_xcb = lv_theme_material_apply;
|
||||
theme.apply_xcb = theme_apply;
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
lv_style_list_t * list;
|
||||
|
||||
@ -703,11 +703,11 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
|
@ -836,10 +836,10 @@ static lv_style_list_t * lv_list_get_style(lv_obj_t * list, uint8_t part)
|
||||
case LV_LIST_PART_BG:
|
||||
style_dsc_p = &list->style_list;
|
||||
break;
|
||||
case LV_LIST_PART_SCRL:
|
||||
case LV_LIST_PART_SCROLLABLE:
|
||||
style_dsc_p = &ext->page.scrl->style_list;
|
||||
break;
|
||||
case LV_LIST_PART_SCRLBAR:
|
||||
case LV_LIST_PART_SCROLLBAR:
|
||||
style_dsc_p = &ext->page.scrlbar.style;
|
||||
break;
|
||||
#if LV_USE_ANIMATION
|
||||
|
@ -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_SCROLLBAR, /**< List scrollbar style. */
|
||||
LV_LIST_PART_SCROLLBAR = 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_SCROLLABLE, /**< List scrollable area style. */
|
||||
LV_LIST_PART_SCROLLABLE = 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;
|
||||
|
@ -953,14 +953,37 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DRAG_END) {
|
||||
|
||||
/*Scroll propagation is finished on drag end*/
|
||||
if(page_ext->scroll_prop_obj) {
|
||||
lv_obj_t * scroller_page = page_ext->scroll_prop_obj;
|
||||
lv_page_ext_t * scroller_page_ext = lv_obj_get_ext_attr(scroller_page);
|
||||
page_ext->scroll_prop_obj = NULL;
|
||||
lv_obj_set_drag_parent(scroller_page, false);
|
||||
lv_obj_set_drag_parent(lv_page_get_scrl(scroller_page), false);
|
||||
|
||||
/*Hide scrollbars if required*/
|
||||
if(scroller_page_ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) {
|
||||
lv_area_t sb_area_tmp;
|
||||
if(scroller_page_ext->scrlbar.hor_draw) {
|
||||
lv_area_copy(&sb_area_tmp, &scroller_page_ext->scrlbar.hor_area);
|
||||
sb_area_tmp.x1 += scroller_page->coords.x1;
|
||||
sb_area_tmp.y1 += scroller_page->coords.y1;
|
||||
sb_area_tmp.x2 += scroller_page->coords.x1;
|
||||
sb_area_tmp.y2 += scroller_page->coords.y1;
|
||||
lv_obj_invalidate_area(scroller_page, &sb_area_tmp);
|
||||
scroller_page_ext->scrlbar.hor_draw = 0;
|
||||
}
|
||||
if(scroller_page_ext->scrlbar.ver_draw) {
|
||||
lv_area_copy(&sb_area_tmp, &scroller_page_ext->scrlbar.ver_area);
|
||||
sb_area_tmp.x1 += scroller_page->coords.x1;
|
||||
sb_area_tmp.y1 += scroller_page->coords.y1;
|
||||
sb_area_tmp.x2 += scroller_page->coords.x1;
|
||||
sb_area_tmp.y2 += scroller_page->coords.y1;
|
||||
lv_obj_invalidate_area(scroller_page, &sb_area_tmp);
|
||||
scroller_page_ext->scrlbar.ver_draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*The scrolling can be chained so stop all of them*/
|
||||
lv_page_ext_t * scroller_ext = lv_obj_get_ext_attr(scroller_page);
|
||||
while(scroller_ext->scroll_prop_obj) {
|
||||
@ -1150,7 +1173,11 @@ static void scrl_reposition(lv_obj_t * page)
|
||||
if(refr_x || refr_y) {
|
||||
lv_obj_set_pos(scrl, new_x, new_y);
|
||||
}
|
||||
scrlbar_refresh(page);
|
||||
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
|
||||
/*The scrollbars are important only if they are visible now*/
|
||||
if(ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) scrlbar_refresh(page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1209,21 +1236,6 @@ static void scrlbar_refresh(lv_obj_t * page)
|
||||
lv_obj_invalidate_area(page, &sb_area_tmp);
|
||||
}
|
||||
|
||||
if(ext->scrlbar.mode == LV_SCRLBAR_MODE_DRAG) {
|
||||
lv_obj_t * indev_obj = lv_indev_get_obj_act();
|
||||
|
||||
if(indev_obj == NULL) return;
|
||||
while(indev_obj && lv_obj_get_drag_parent(indev_obj)) {
|
||||
indev_obj = lv_obj_get_parent(indev_obj);
|
||||
}
|
||||
|
||||
if(indev_obj != scrl) {
|
||||
ext->scrlbar.hor_draw = 0;
|
||||
ext->scrlbar.ver_draw = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*Full sized horizontal scrollbar*/
|
||||
if(scrl_w <= obj_w - bg_left - bg_right) {
|
||||
lv_area_set_width(&ext->scrlbar.hor_area, obj_w - 2 * sb_hor_pad);
|
||||
|
Loading…
x
Reference in New Issue
Block a user