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

minor fixes

This commit is contained in:
Gabor Kiss-Vamosi 2020-02-23 07:16:40 +01:00
parent f4f3cc2542
commit 66a25f158c
12 changed files with 47 additions and 44 deletions

View File

@ -467,6 +467,17 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
return LV_RES_INV;
}
#if LV_USE_ANIMATION
/**
* A function to be easily used in animation ready callback to delete an object when the animation is ready
* @param a pointer to the animation
*/
void lv_obj_del_anim_ready_cb(lv_anim_t * a)
{
lv_obj_del(a->var);
}
#endif
/**
* Helper function for asynchronously deleting objects.
* Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent).

View File

@ -320,6 +320,14 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy);
*/
lv_res_t lv_obj_del(lv_obj_t * obj);
#if LV_USE_ANIMATION
/**
* A function to be easily used in animation ready callback to delete an object when the animation is ready
* @param a pointer to the animation
*/
void lv_obj_del_anim_ready_cb(lv_anim_t * a);
#endif
/**
* Helper function for asynchronously deleting objects.
* Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent).

View File

@ -273,7 +273,8 @@ void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
}
/**
* Remove all styles added from style list, clear the local style and free all allocated memories
* Remove all styles added from style list, clear the local style, transition style and free all allocated memories.
* Leave `ignore_trans` flag as it is.
* @param list pointer to a style list.
*/
void lv_style_list_reset(lv_style_list_t * list)
@ -304,7 +305,9 @@ void lv_style_list_reset(lv_style_list_t * list)
list->has_local = 0;
list->has_trans = 0;
list->skip_trans = 0;
list->ignore_trans = 0;
/* Intentionally leave `ignore_trans` as it is,
* because it's independent from the styles in the list*/
}
/**

View File

@ -269,7 +269,8 @@ void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style);
void lv_style_list_remove_style(lv_style_list_t *, lv_style_t *);
/**
* Remove all styles added from style list, clear the local style and free all allocated memories
* Remove all styles added from style list, clear the local style, transition style and free all allocated memories.
* Leave `ignore_trans` flag as it is.
* @param list pointer to a style list.
*/
void lv_style_list_reset(lv_style_list_t * style_list);

View File

