mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
minor API changes
This commit is contained in:
parent
abae15ab7c
commit
3088849b63
@ -213,6 +213,20 @@ void lv_bar_set_sym(lv_obj_t * bar, bool en)
|
||||
ext->sym = en ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the animation time of the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param anim_time the animation time in milliseconds.
|
||||
*/
|
||||
void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_time = 0;
|
||||
#endif
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
ext->anim_time = anim_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a style of a bar
|
||||
* @param bar pointer to a bar object
|
||||
@ -285,6 +299,21 @@ bool lv_bar_get_sym(lv_obj_t * bar)
|
||||
return ext->sym ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the animation time of the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the animation time in milliseconds.
|
||||
*/
|
||||
uint16_t lv_bar_get_anim_time(lv_obj_t * bar, uint16_t anim_time)
|
||||
{
|
||||
#if LV_USE_ANIMATION
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
return ext->anim_time;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a style of a bar
|
||||
* @param bar pointer to a bar object
|
||||
|
@ -103,6 +103,13 @@ void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max);
|
||||
*/
|
||||
void lv_bar_set_sym(lv_obj_t * bar, bool en);
|
||||
|
||||
/**
|
||||
* Set the animation time of the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param anim_time the animation time in milliseconds.
|
||||
*/
|
||||
void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time);
|
||||
|
||||
/**
|
||||
* Set a style of a bar
|
||||
* @param bar pointer to a bar object
|
||||
@ -143,6 +150,13 @@ int16_t lv_bar_get_max_value(const lv_obj_t * bar);
|
||||
*/
|
||||
bool lv_bar_get_sym(lv_obj_t * bar);
|
||||
|
||||
/**
|
||||
* Get the animation time of the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the animation time in milliseconds.
|
||||
*/
|
||||
uint16_t lv_bar_get_anim_time(lv_obj_t * bar, uint16_t anim_time);
|
||||
|
||||
/**
|
||||
* Get a style of a bar
|
||||
* @param bar pointer to a bar object
|
||||
|
@ -260,12 +260,8 @@ void lv_btnm_set_map(const lv_obj_t * btnm, const char * map[])
|
||||
* length of the array and position of the elements must match
|
||||
* the number and order of the individual buttons (i.e. excludes
|
||||
* newline entries).
|
||||
* The control bits are:
|
||||
* - bit 5 : 1 = inactive (disabled)
|
||||
* - bit 4 : 1 = no repeat (on long press)
|
||||
* - bit 3 : 1 = hidden
|
||||
* - bit 2..0: Relative width compared to the buttons in the
|
||||
* same row. [1..7]
|
||||
* An element of the map should look like e.g.:
|
||||
* `ctrl_map[0] = width | LV_BTNM_CTRL_NO_REPEAT | LV_BTNM_CTRL_TGL_ENABLE`
|
||||
*/
|
||||
void lv_btnm_set_ctrl_map(const lv_obj_t * btnm, const lv_btnm_ctrl_t ctrl_map[])
|
||||
{
|
||||
@ -345,19 +341,29 @@ void lv_btnm_set_recolor(const lv_obj_t * btnm, bool en)
|
||||
* Set the attributes of a button of the button matrix
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
|
||||
* @param en true: set the attributes; false: clear the attributes
|
||||
*/
|
||||
void lv_btnm_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnm_ctrl_t ctrl, bool en)
|
||||
void lv_btnm_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnm_ctrl_t ctrl)
|
||||
{
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||
|
||||
if(btn_id >= ext->btn_cnt) return;
|
||||
if(en) {
|
||||
ext->ctrl_bits[btn_id] |= ctrl;
|
||||
} else {
|
||||
ext->ctrl_bits[btn_id] &= (~ctrl);
|
||||
}
|
||||
|
||||
ext->ctrl_bits[btn_id] |= ctrl;
|
||||
invalidate_button_area(btnm, btn_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the attributes of a button of the button matrix
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
|
||||
*/
|
||||
void lv_btnm_clear_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnm_ctrl_t ctrl)
|
||||
{
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||
|
||||
if(btn_id >= ext->btn_cnt) return;
|
||||
|
||||
ext->ctrl_bits[btn_id] &= (~ctrl);
|
||||
invalidate_button_area(btnm, btn_id);
|
||||
}
|
||||
|
||||
@ -365,16 +371,32 @@ void lv_btnm_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnm_ctrl_t
|
||||
* Set the attributes of all buttons of a button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param ctrl attribute(s) to set from `lv_btnm_ctrl_t`. Values can be ORed.
|
||||
* @param en true: set the attributes; false: clear the attributes
|
||||
*/
|
||||
void lv_btnm_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl, bool en)
|
||||
void lv_btnm_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl)
|
||||
{
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||
uint16_t i;
|
||||
for(i = 0; i < ext->btn_cnt; i++) {
|
||||
lv_btnm_set_btn_ctrl(btnm, i, ctrl, en);
|
||||
lv_btnm_set_btn_ctrl(btnm, i, ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the attributes of all buttons of a button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param ctrl attribute(s) to set from `lv_btnm_ctrl_t`. Values can be ORed.
|
||||
* @param en true: set the attributes; false: clear the attributes
|
||||
*/
|
||||
void lv_btnm_clear_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl)
|
||||
{
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||
uint16_t i;
|
||||
for(i = 0; i < ext->btn_cnt; i++) {
|
||||
lv_btnm_clear_btn_ctrl(btnm, i, ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a single buttons relative width.
|
||||
* This method will cause the matrix be regenerated and is a relatively
|
||||
@ -1048,9 +1070,9 @@ static void make_one_button_toggled(lv_obj_t * btnm, uint16_t btn_idx)
|
||||
/*Save whether the button was toggled*/
|
||||
bool was_toggled = lv_btnm_get_btn_ctrl(btnm, btn_idx, LV_BTNM_CTRL_TGL_STATE);
|
||||
|
||||
lv_btnm_set_btn_ctrl_all(btnm, LV_BTNM_CTRL_TGL_STATE, false);
|
||||
lv_btnm_clear_btn_ctrl_all(btnm, LV_BTNM_CTRL_TGL_STATE);
|
||||
|
||||
if(was_toggled) lv_btnm_set_btn_ctrl(btnm, btn_idx, LV_BTNM_CTRL_TGL_STATE, true);
|
||||
if(was_toggled) lv_btnm_set_btn_ctrl(btnm, btn_idx, LV_BTNM_CTRL_TGL_STATE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -107,12 +107,8 @@ void lv_btnm_set_map(const lv_obj_t * btnm, const char * map[]);
|
||||
* length of the array and position of the elements must match
|
||||
* the number and order of the individual buttons (i.e. excludes
|
||||
* newline entries).
|
||||
* The control bits are:
|
||||
* - bit 5 : 1 = inactive (disabled)
|
||||
* - bit 4 : 1 = no repeat (on long press)
|
||||
* - bit 3 : 1 = hidden
|
||||
* - bit 2..0: Relative width compared to the buttons in the
|
||||
* same row. [1..7]
|
||||
* An element of the map should look like e.g.:
|
||||
* `ctrl_map[0] = width | LV_BTNM_CTRL_NO_REPEAT | LV_BTNM_CTRL_TGL_ENABLE`
|
||||
*/
|
||||
void lv_btnm_set_ctrl_map(const lv_obj_t * btnm, const lv_btnm_ctrl_t ctrl_map[]);
|
||||
|
||||
@ -140,21 +136,33 @@ void lv_btnm_set_style(lv_obj_t * btnm, lv_btnm_style_t type, const lv_style_t *
|
||||
void lv_btnm_set_recolor(const lv_obj_t * btnm, bool en);
|
||||
|
||||
/**
|
||||
* Set/clear an attribute of a button of the button matrix
|
||||
* Set the attributes of a button of the button matrix
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
|
||||
* @param ctrl attribute(s) to change from `lv_btnm_ctrl_t`. Values can be ORed.
|
||||
* @param en true: set the attributes; false: clear the attributes
|
||||
*/
|
||||
void lv_btnm_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnm_ctrl_t ctrl, bool en);
|
||||
void lv_btnm_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnm_ctrl_t ctrl);
|
||||
|
||||
/**
|
||||
* Clear the attributes of a button of the button matrix
|
||||
* @param btnm pointer to button matrix object
|
||||
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
|
||||
*/
|
||||
void lv_btnm_clear_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnm_ctrl_t ctrl);
|
||||
|
||||
/**
|
||||
* Set the attributes of all buttons of a button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param ctrl attribute(s) to set from `lv_btnm_ctrl_t`. Values can be ORed.
|
||||
*/
|
||||
void lv_btnm_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl);
|
||||
|
||||
/**
|
||||
* Clear the attributes of all buttons of a button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param ctrl attribute(s) to set from `lv_btnm_ctrl_t`. Values can be ORed.
|
||||
* @param en true: set the attributes; false: clear the attributes
|
||||
*/
|
||||
void lv_btnm_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl, bool en);
|
||||
void lv_btnm_clear_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl);
|
||||
|
||||
/**
|
||||
* Set a single buttons relative width.
|
||||
|
@ -466,6 +466,7 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
||||
lv_point_t p;
|
||||
lv_indev_get_point(indev, &p);
|
||||
|
||||
/*If the header is pressed mark an arrow as pressed*/
|
||||
if(lv_area_is_point_on(&header_area, &p)) {
|
||||
if(p.x < header_area.x1 + lv_area_get_width(&header_area) / 2) {
|
||||
if(ext->btn_pressing != -1) lv_obj_invalidate(calendar);
|
||||
@ -478,10 +479,14 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
||||
ext->pressed_date.year = 0;
|
||||
ext->pressed_date.month = 0;
|
||||
ext->pressed_date.day = 0;
|
||||
} else if(calculate_touched_day(calendar, &p)) {
|
||||
}
|
||||
/*If a day is pressed save it*/
|
||||
else if(calculate_touched_day(calendar, &p)) {
|
||||
if(ext->btn_pressing != 0) lv_obj_invalidate(calendar);
|
||||
ext->btn_pressing = 0;
|
||||
} else {
|
||||
}
|
||||
/*ELse set a deafault state*/
|
||||
else {
|
||||
if(ext->btn_pressing != 0) lv_obj_invalidate(calendar);
|
||||
ext->btn_pressing = 0;
|
||||
ext->pressed_date.year = 0;
|
||||
|
@ -549,6 +549,58 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
|
||||
lv_refr_set_disp_refreshing(refr_ori);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw an image on the canvas
|
||||
* @param canvas pointer to a canvas object
|
||||
* @param src image source. Can be a pointer an `lv_img_dsc_t` variable or a path an image.
|
||||
* @param style style of the image (`image` properties are used)
|
||||
*/
|
||||
void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const void * src, const lv_style_t * style)
|
||||
{
|
||||
lv_img_dsc_t * dsc = lv_canvas_get_img(canvas);
|
||||
|
||||
/* Create a dummy display to fool the lv_draw function.
|
||||
* It will think it draws to real screen. */
|
||||
lv_area_t mask;
|
||||
mask.x1 = 0;
|
||||
mask.x2 = dsc->header.w - 1;
|
||||
mask.y1 = 0;
|
||||
mask.y2 = dsc->header.h - 1;
|
||||
|
||||
lv_img_header_t header;
|
||||
lv_res_t res = lv_img_decoder_get_info(src, &header);
|
||||
if(res != LV_RES_OK) {
|
||||
LV_LOG_WARN("lv_canvas_draw_img: Couldn't get the image data.");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t coords;
|
||||
coords.x1 = x;
|
||||
coords.y1 = y;
|
||||
coords.x2 = x + header.w - 1;
|
||||
coords.y2 = y + header.h - 1;
|
||||
|
||||
lv_disp_t disp;
|
||||
memset(&disp, 0, sizeof(lv_disp_t));
|
||||
|
||||
lv_disp_buf_t disp_buf;
|
||||
lv_disp_buf_init(&disp_buf, (void *)dsc->data, NULL, dsc->header.w * dsc->header.h);
|
||||
lv_area_copy(&disp_buf.area, &mask);
|
||||
|
||||
lv_disp_drv_init(&disp.driver);
|
||||
|
||||
disp.driver.buffer = &disp_buf;
|
||||
disp.driver.hor_res = dsc->header.w;
|
||||
disp.driver.ver_res = dsc->header.h;
|
||||
|
||||
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
|
||||
lv_refr_set_disp_refreshing(&disp);
|
||||
|
||||
lv_draw_img(&coords, &mask, src, style, LV_OPA_COVER);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw a line on the canvas
|
||||
* @param canvas pointer to a canvas object
|
||||
|
@ -71,8 +71,7 @@ lv_obj_t * lv_canvas_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
* @param canvas pointer to a canvas object
|
||||
* @param w width of the canvas
|
||||
* @param h height of the canvas
|
||||
* @param cf color format. The following formats are supported:
|
||||
* LV_IMG_CF_TRUE_COLOR, LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, LV_IMG_CF_INDEXES_1/2/4/8BIT
|
||||
* @param cf color format. `LV_IMG_CF_...`
|
||||
*/
|
||||
void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
|
||||
|
||||
@ -142,13 +141,13 @@ const lv_style_t * lv_canvas_get_style(const lv_obj_t * canvas, lv_canvas_style_
|
||||
* @param canvas pointer to a canvas object
|
||||
* @param to_copy buffer to copy. The color format has to match with the canvas's buffer color
|
||||
* format
|
||||
* @param w width of the buffer to copy
|
||||
* @param h height of the buffer to copy
|
||||
* @param x left side of the destination position
|
||||
* @param y top side of the destination position
|
||||
* @param w width of the buffer to copy
|
||||
* @param h height of the buffer to copy
|
||||
*/
|
||||
void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t w, lv_coord_t h, lv_coord_t x,
|
||||
lv_coord_t y);
|
||||
void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x,
|
||||
lv_coord_t y, lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Rotate and image and store the result on a canvas.
|
||||
@ -198,6 +197,15 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
|
||||
void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_t max_w, const lv_style_t * style,
|
||||
const char * txt, lv_label_align_t align);
|
||||
|
||||
|
||||
/**
|
||||
* Draw an image on the canvas
|
||||
* @param canvas pointer to a canvas object
|
||||
* @param src image source. Can be a pointer an `lv_img_dsc_t` variable or a path an image.
|
||||
* @param style style of the image (`image` properties are used)
|
||||
*/
|
||||
void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const void * src, const lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Draw a line on the canvas
|
||||
* @param canvas pointer to a canvas object
|
||||
@ -236,20 +244,17 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_
|
||||
#define LV_CANVAS_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(w, h) ((LV_COLOR_SIZE / 8) * w * h)
|
||||
#define LV_CANVAS_BUF_SIZE_TRUE_COLOR_ALPHA(w, h) (LV_IMG_PX_SIZE_ALPHA_BYTE * w * h)
|
||||
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) \
|
||||
((((w / 8) + 1) * h)) /*(w / 8) + 1): to be sure no fractional row; LV_COLOR_SIZE / 8) * 2: palette*/
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2) /*4 * 2: palette*/
|
||||
/*+ 1: to be sure no fractional row*/
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) ((((w / 8) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) ((((w / 4) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) ((((w / 2) + 1) * h))
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h))
|
||||
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) \
|
||||
((((w / 4) + 1) * h)) /*(w / 8) + 1): to be sure no fractional row; LV_COLOR_SIZE / 8) * 2: palette*/
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_2BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) + 4 * 4) /*4 * 4: palette*/
|
||||
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) \
|
||||
((((w / 2) + 1) * h)) /*(w / 8) + 1): to be sure no fractional row; LV_COLOR_SIZE / 8) * 2: palette*/
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_4BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) + 4 * 16) /*4 * 16: palette*/
|
||||
|
||||
#define LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h))
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_8BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) + 4 * 256) /*4 * 256: palette*/
|
||||
/*4 * X: for palette*/
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_1BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2)
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_2BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_2BIT(w, h) + 4 * 4)
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_4BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_4BIT(w, h) + 4 * 16)
|
||||
#define LV_CANVAS_BUF_SIZE_INDEXED_8BIT(w, h) (LV_CANVAS_BUF_SIZE_ALPHA_8BIT(w, h) + 4 * 256)
|
||||
|
||||
#endif /*LV_USE_CANVAS*/
|
||||
|
||||
|
@ -141,6 +141,16 @@ static inline bool lv_cb_is_checked(const lv_obj_t * cb)
|
||||
return lv_btn_get_state(cb) == LV_BTN_STATE_REL ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether the check box is inactive or not.
|
||||
* @param cb pointer to a check box object
|
||||
* @return true: inactive; false: not inactive
|
||||
*/
|
||||
static inline bool lv_cb_is_inactive(const lv_obj_t * cb)
|
||||
{
|
||||
return lv_btn_get_state(cb) == LV_BTN_STATE_INA ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a style of a button
|
||||
* @param cb pointer to check box object
|
||||
|
@ -35,6 +35,7 @@ extern "C" {
|
||||
|
||||
/*Chart types*/
|
||||
enum {
|
||||
LV_CHART_TYPE_NONE = 0x00, /*Don't draw the series*/
|
||||
LV_CHART_TYPE_LINE = 0x01, /*Connect the points with lines*/
|
||||
LV_CHART_TYPE_COLUMN = 0x02, /*Draw columns*/
|
||||
LV_CHART_TYPE_POINT = 0x04, /*Draw circles on the points*/
|
||||
@ -43,10 +44,10 @@ enum {
|
||||
};
|
||||
typedef uint8_t lv_chart_type_t;
|
||||
|
||||
/*Chart update mode*/
|
||||
/*Chart update mode for `lv_chart_set_next`*/
|
||||
enum {
|
||||
LV_CHART_UPDATE_MODE_SHIFT,
|
||||
LV_CHART_UPDATE_MODE_CIRCULAR,
|
||||
LV_CHART_UPDATE_MODE_SHIFT, /*Shift old data to the left and add the new one o the right*/
|
||||
LV_CHART_UPDATE_MODE_CIRCULAR, /*Add the new data in a circular way*/
|
||||
};
|
||||
typedef uint8_t lv_chart_update_mode_t;
|
||||
|
||||
@ -240,7 +241,7 @@ static inline void lv_chart_set_style(lv_obj_t * chart, lv_chart_style_t type, c
|
||||
void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin);
|
||||
|
||||
/**
|
||||
* Set the x/y-axis ticks of a chart
|
||||
* Set the y-axis ticks of a chart
|
||||
* @param chart pointer to a chart object
|
||||
* @param list_of_values list of string values, terminated with \n, except the last
|
||||
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
|
||||
@ -252,6 +253,16 @@ void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin);
|
||||
void lv_chart_set_x_ticks(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, uint8_t major_tick_len,
|
||||
uint8_t minor_tick_len, lv_chart_axis_options_t options);
|
||||
|
||||
/**
|
||||
* Set the y-axis ticks of a chart
|
||||
* @param chart pointer to a chart object
|
||||
* @param list_of_values list of string values, terminated with \n, except the last
|
||||
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
|
||||
* else step in ticks between two value labels
|
||||
* @param major_tick_len the length of the major tick, AUTO if 0
|
||||
* @param minor_tick_len the length of the minor tick, AUTO if 0
|
||||
* @param options extra options
|
||||
*/
|
||||
void lv_chart_set_y_ticks(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, uint8_t major_tick_len,
|
||||
uint8_t minor_tick_len, lv_chart_axis_options_t options);
|
||||
|
||||
|
@ -210,11 +210,12 @@ void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
|
||||
lv_obj_invalidate(ddlist);
|
||||
}
|
||||
|
||||
lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &ext->sel_opt_id);
|
||||
uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/
|
||||
lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fix height for the drop down list
|
||||
* Set a fix height for the drop down list
|
||||
* If 0 then the opened ddlist will be auto. sized else the set height will be applied.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param h the height when the list is opened (0: auto size)
|
||||
@ -230,13 +231,18 @@ void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h)
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable the horizontal fit to the content
|
||||
* Set a fix width for the drop down list
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param fit fit mode from `lv_fit_t` (Typically `LV_FIT_NONE` or `LV_FIT_TIGHT`)
|
||||
* @param w the width when the list is opened (0: auto size)
|
||||
*/
|
||||
void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, lv_fit_t fit)
|
||||
void lv_ddlist_set_fix_width(lv_obj_t * ddlist, lv_coord_t w)
|
||||
{
|
||||
lv_cont_set_fit2(ddlist, fit, lv_cont_get_fit_bottom(ddlist));
|
||||
if(w == 0) {
|
||||
lv_cont_set_fit2(ddlist, LV_FIT_TIGHT, lv_cont_get_fit_bottom(ddlist));
|
||||
} else {
|
||||
lv_cont_set_fit2(ddlist, LV_FIT_NONE, lv_cont_get_fit_bottom(ddlist));
|
||||
lv_obj_set_width(ddlist, w);
|
||||
}
|
||||
|
||||
lv_ddlist_refr_size(ddlist, false);
|
||||
}
|
||||
@ -811,7 +817,8 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
|
||||
ext->sel_opt_id_ori = ext->sel_opt_id;
|
||||
}
|
||||
|
||||
lv_res_t res = lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &ext->sel_opt_id);
|
||||
uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/
|
||||
lv_res_t res = lv_event_send(ddlist, LV_EVENT_VALUE_CHANGED, &id);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
if(ext->stay_open == 0) {
|
||||
|
@ -97,7 +97,7 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char * options);
|
||||
void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt);
|
||||
|
||||
/**
|
||||
* Set the fix height for the drop down list
|
||||
* Set a fix height for the drop down list
|
||||
* If 0 then the opened ddlist will be auto. sized else the set height will be applied.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param h the height when the list is opened (0: auto size)
|
||||
@ -105,11 +105,11 @@ void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt);
|
||||
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Enable or disable the horizontal fit to the content
|
||||
* Set a fix width for the drop down list
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param fit fit mode from `lv_fit_t` (Typically `LV_FIT_NONE` or `LV_FIT_TIGHT`)
|
||||
* @param w the width when the list is opened (0: auto size)
|
||||
*/
|
||||
void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, lv_fit_t fit);
|
||||
void lv_ddlist_set_fix_width(lv_obj_t * ddlist, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set arrow draw in a drop down list
|
||||
|
@ -455,10 +455,10 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * mask)
|
||||
style_neddle_mid.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
lv_area_t nm_cord;
|
||||
nm_cord.x1 = x_ofs - style->body.padding.top;
|
||||
nm_cord.y1 = y_ofs - style->body.padding.top;
|
||||
nm_cord.x2 = x_ofs + style->body.padding.top;
|
||||
nm_cord.y2 = y_ofs + style->body.padding.top;
|
||||
nm_cord.x1 = x_ofs - style->body.radius;
|
||||
nm_cord.y1 = y_ofs - style->body.radius;
|
||||
nm_cord.x2 = x_ofs + style->body.radius;
|
||||
nm_cord.y2 = y_ofs + style->body.radius;
|
||||
|
||||
lv_draw_rect(&nm_cord, mask, &style_neddle_mid, lv_obj_get_opa_scale(gauge));
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ void lv_mbox_add_btns(lv_obj_t * mbox, const char ** btn_map)
|
||||
}
|
||||
|
||||
lv_btnm_set_map(ext->btnm, btn_map);
|
||||
lv_btnm_set_btn_ctrl_all(ext->btnm, LV_BTNM_CTRL_CLICK_TRIG | LV_BTNM_CTRL_NO_REPEAT, true);
|
||||
lv_btnm_set_btn_ctrl_all(ext->btnm, LV_BTNM_CTRL_CLICK_TRIG | LV_BTNM_CTRL_NO_REPEAT);
|
||||
lv_obj_set_parent_event(ext->btnm, true);
|
||||
|
||||
mbox_realign(mbox);
|
||||
|
@ -98,13 +98,13 @@ void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_
|
||||
void lv_roller_set_visible_row_count(lv_obj_t * roller, uint8_t row_cnt);
|
||||
|
||||
/**
|
||||
* Enable or disable the horizontal fit to the content
|
||||
* @param roller pointer to a roller
|
||||
* @param fit fit mode from `lv_fit_t` (Typically `LV_FIT_NONE` or `LV_FIT_TIGHT`)
|
||||
* Set a fix width for the drop down list
|
||||
* @param roller pointer to a roller obejct
|
||||
* @param w the width when the list is opened (0: auto size)
|
||||
*/
|
||||
static inline void lv_roller_set_hor_fit(lv_obj_t * roller, lv_fit_t fit)
|
||||
static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w)
|
||||
{
|
||||
lv_ddlist_set_hor_fit(roller, fit);
|
||||
lv_ddlist_set_fix_width(roller, w);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,6 +92,16 @@ static inline void lv_slider_set_range(lv_obj_t * slider, int16_t min, int16_t m
|
||||
lv_bar_set_range(slider, min, max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the animation time of the slider
|
||||
* @param slider pointer to a bar object
|
||||
* @param anim_time the animation time in milliseconds.
|
||||
*/
|
||||
static void lv_slider_set_anim_time(lv_obj_t * slider, uint16_t anim_time)
|
||||
{
|
||||
lv_bar_set_anim_time(slider, anim_time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'knob in' attribute of a slider
|
||||
* @param slider pointer to slider object
|
||||
|
@ -274,7 +274,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
||||
btnm_ext->map_p = NULL;
|
||||
|
||||
lv_btnm_set_map(ext->btns, ext->tab_name_ptr);
|
||||
lv_btnm_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_NO_REPEAT, true);
|
||||
lv_btnm_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_NO_REPEAT);
|
||||
|
||||
/*Modify the indicator size*/
|
||||
const lv_style_t * style_tabs = lv_obj_get_style(ext->btns);
|
||||
@ -341,7 +341,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
|
||||
if(id != ext->tab_cur) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id);
|
||||
if(res != LV_RES_OK) return;
|
||||
|
||||
lv_btnm_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE, false);
|
||||
lv_btnm_clear_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE);
|
||||
|
||||
ext->tab_cur = id;
|
||||
|
||||
@ -441,7 +441,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_btnm_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE, true);
|
||||
lv_btnm_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -935,8 +935,8 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event)
|
||||
uint16_t btn_id = lv_btnm_get_active_btn(tab_btnm);
|
||||
if(btn_id == LV_BTNM_BTN_NONE) return;
|
||||
|
||||
lv_btnm_set_btn_ctrl_all(tab_btnm, LV_BTNM_CTRL_TGL_STATE, false);
|
||||
lv_btnm_set_btn_ctrl(tab_btnm, btn_id, LV_BTNM_CTRL_TGL_STATE, true);
|
||||
lv_btnm_clear_btn_ctrl_all(tab_btnm, LV_BTNM_CTRL_TGL_STATE);
|
||||
lv_btnm_set_btn_ctrl(tab_btnm, btn_id, LV_BTNM_CTRL_TGL_STATE);
|
||||
|
||||
lv_obj_t * tab = lv_obj_get_parent(tab_btnm);
|
||||
lv_tabview_set_tab_act(tab, btn_id, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user