@ -56,6 +56,7 @@ static lv_style_t scr;
static lv_style_t panel; /*General fancy panel like car to hold other objects*/
static lv_style_t bg;
static lv_style_t btn;
static lv_style_t pad;
#if LV_USE_ARC
@ -249,6 +250,13 @@ static void basic_init(void)
lv_style_set_trans_prop_6(&btn, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
lv_style_set_trans_delay(&btn, LV_STATE_DEFAULT, 100);
lv_style_set_trans_delay(&btn, LV_STATE_PRESSED, 0);
lv_style_init(&pad);
lv_style_set_pad_inner(&pad, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_left(&pad, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_right(&pad, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_top(&pad, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_bottom(&pad, LV_STATE_DEFAULT, LV_DPI / 10);
}
static void cont_init(void)
@ -320,9 +328,9 @@ static void led_init(void)
lv_style_set_border_opa(&led, LV_STATE_DEFAULT, LV_OPA_50);
lv_style_set_border_color(&led, LV_STATE_DEFAULT, lv_color_lighten(_color_primary, LV_OPA_30));
lv_style_set_radius(&led, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
lv_style_set_shadow_width(&led, LV_STATE_DEFAULT, LV_DPI / 4);
lv_style_set_shadow_width(&led, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_shadow_color(&led, LV_STATE_DEFAULT, _color_primary);
lv_style_set_shadow_spread(&led, LV_STATE_DEFAULT, LV_DPI / 16);
lv_style_set_shadow_spread(&led, LV_STATE_DEFAULT, LV_DPI / 20);
#endif
}
@ -1094,6 +1102,7 @@ lv_style_list_add_style(list, &bar_bg);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
lv_style_list_add_style(list, &pad);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR);

View File

@ -77,7 +77,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
return NULL;
}
ext->toggle = 0;
ext->checkable = 0;
lv_obj_set_signal_cb(btn, lv_btn_signal);
lv_obj_set_design_cb(btn, lv_btn_design);
@ -94,7 +94,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
/*Copy 'copy'*/
else {
lv_btn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->toggle = copy_ext->toggle;
ext->checkable = copy_ext->checkable;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(btn);
@ -120,7 +120,7 @@ void lv_btn_set_checkable(lv_obj_t * btn, bool tgl)
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
ext->toggle = tgl != false ? 1 : 0;
ext->checkable = tgl != false ? 1 : 0;
}
/**
@ -211,7 +211,7 @@ bool lv_btn_get_checkable(const lv_obj_t * btn)
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
return ext->toggle != 0 ? true : false;
return ext->checkable != 0 ? true : false;
}
/**********************

View File

@ -52,7 +52,7 @@ typedef struct
lv_cont_ext_t cont;
/** 1: Toggle enabled*/
uint8_t toggle : 1;
uint8_t checkable : 1;
} lv_btn_ext_t;
/**Styles*/
@ -146,35 +146,6 @@ static inline void lv_btn_set_fit(lv_obj_t * btn, lv_fit_t fit)
lv_cont_set_fit(btn, fit);
}
/**
* Set time of the ink effect (draw a circle on click to animate in the new state)
* @param btn pointer to a button object
* @param time the time of the ink animation
*/
void lv_btn_set_ink_in_time(lv_obj_t * btn, uint16_t time);
/**
* Set the wait time before the ink disappears
* @param btn pointer to a button object
* @param time the time of the ink animation
*/
void lv_btn_set_ink_wait_time(lv_obj_t * btn, uint16_t time);
/**
* Set time of the ink out effect (animate to the released state)
* @param btn pointer to a button object
* @param time the time of the ink animation
*/
void lv_btn_set_ink_out_time(lv_obj_t * btn, uint16_t time);
/**
* Set a style of a button.
* @param btn pointer to button object
* @param type which style should be set
* @param style pointer to a style
* */
void lv_btn_set_style(lv_obj_t * btn, lv_btn_part_t type, const lv_style_t * style);
/*=====================
* Getter functions
*====================*/
@ -189,7 +160,7 @@ lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn);
/**
* Get the toggle enable attribute of the button
* @param btn pointer to a button object
* @return true: toggle enabled, false: disabled
* @return true: checkable enabled, false: disabled
*/
bool lv_btn_get_checkable(const lv_obj_t * btn);

View File

@ -881,7 +881,7 @@ static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, co
if(ser->points[p_act] != LV_CHART_POINT_DEF) {
/*Don't limit to `series_mask` to get full circles on the ends*/
lv_draw_rect(&point_area, clip_area, &point_dsc);
lv_draw_rect(&point_area, &series_mask, &point_dsc);
}
}

View File

@ -152,7 +152,6 @@ lv_obj_t * lv_keyboard_create(lv_obj_t * par, const lv_obj_t * copy)
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[ext->mode]);
lv_theme_apply(kb, LV_THEME_KEYBOARD);
}
/*Copy an existing keyboard*/
else {

View File

@ -769,7 +769,7 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
}
else {
lv_coord_t pad = lv_obj_get_style_pad_right(btn, LV_BTN_PART_MAIN);
lv_obj_set_size(label, btn->coords.x2 - label->coords.x1 - pad, font_h);
lv_obj_set_size(label, btn->coords.x2 - label->coords.x1 - pad + 1, font_h);
}
}
}

View File

@ -119,7 +119,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_set_drag(ext->scrl, true);
lv_obj_set_drag_throw(ext->scrl, true);
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
lv_cont_set_fit4(ext->scrl, LV_FIT_MAX, LV_FIT_MAX, LV_FIT_MAX, LV_FIT_MAX);
lv_cont_set_fit(ext->scrl, LV_FIT_MAX);
lv_obj_set_event_cb(ext->scrl, scrl_def_event_cb); /*Propagate some event to the background
object by default for convenience */
lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal);

View File

@ -150,6 +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_SB_MODE_DRAG);
lv_obj_reset_style_list(ta, LV_PAGE_PART_SCRL);
lv_theme_apply(ta, LV_THEME_TEXTAREA);
}