mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-23 15:56:59 +08:00
refactor(xml): use single properties and introduce the prop-paramX syntax
e.g. <lv_roller options=... options-mode=normal/>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -403,6 +403,8 @@ int64_t lv_pow(int64_t base, int8_t exp)
|
||||
|
||||
int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out)
|
||||
{
|
||||
if(max_in == min_in) return min_out; /*Avoid division by zero later*/
|
||||
|
||||
if(max_in >= min_in && x >= max_in) return max_out;
|
||||
if(max_in >= min_in && x <= min_in) return min_out;
|
||||
|
||||
|
||||
@@ -113,15 +113,11 @@ int32_t lv_xml_atoi_split(const char ** str, char delimiter)
|
||||
if(*s != '\0') s++; /*Skip the delimiter*/
|
||||
*str = s;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int32_t lv_xml_atoi(const char * str)
|
||||
{
|
||||
|
||||
return lv_xml_atoi_split(&str, '\0');
|
||||
|
||||
}
|
||||
|
||||
int32_t lv_xml_strtol(const char * str, char ** endptr, int32_t base)
|
||||
|
||||
@@ -54,36 +54,14 @@ void lv_xml_arc_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
const char * name = attrs[i];
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("angles", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
int32_t v2 = lv_xml_atoi(buf_p);
|
||||
lv_arc_set_angles(item, v1, v2);
|
||||
}
|
||||
else if(lv_streq("bg_angles", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
int32_t v2 = lv_xml_atoi(buf_p);
|
||||
lv_arc_set_bg_angles(item, v1, v2);
|
||||
}
|
||||
else if(lv_streq("range", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
int32_t v2 = lv_xml_atoi(buf_p);
|
||||
lv_arc_set_range(item, v1, v2);
|
||||
}
|
||||
else if(lv_streq("value", name)) {
|
||||
lv_arc_set_value(item, lv_xml_atoi(value));
|
||||
}
|
||||
else if(lv_streq("mode", name)) {
|
||||
lv_arc_set_mode(item, mode_text_to_enum_value(value));
|
||||
}
|
||||
if(lv_streq("start_angle", name)) lv_arc_set_start_angle(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("end_angle", name)) lv_arc_set_end_angle(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("bg_start_angle", name)) lv_arc_set_bg_start_angle(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("bg_end_angle", name)) lv_arc_set_bg_end_angle(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("value", name)) lv_arc_set_value(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("min_value", name)) lv_arc_set_min_value(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("max_value", name)) lv_arc_set_max_value(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("mode", name)) lv_arc_set_mode(item, mode_text_to_enum_value(value));
|
||||
else if(lv_streq("bind_value", name)) {
|
||||
lv_subject_t * subject = lv_xml_get_subject(&state->scope, value);
|
||||
if(subject) {
|
||||
@@ -100,7 +78,6 @@ void lv_xml_arc_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
static lv_arc_mode_t mode_text_to_enum_value(const char * txt)
|
||||
{
|
||||
if(lv_streq("normal", txt)) return LV_ARC_MODE_NORMAL;
|
||||
|
||||
@@ -56,31 +56,21 @@ void lv_xml_bar_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("value", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
bool v2 = lv_xml_to_bool(buf_p);
|
||||
lv_bar_set_value(item, v1, v2);
|
||||
int32_t v = lv_xml_atoi(value);
|
||||
const char * anim_str = lv_xml_get_value_of(attrs, "value-animated");
|
||||
bool anim = anim_str ? lv_xml_to_bool(anim_str) : false;
|
||||
lv_bar_set_value(item, v, anim);
|
||||
}
|
||||
if(lv_streq("start_value", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
bool v2 = lv_xml_to_bool(buf_p);
|
||||
lv_bar_set_start_value(item, v1, v2);
|
||||
else if(lv_streq("start_value", name)) {
|
||||
int32_t v = lv_xml_atoi(value);
|
||||
const char * anim_str = lv_xml_get_value_of(attrs, "start_value-animated");
|
||||
bool anim = anim_str ? lv_xml_to_bool(anim_str) : false;
|
||||
lv_bar_set_start_value(item, v, anim);
|
||||
}
|
||||
if(lv_streq("min_value", name)) lv_bar_set_min_value(item, lv_xml_atoi(value));
|
||||
if(lv_streq("max_value", name)) lv_bar_set_max_value(item, lv_xml_atoi(value));
|
||||
if(lv_streq("orientation", name)) lv_bar_set_orientation(item, orentation_text_to_enum_value(value));
|
||||
if(lv_streq("mode", name)) lv_bar_set_mode(item, mode_text_to_enum_value(value));
|
||||
if(lv_streq("range", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
int32_t v2 = lv_xml_atoi(buf_p);
|
||||
lv_bar_set_range(item, v1, v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,19 +55,11 @@ void lv_xml_calendar_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
const char * name = attrs[i];
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("today_date", name)) {
|
||||
const char * bufp = value;
|
||||
int32_t y = lv_xml_atoi_split(&bufp, ' ');
|
||||
int32_t m = lv_xml_atoi_split(&bufp, ' ');
|
||||
int32_t d = lv_xml_atoi_split(&bufp, ' ');
|
||||
lv_calendar_set_today_date(item, y, m, d);
|
||||
}
|
||||
else if(lv_streq("shown_month", name)) {
|
||||
const char * bufp = value;
|
||||
int32_t y = lv_xml_atoi_split(&bufp, ' ');
|
||||
int32_t m = lv_xml_atoi_split(&bufp, ' ');
|
||||
lv_calendar_set_month_shown(item, y, m);
|
||||
}
|
||||
if(lv_streq("today_year", name)) lv_calendar_set_today_year(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("today_month", name)) lv_calendar_set_today_month(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("today_day", name)) lv_calendar_set_today_day(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("shown_year", name)) lv_calendar_set_shown_year(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("shown_month", name)) lv_calendar_set_shown_month(item, lv_xml_atoi(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,11 +68,11 @@ void lv_xml_chart_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
}
|
||||
else if(lv_streq("type", name)) lv_chart_set_type(item, chart_type_to_enum(value));
|
||||
else if(lv_streq("update_mode", name)) lv_chart_set_update_mode(item, chart_update_mode_to_enum(value));
|
||||
else if(lv_streq("div_line_count", name)) {
|
||||
|
||||
int32_t value1 = lv_xml_atoi_split(&value, ' ');
|
||||
int32_t value2 = lv_xml_atoi_split(&value, ' ');
|
||||
lv_chart_set_div_line_count(item, value1, value2);
|
||||
else if(lv_streq("hor_div_line_count", name)) {
|
||||
lv_chart_set_hor_div_line_count(item, lv_xml_atoi(value));
|
||||
}
|
||||
else if(lv_streq("ver_div_line_count", name)) {
|
||||
lv_chart_set_ver_div_line_count(item, lv_xml_atoi(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,11 +160,8 @@ void lv_xml_chart_axis_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
const char * name = attrs[i];
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("range", name)) {
|
||||
int32_t min_val = lv_xml_atoi_split(&value, ' ');
|
||||
int32_t max_val = lv_xml_atoi_split(&value, ' ');
|
||||
lv_chart_set_axis_range(chart, axis, min_val, max_val);
|
||||
}
|
||||
if(lv_streq("min_value", name)) lv_chart_set_axis_min_value(chart, axis, lv_xml_atoi(value));
|
||||
if(lv_streq("max_value", name)) lv_chart_set_axis_max_value(chart, axis, lv_xml_atoi(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,11 +65,8 @@ void lv_xml_image_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
if(lv_streq("rotation", name)) lv_image_set_rotation(item, lv_xml_atoi(value));
|
||||
if(lv_streq("scale_x", name)) lv_image_set_scale_x(item, lv_xml_atoi(value));
|
||||
if(lv_streq("scale_y", name)) lv_image_set_scale_y(item, lv_xml_atoi(value));
|
||||
if(lv_streq("pivot", name)) {
|
||||
int32_t x = lv_xml_atoi_split(&value, ' ');
|
||||
int32_t y = lv_xml_atoi_split(&value, ' ');
|
||||
lv_image_set_pivot(item, x, y);
|
||||
}
|
||||
if(lv_streq("pivot_x", name)) lv_image_set_pivot_x(item, lv_xml_to_size(value));
|
||||
if(lv_streq("pivot_y", name)) lv_image_set_pivot_y(item, lv_xml_to_size(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,30 +57,19 @@ void lv_xml_label_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("text", name)) lv_label_set_text(item, value);
|
||||
if(lv_streq("long_mode", name)) lv_label_set_long_mode(item, long_mode_text_to_enum_value(value));
|
||||
if(lv_streq("bind_text", name)) {
|
||||
char buf[256];
|
||||
lv_strncpy(buf, value, sizeof(buf));
|
||||
char * bufp = buf;
|
||||
char * subject_name = lv_xml_split_str(&bufp, ' ');
|
||||
if(subject_name) {
|
||||
lv_subject_t * subject = lv_xml_get_subject(&state->scope, subject_name);
|
||||
if(subject) {
|
||||
char * fmt = bufp; /*The second part is the format text*/
|
||||
if(fmt && fmt[0] == '\0') fmt = NULL;
|
||||
if(fmt) {
|
||||
if(fmt[0] == '\'') fmt++;
|
||||
size_t fmt_len = lv_strlen(fmt);
|
||||
if(fmt_len != 0 && fmt[fmt_len - 1] == '\'') fmt[fmt_len - 1] = '\0';
|
||||
fmt = lv_strdup(fmt);
|
||||
lv_obj_add_event_cb(item, free_fmt_event_cb, LV_EVENT_DELETE, fmt);
|
||||
}
|
||||
lv_label_bind_text(item, subject, fmt);
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Subject \"%s\" doesn't exist in label bind_text", value);
|
||||
}
|
||||
else if(lv_streq("long_mode", name)) lv_label_set_long_mode(item, long_mode_text_to_enum_value(value));
|
||||
else if(lv_streq("bind_text", name)) {
|
||||
lv_subject_t * subject = lv_xml_get_subject(&state->scope, value);
|
||||
if(subject == NULL) {
|
||||
LV_LOG_WARN("Subject \"%s\" doesn't exist in label bind_text", value);
|
||||
continue;
|
||||
}
|
||||
const char * fmt = lv_xml_get_value_of(attrs, "bind_text-fmt");
|
||||
if(fmt) {
|
||||
fmt = lv_strdup(fmt);
|
||||
lv_obj_add_event_cb(item, free_fmt_event_cb, LV_EVENT_DELETE, (void *) fmt);
|
||||
}
|
||||
lv_label_bind_text(item, subject, fmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ void lv_obj_xml_style_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
lv_strncpy(buf, selector_str, sizeof(buf));
|
||||
|
||||
char * bufp = buf;
|
||||
const char * next = lv_xml_split_str(&bufp, ' ');
|
||||
const char * next = lv_xml_split_str(&bufp, '|');
|
||||
|
||||
while(next) {
|
||||
/* Handle different states and parts */
|
||||
@@ -175,7 +175,7 @@ void lv_obj_xml_style_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
selector |= lv_xml_style_part_to_enum(next);
|
||||
|
||||
/* Move to the next token */
|
||||
next = lv_xml_split_str(&bufp, ' ');
|
||||
next = lv_xml_split_str(&bufp, '|');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,39 +55,19 @@ void lv_xml_roller_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("selected", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
bool v2 = lv_xml_to_bool(buf_p);
|
||||
lv_roller_set_selected(item, v1, v2);
|
||||
int32_t v = lv_xml_atoi(value);
|
||||
const char * anim_str = lv_xml_get_value_of(attrs, "value-animated");
|
||||
bool anim = anim_str ? lv_xml_to_bool(anim_str) : false;
|
||||
lv_roller_set_selected(item, v, anim);
|
||||
}
|
||||
if(lv_streq("visible_row_count", name)) {
|
||||
lv_roller_set_visible_row_count(item, lv_xml_atoi(value));
|
||||
}
|
||||
|
||||
if(lv_streq("options", name)) {
|
||||
/*E.g. 'a\nb\nc' true'*/
|
||||
size_t opts_len = lv_strlen(value);
|
||||
char * opts_buf = lv_malloc(opts_len + 1);
|
||||
lv_memcpy(opts_buf, value, opts_len + 1);
|
||||
LV_ASSERT_MALLOC(opts_buf);
|
||||
|
||||
/*Find the last space and trim the rest*/
|
||||
uint32_t space_pos_from_back = 1;
|
||||
while(space_pos_from_back < opts_len && value[opts_len - space_pos_from_back] != ' ') {
|
||||
space_pos_from_back++;
|
||||
}
|
||||
|
||||
opts_buf[opts_len - space_pos_from_back - 1] = '\0'; /*Also trim the `'`*/
|
||||
|
||||
lv_roller_mode_t mode = mode_text_to_enum_value(&opts_buf[opts_len - space_pos_from_back + 1]);
|
||||
|
||||
/*Also skip the leading `'`*/
|
||||
lv_roller_set_options(item, opts_buf + 1, mode);
|
||||
|
||||
lv_free(opts_buf);
|
||||
|
||||
const char * mode_str = lv_xml_get_value_of(attrs, "options-mode");
|
||||
lv_roller_mode_t mode = mode_str ? mode_text_to_enum_value(mode_str) : LV_ROLLER_MODE_NORMAL;
|
||||
lv_roller_set_options(item, value, mode);
|
||||
}
|
||||
else if(lv_streq("bind_value", name)) {
|
||||
lv_subject_t * subject = lv_xml_get_subject(&state->scope, value);
|
||||
|
||||
@@ -65,11 +65,8 @@ void lv_xml_scale_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
else if(lv_streq("label_show", name)) lv_scale_set_label_show(item, lv_xml_to_bool(value));
|
||||
else if(lv_streq("post_draw", name)) lv_scale_set_post_draw(item, lv_xml_to_bool(value));
|
||||
else if(lv_streq("draw_ticks_on_top", name)) lv_scale_set_draw_ticks_on_top(item, lv_xml_to_bool(value));
|
||||
else if(lv_streq("range", name)) {
|
||||
int32_t value1 = lv_xml_atoi_split(&value, ' ');
|
||||
int32_t value2 = lv_xml_atoi_split(&value, ' ');
|
||||
lv_scale_set_range(item, value1, value2);
|
||||
}
|
||||
else if(lv_streq("min_value", name)) lv_scale_set_min_value(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("max_value", name)) lv_scale_set_max_value(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("angle_range", name)) lv_scale_set_angle_range(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("rotation", name)) lv_scale_set_rotation(item, lv_xml_to_bool(value));
|
||||
}
|
||||
@@ -94,11 +91,8 @@ void lv_xml_scale_section_apply(lv_xml_parser_state_t * state, const char ** att
|
||||
const char * name = attrs[i];
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("range", name)) {
|
||||
int32_t value1 = lv_xml_atoi_split(&value, ' ');
|
||||
int32_t value2 = lv_xml_atoi_split(&value, ' ');
|
||||
lv_scale_set_section_range(scale, section, value1, value2);
|
||||
}
|
||||
if(lv_streq("min_value", name)) lv_scale_set_section_min_value(scale, section, lv_xml_atoi(value));
|
||||
else if(lv_streq("max_value", name)) lv_scale_set_section_max_value(scale, section, lv_xml_atoi(value));
|
||||
else if(lv_streq("style_main", name)) {
|
||||
lv_xml_style_t * style_dsc = lv_xml_get_style_by_name(&state->scope, value);
|
||||
lv_scale_set_section_style_main(scale, section, &style_dsc->style);
|
||||
|
||||
@@ -56,14 +56,18 @@ void lv_xml_slider_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
const char * value = attrs[i + 1];
|
||||
|
||||
if(lv_streq("value", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
bool v2 = lv_xml_to_bool(buf_p);
|
||||
lv_bar_set_value(item, v1, v2);
|
||||
int32_t v = lv_xml_atoi(value);
|
||||
const char * anim_str = lv_xml_get_value_of(attrs, "value-animated");
|
||||
bool anim = anim_str ? lv_xml_to_bool(anim_str) : false;
|
||||
lv_slider_set_value(item, v, anim);
|
||||
}
|
||||
if(lv_streq("bind_value", name)) {
|
||||
else if(lv_streq("start_value", name)) {
|
||||
int32_t v = lv_xml_atoi(value);
|
||||
const char * anim_str = lv_xml_get_value_of(attrs, "start_value-animated");
|
||||
bool anim = anim_str ? lv_xml_to_bool(anim_str) : false;
|
||||
lv_slider_set_start_value(item, v, anim);
|
||||
}
|
||||
else if(lv_streq("bind_value", name)) {
|
||||
lv_subject_t * subject = lv_xml_get_subject(&state->scope, value);
|
||||
if(subject) {
|
||||
lv_slider_bind_value(item, subject);
|
||||
@@ -72,26 +76,10 @@ void lv_xml_slider_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
LV_LOG_WARN("Subject \"%s\" doesn't exist in slider bind_value", value);
|
||||
}
|
||||
}
|
||||
if(lv_streq("start_value", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
bool v2 = lv_xml_to_bool(buf_p);
|
||||
lv_bar_set_start_value(item, v1, v2);
|
||||
}
|
||||
if(lv_streq("orientation", name)) lv_slider_set_orientation(item, orentation_text_to_enum_value(value));
|
||||
if(lv_streq("mode", name)) lv_slider_set_mode(item, mode_text_to_enum_value(value));
|
||||
if(lv_streq("range_min", name)) lv_slider_set_range(item, lv_xml_atoi(value), lv_slider_get_max_value(item));
|
||||
if(lv_streq("range_max", name)) lv_slider_set_range(item, lv_slider_get_min_value(item), lv_xml_atoi(value));
|
||||
if(lv_streq("range", name)) {
|
||||
char buf[64];
|
||||
lv_strlcpy(buf, value, sizeof(buf));
|
||||
char * buf_p = buf;
|
||||
int32_t v1 = lv_xml_atoi(lv_xml_split_str(&buf_p, ' '));
|
||||
int32_t v2 = lv_xml_atoi(buf_p);
|
||||
lv_slider_set_range(item, v1, v2);
|
||||
}
|
||||
else if(lv_streq("orientation", name)) lv_slider_set_orientation(item, orentation_text_to_enum_value(value));
|
||||
else if(lv_streq("mode", name)) lv_slider_set_mode(item, mode_text_to_enum_value(value));
|
||||
else if(lv_streq("min_value", name)) lv_slider_set_min_value(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("max_value", name)) lv_slider_set_max_value(item, lv_xml_atoi(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,12 +58,6 @@ void lv_xml_table_apply(lv_xml_parser_state_t * state, const char ** attrs)
|
||||
|
||||
if(lv_streq("column_count", name)) lv_table_set_column_count(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("row_count", name)) lv_table_set_row_count(item, lv_xml_atoi(value));
|
||||
else if(lv_streq("selected_cell", name)) {
|
||||
|
||||
int32_t value1 = lv_xml_atoi_split(&value, ' ');
|
||||
int32_t value2 = lv_xml_atoi_split(&value, ' ');
|
||||
lv_table_set_selected_cell(item, value1, value2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -273,6 +273,16 @@ void lv_arc_set_range(lv_obj_t * obj, int32_t min, int32_t max)
|
||||
value_update(obj); /*value has changed relative to the new range*/
|
||||
}
|
||||
|
||||
void lv_arc_set_min_value(lv_obj_t * obj, int32_t min)
|
||||
{
|
||||
lv_arc_set_range(obj, min, lv_arc_get_max_value(obj));
|
||||
}
|
||||
|
||||
void lv_arc_set_max_value(lv_obj_t * obj, int32_t max)
|
||||
{
|
||||
lv_arc_set_range(obj, lv_arc_get_min_value(obj), max);
|
||||
}
|
||||
|
||||
void lv_arc_set_change_rate(lv_obj_t * obj, uint32_t rate)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@@ -126,6 +126,20 @@ void lv_arc_set_value(lv_obj_t * obj, int32_t value);
|
||||
*/
|
||||
void lv_arc_set_range(lv_obj_t * obj, int32_t min, int32_t max);
|
||||
|
||||
/**
|
||||
* Set the minimum values of an arc
|
||||
* @param obj pointer to the arc object
|
||||
* @param min minimum value
|
||||
*/
|
||||
void lv_arc_set_min_value(lv_obj_t * obj, int32_t min);
|
||||
|
||||
/**
|
||||
* Set the maximum values of an arc
|
||||
* @param obj pointer to the arc object
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_arc_set_max_value(lv_obj_t * obj, int32_t max);
|
||||
|
||||
/**
|
||||
* Set a change rate to limit the speed how fast the arc should reach the pressed point.
|
||||
* @param obj pointer to an arc object
|
||||
|
||||
@@ -155,6 +155,16 @@ void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max)
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_bar_set_min_value(lv_obj_t * obj, int32_t min)
|
||||
{
|
||||
lv_bar_set_range(obj, min, lv_bar_get_max_value(obj));
|
||||
}
|
||||
|
||||
void lv_bar_set_max_value(lv_obj_t * obj, int32_t max)
|
||||
{
|
||||
lv_bar_set_range(obj, lv_bar_get_min_value(obj), max);
|
||||
}
|
||||
|
||||
void lv_bar_set_mode(lv_obj_t * obj, lv_bar_mode_t mode)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@@ -82,6 +82,20 @@ void lv_bar_set_start_value(lv_obj_t * obj, int32_t start_value, lv_anim_enable_
|
||||
*/
|
||||
void lv_bar_set_range(lv_obj_t * obj, int32_t min, int32_t max);
|
||||
|
||||
/**
|
||||
* Set minimum value of a bar
|
||||
* @param obj pointer to the bar object
|
||||
* @param min minimum value
|
||||
*/
|
||||
void lv_bar_set_min_value(lv_obj_t * obj, int32_t min);
|
||||
|
||||
/**
|
||||
* Set maximum value of a bar
|
||||
* @param obj pointer to the bar object
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_bar_set_max_value(lv_obj_t * obj, int32_t max);
|
||||
|
||||
/**
|
||||
* Set the type of bar.
|
||||
* @param obj pointer to bar object
|
||||
|
||||
@@ -104,6 +104,28 @@ void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, u
|
||||
highlight_update(obj);
|
||||
}
|
||||
|
||||
void lv_calendar_set_today_year(lv_obj_t * obj, uint32_t year)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_calendar_t * calendar = (lv_calendar_t *)obj;
|
||||
lv_calendar_set_today_date(obj, year, calendar->today.month, calendar->today.day);
|
||||
|
||||
}
|
||||
|
||||
void lv_calendar_set_today_month(lv_obj_t * obj, uint32_t month)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_calendar_t * calendar = (lv_calendar_t *)obj;
|
||||
lv_calendar_set_today_date(obj, calendar->today.year, month, calendar->today.day);
|
||||
}
|
||||
|
||||
void lv_calendar_set_today_day(lv_obj_t * obj, uint32_t day)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_calendar_t * calendar = (lv_calendar_t *)obj;
|
||||
lv_calendar_set_today_date(obj, calendar->today.year, calendar->today.month, day);
|
||||
}
|
||||
|
||||
void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highlighted[], size_t date_num)
|
||||
{
|
||||
LV_ASSERT_NULL(highlighted);
|
||||
@@ -212,6 +234,21 @@ void lv_calendar_set_month_shown(lv_obj_t * obj, uint32_t year, uint32_t month)
|
||||
}
|
||||
}
|
||||
|
||||
void lv_calendar_set_shown_year(lv_obj_t * obj, uint32_t year)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_calendar_t * calendar = (lv_calendar_t *)obj;
|
||||
lv_calendar_set_month_shown(obj, year, calendar->showed_date.month);
|
||||
|
||||
}
|
||||
|
||||
void lv_calendar_set_shown_month(lv_obj_t * obj, uint32_t month)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_calendar_t * calendar = (lv_calendar_t *)obj;
|
||||
lv_calendar_set_month_shown(obj, calendar->showed_date.year, month);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
@@ -56,7 +56,7 @@ lv_obj_t * lv_calendar_create(lv_obj_t * parent);
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the today's date
|
||||
* Set the today's year, month and day at once
|
||||
* @param obj pointer to a calendar object
|
||||
* @param year today's year
|
||||
* @param month today's month [1..12]
|
||||
@@ -65,13 +65,48 @@ lv_obj_t * lv_calendar_create(lv_obj_t * parent);
|
||||
void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day);
|
||||
|
||||
/**
|
||||
* Set the currently showed
|
||||
* Set the today's year
|
||||
* @param obj pointer to a calendar object
|
||||
* @param year today's year
|
||||
*/
|
||||
void lv_calendar_set_today_year(lv_obj_t * obj, uint32_t year);
|
||||
|
||||
/**
|
||||
* Set the today's year
|
||||
* @param obj pointer to a calendar object
|
||||
* @param month today's month [1..12]
|
||||
*/
|
||||
void lv_calendar_set_today_month(lv_obj_t * obj, uint32_t month);
|
||||
|
||||
/**
|
||||
* Set the today's year
|
||||
* @param obj pointer to a calendar object
|
||||
* @param day today's day [1..31]
|
||||
*/
|
||||
void lv_calendar_set_today_day(lv_obj_t * obj, uint32_t day);
|
||||
|
||||
/**
|
||||
* Set the currently shown year and month at once
|
||||
* @param obj pointer to a calendar object
|
||||
* @param year today's year
|
||||
* @param month today's month [1..12]
|
||||
* @param year shown year
|
||||
* @param month shown month [1..12]
|
||||
*/
|
||||
void lv_calendar_set_month_shown(lv_obj_t * obj, uint32_t year, uint32_t month);
|
||||
|
||||
/**
|
||||
* Set the currently shown year
|
||||
* @param obj pointer to a calendar object
|
||||
* @param year shown year
|
||||
*/
|
||||
void lv_calendar_set_shown_year(lv_obj_t * obj, uint32_t year);
|
||||
|
||||
/**
|
||||
* Set the currently shown month
|
||||
* @param obj pointer to a calendar object
|
||||
* @param month shown month [1..12]
|
||||
*/
|
||||
void lv_calendar_set_shown_month(lv_obj_t * obj, uint32_t month);
|
||||
|
||||
/**
|
||||
* Set the highlighted dates
|
||||
* @param obj pointer to a calendar object
|
||||
|
||||
@@ -129,28 +129,49 @@ void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt)
|
||||
lv_chart_refresh(obj);
|
||||
}
|
||||
|
||||
void lv_chart_set_axis_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max)
|
||||
void lv_chart_set_axis_min_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
max = max == min ? max + 1 : max;
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
|
||||
switch(axis) {
|
||||
case LV_CHART_AXIS_PRIMARY_Y:
|
||||
chart->ymin[0] = min;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_Y:
|
||||
chart->ymin[1] = min;
|
||||
break;
|
||||
case LV_CHART_AXIS_PRIMARY_X:
|
||||
chart->xmin[0] = min;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_X:
|
||||
chart->xmin[1] = min;
|
||||
break;
|
||||
default:
|
||||
LV_LOG_WARN("Invalid axis: %d", axis);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_chart_refresh(obj);
|
||||
}
|
||||
|
||||
void lv_chart_set_axis_max_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t max)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
switch(axis) {
|
||||
case LV_CHART_AXIS_PRIMARY_Y:
|
||||
chart->ymin[0] = min;
|
||||
chart->ymax[0] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_Y:
|
||||
chart->ymin[1] = min;
|
||||
chart->ymax[1] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_PRIMARY_X:
|
||||
chart->xmin[0] = min;
|
||||
chart->xmax[0] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_X:
|
||||
chart->xmin[1] = min;
|
||||
chart->xmax[1] = max;
|
||||
break;
|
||||
default:
|
||||
@@ -161,6 +182,14 @@ void lv_chart_set_axis_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min,
|
||||
lv_chart_refresh(obj);
|
||||
}
|
||||
|
||||
void lv_chart_set_axis_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_chart_set_axis_min_value(obj, axis, min);
|
||||
lv_chart_set_axis_max_value(obj, axis, max);
|
||||
}
|
||||
|
||||
void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
@@ -172,7 +201,7 @@ void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_chart_set_div_line_count(lv_obj_t * obj, uint8_t hdiv, uint8_t vdiv)
|
||||
void lv_chart_set_div_line_count(lv_obj_t * obj, uint32_t hdiv, uint32_t vdiv)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@@ -185,6 +214,26 @@ void lv_chart_set_div_line_count(lv_obj_t * obj, uint8_t hdiv, uint8_t vdiv)
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_chart_set_hor_div_line_count(lv_obj_t * obj, uint32_t cnt)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
if(chart->hdiv_cnt == cnt) return;
|
||||
chart->hdiv_cnt = cnt;
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_chart_set_ver_div_line_count(lv_obj_t * obj, uint32_t cnt)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
if(chart->vdiv_cnt == cnt) return;
|
||||
chart->vdiv_cnt = cnt;
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
lv_chart_type_t lv_chart_get_type(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@@ -94,6 +94,23 @@ void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt);
|
||||
*/
|
||||
void lv_chart_set_axis_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max);
|
||||
|
||||
/**
|
||||
* Set the minimal values on an axis
|
||||
* @param obj pointer to a chart object
|
||||
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
|
||||
* @param min minimal value of the y axis
|
||||
*/
|
||||
void lv_chart_set_axis_min_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min);
|
||||
|
||||
/**
|
||||
* Set the maximal y values on an axis
|
||||
* @param obj pointer to a chart object
|
||||
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
|
||||
* @param max maximum value of the y axis
|
||||
*/
|
||||
void lv_chart_set_axis_max_value(lv_obj_t * obj, lv_chart_axis_t axis, int32_t max);
|
||||
|
||||
|
||||
/**
|
||||
* Set update mode of the chart object. Affects
|
||||
* @param obj pointer to a chart object
|
||||
@@ -107,7 +124,21 @@ void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode
|
||||
* @param hdiv number of horizontal division lines
|
||||
* @param vdiv number of vertical division lines
|
||||
*/
|
||||
void lv_chart_set_div_line_count(lv_obj_t * obj, uint8_t hdiv, uint8_t vdiv);
|
||||
void lv_chart_set_div_line_count(lv_obj_t * obj, uint32_t hdiv, uint32_t vdiv);
|
||||
|
||||
/**
|
||||
* Set the number of horizontal division lines
|
||||
* @param obj pointer to a chart object
|
||||
* @param cnt number of horizontal division lines
|
||||
*/
|
||||
void lv_chart_set_hor_div_line_count(lv_obj_t * obj, uint32_t cnt);
|
||||
|
||||
/**
|
||||
* Set the number of vertical division lines
|
||||
* @param obj pointer to a chart object
|
||||
* @param cnt number of vertical division lines
|
||||
*/
|
||||
void lv_chart_set_ver_div_line_count(lv_obj_t * obj, uint32_t cnt);
|
||||
|
||||
/**
|
||||
* Get the type of a chart
|
||||
|
||||
@@ -367,6 +367,22 @@ void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y)
|
||||
lv_obj_invalidate_area(obj, &a);
|
||||
}
|
||||
|
||||
void lv_image_set_pivot_x(lv_obj_t * obj, int32_t x)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_image_t * img = (lv_image_t *)obj;
|
||||
lv_image_set_pivot(obj, x, img->pivot.y);
|
||||
}
|
||||
|
||||
void lv_image_set_pivot_y(lv_obj_t * obj, int32_t y)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
lv_image_t * img = (lv_image_t *)obj;
|
||||
lv_image_set_pivot(obj, img->pivot.x, y);
|
||||
}
|
||||
|
||||
void lv_image_set_scale(lv_obj_t * obj, uint32_t zoom)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@@ -135,6 +135,20 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle);
|
||||
*/
|
||||
void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y);
|
||||
|
||||
/**
|
||||
* Set the rotation horizontal center of the image.
|
||||
* @param obj pointer to an image object
|
||||
* @param x rotation center x of the image, or lv_pct()
|
||||
*/
|
||||
void lv_image_set_pivot_x(lv_obj_t * obj, int32_t x);
|
||||
|
||||
/**
|
||||
* Set the rotation vertical center of the image.
|
||||
* @param obj pointer to an image object
|
||||
* @param y rotation center y of the image, or lv_pct()
|
||||
*/
|
||||
void lv_image_set_pivot_y(lv_obj_t * obj, int32_t y);
|
||||
|
||||
/**
|
||||
* Set the zoom factor of the image.
|
||||
* Note that indexed and alpha only images can't be transformed.
|
||||
|
||||
@@ -162,6 +162,24 @@ void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max)
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_scale_set_min_value(lv_obj_t * obj, int32_t min)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_scale_t * scale = (lv_scale_t *)obj;
|
||||
scale->range_min = min;
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_scale_set_max_value(lv_obj_t * obj, int32_t max)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_scale_t * scale = (lv_scale_t *)obj;
|
||||
scale->range_max = max;
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_scale_set_angle_range(lv_obj_t * obj, uint32_t angle_range)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
@@ -364,6 +382,24 @@ void lv_scale_set_section_range(lv_obj_t * scale, lv_scale_section_t * section,
|
||||
lv_obj_invalidate(scale);
|
||||
}
|
||||
|
||||
void lv_scale_set_section_min_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t min)
|
||||
{
|
||||
LV_ASSERT_OBJ(scale, MY_CLASS);
|
||||
LV_ASSERT_NULL(section);
|
||||
|
||||
section->range_min = min;
|
||||
lv_obj_invalidate(scale);
|
||||
}
|
||||
|
||||
void lv_scale_set_section_max_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t max)
|
||||
{
|
||||
LV_ASSERT_OBJ(scale, MY_CLASS);
|
||||
LV_ASSERT_NULL(section);
|
||||
|
||||
section->range_max = max;
|
||||
lv_obj_invalidate(scale);
|
||||
}
|
||||
|
||||
void lv_scale_section_set_range(lv_scale_section_t * section, int32_t min, int32_t max)
|
||||
{
|
||||
if(NULL == section) return;
|
||||
|
||||
@@ -120,6 +120,20 @@ void lv_scale_set_label_show(lv_obj_t * obj, bool show_label);
|
||||
*/
|
||||
void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max);
|
||||
|
||||
/**
|
||||
* Set minimum values on Scale.
|
||||
* @param obj pointer to Scale Widget
|
||||
* @param min minimum value of Scale
|
||||
*/
|
||||
void lv_scale_set_min_value(lv_obj_t * obj, int32_t min);
|
||||
|
||||
/**
|
||||
* Set maximum values on Scale.
|
||||
* @param obj pointer to Scale Widget
|
||||
* @param min minimum value of Scale
|
||||
*/
|
||||
void lv_scale_set_max_value(lv_obj_t * obj, int32_t max);
|
||||
|
||||
/**
|
||||
* Set angle between the low end and the high end of the Scale.
|
||||
* (Applies only to round Scales.)
|
||||
@@ -204,7 +218,7 @@ void lv_scale_set_draw_ticks_on_top(lv_obj_t * obj, bool en);
|
||||
lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* DEPRECATED, use lv_scale_set_section_rangeinstead.
|
||||
* DEPRECATED, use lv_scale_set_section_range instead.
|
||||
* Set range for specified Scale Section
|
||||
* @param section pointer to Section
|
||||
* @param range_min Section new minimum value
|
||||
@@ -216,11 +230,27 @@ void lv_scale_section_set_range(lv_scale_section_t * section, int32_t min, int32
|
||||
* Set the range of a scale section
|
||||
* @param scale pointer to scale
|
||||
* @param section pointer to section
|
||||
* @param range_min section new minimum value
|
||||
* @param range_max section new maximum value
|
||||
* @param range_min the section's new minimum value
|
||||
* @param range_max the section's new maximum value
|
||||
*/
|
||||
void lv_scale_set_section_range(lv_obj_t * scale, lv_scale_section_t * section, int32_t min, int32_t max);
|
||||
|
||||
/**
|
||||
* Set the minimum value of a scale section
|
||||
* @param scale pointer to scale
|
||||
* @param section pointer to section
|
||||
* @param min the section's new minimum value
|
||||
*/
|
||||
void lv_scale_set_section_min_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t min);
|
||||
|
||||
/**
|
||||
* Set the maximum value of a scale section
|
||||
* @param scale pointer to scale
|
||||
* @param section pointer to section
|
||||
* @param max the section's new maximum value
|
||||
*/
|
||||
void lv_scale_set_section_max_value(lv_obj_t * scale, lv_scale_section_t * section, int32_t max);
|
||||
|
||||
/**
|
||||
* DEPRECATED, use lv_scale_set_section_style_main/indicator/items instead.
|
||||
* Set style for specified part of Section.
|
||||
|
||||
@@ -155,6 +155,16 @@ void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max)
|
||||
lv_bar_set_range(obj, min, max);
|
||||
}
|
||||
|
||||
void lv_slider_set_min_value(lv_obj_t * obj, int32_t min)
|
||||
{
|
||||
lv_bar_set_min_value(obj, min);
|
||||
}
|
||||
|
||||
void lv_slider_set_max_value(lv_obj_t * obj, int32_t min)
|
||||
{
|
||||
lv_bar_set_max_value(obj, min);
|
||||
}
|
||||
|
||||
void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode)
|
||||
{
|
||||
lv_bar_set_mode(obj, (lv_bar_mode_t)mode);
|
||||
|
||||
@@ -88,13 +88,27 @@ void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim);
|
||||
void lv_slider_set_start_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Set minimum and the maximum values of a bar
|
||||
* Set the minimum and the maximum values of a bar
|
||||
* @param obj pointer to the slider object
|
||||
* @param min minimum value
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max);
|
||||
|
||||
/**
|
||||
* Set the minimum values of a bar
|
||||
* @param obj pointer to the slider object
|
||||
* @param min minimum value
|
||||
*/
|
||||
void lv_slider_set_min_value(lv_obj_t * obj, int32_t min);
|
||||
|
||||
/**
|
||||
* Set the maximum values of a bar
|
||||
* @param obj pointer to the slider object
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_slider_set_max_value(lv_obj_t * obj, int32_t max);
|
||||
|
||||
/**
|
||||
* Set the mode of slider.
|
||||
* @param obj pointer to a slider object
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
</lv_spangroup>
|
||||
|
||||
<lv_scale total_tick_count="31" show_label="true" major_tick_every="6"
|
||||
range="10 110" width="300">
|
||||
min_value="10" max_value="110" width="300">
|
||||
<style name="scale_main"/>
|
||||
<style name="scale_indic" selector="indicator"/>
|
||||
<lv_scale-section range="30 60" style_indicator="scale_sectoion_indic"/>
|
||||
<lv_scale-section min_value="30" max_value="60" style_indicator="scale_sectoion_indic"/>
|
||||
</lv_scale>
|
||||
|
||||
<lv_table column_count="4" style_border_side:items="full">
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
<view extends="lv_obj" width="480" height="300" flex_flow="column">
|
||||
<lv_label bind_text="global_subject"/>
|
||||
<lv_slider bind_value="global_subject" range_max="#global_int"/>
|
||||
<lv_slider bind_value="global_subject" max_value="#global_int"/>
|
||||
|
||||
<lv_label bind_text="local_subject" style_margin_top="32px"/>
|
||||
<lv_slider bind_value="local_subject" range_max="#local_int"/>
|
||||
<lv_slider bind_value="not_existing" range_max="#local_int"/>
|
||||
<lv_slider bind_value="local_subject" max_value="#local_int"/>
|
||||
<lv_slider bind_value="not_existing" max_value="#local_int"/>
|
||||
</view>
|
||||
</component>
|
||||
@@ -19,8 +19,10 @@ void test_arc_with_attrs(void)
|
||||
lv_obj_t * scr = lv_screen_active();
|
||||
|
||||
const char * attrs_1[] = {
|
||||
"bg_angles", "0 100",
|
||||
"range", "-20 20",
|
||||
"bg_start_angle", "0",
|
||||
"bg_end_angle", "100",
|
||||
"min_value", "-20",
|
||||
"max_value", "20",
|
||||
"value", "10",
|
||||
"mode", "reverse",
|
||||
"align", "center",
|
||||
|
||||
@@ -32,7 +32,8 @@ static void test_with_attrs(const char * name)
|
||||
lv_xml_create(scr, name, attrs_1);
|
||||
|
||||
const char * attrs_2[] = {
|
||||
"range", "-100 100",
|
||||
"min_value", "-100",
|
||||
"max_value", "100",
|
||||
"mode", "symmetrical",
|
||||
"value", "50",
|
||||
NULL, NULL,
|
||||
|
||||
@@ -24,8 +24,11 @@ void test_xml_calendar_with_attrs(void)
|
||||
"height", "200",
|
||||
"x", "10",
|
||||
"y", "10",
|
||||
"today_date", "2025 05 06",
|
||||
"shown_month", "2025 05",
|
||||
"today_year", "2025",
|
||||
"today_month", "05",
|
||||
"today_day", "06",
|
||||
"shown_year", "2025",
|
||||
"shown_month", "05",
|
||||
NULL, NULL,
|
||||
};
|
||||
lv_obj_t * calendar;
|
||||
|
||||
@@ -34,7 +34,8 @@ void test_xml_chart_with_attrs(void)
|
||||
|
||||
const char * primary_y_axis_attrs[] = {
|
||||
"axis", "primary_y",
|
||||
"range", "0 40",
|
||||
"min_value", "0",
|
||||
"max_value", "40",
|
||||
NULL, NULL,
|
||||
};
|
||||
lv_xml_create(chart, "lv_chart-axis", primary_y_axis_attrs);
|
||||
@@ -59,7 +60,8 @@ void test_xml_chart_with_attrs(void)
|
||||
|
||||
const char * secondary_y_axis_attrs[] = {
|
||||
"axis", "secondary_y",
|
||||
"range", "70 90",
|
||||
"min_value", "70",
|
||||
"max_value", "90",
|
||||
NULL, NULL,
|
||||
};
|
||||
lv_xml_create(chart, "lv_chart-axis", secondary_y_axis_attrs);
|
||||
|
||||
@@ -31,8 +31,8 @@ void test_xml_widget_direct_create(void)
|
||||
|
||||
/*Use attributes*/
|
||||
const char * attrs[] = {
|
||||
"range_min", "-100",
|
||||
"range_max", "100",
|
||||
"min_value", "-100",
|
||||
"max_value", "100",
|
||||
"mode", "symmetrical",
|
||||
"value", "50",
|
||||
"name", "my_slider",
|
||||
@@ -72,8 +72,8 @@ void test_xml_widget_create_from_component(void)
|
||||
|
||||
/*Use attributes*/
|
||||
const char * attrs[] = {
|
||||
"range_min", "-100",
|
||||
"range_max", "100",
|
||||
"min_value", "-100",
|
||||
"max_value", "100",
|
||||
"mode", "symmetrical",
|
||||
"value", "50",
|
||||
NULL, NULL,
|
||||
|
||||
@@ -36,7 +36,8 @@ void test_xml_label_with_attrs(void)
|
||||
lv_xml_register_subject(NULL, "s1", &s1);
|
||||
|
||||
const char * label2_attrs[] = {
|
||||
"bind_text", "s1 'We have %d users'",
|
||||
"bind_text", "s1",
|
||||
"bind_text-fmt", "We have %d users",
|
||||
"y", "10",
|
||||
"x", "5",
|
||||
NULL, NULL,
|
||||
|
||||
@@ -16,13 +16,14 @@ void tearDown(void)
|
||||
|
||||
void test_xml_roller_with_attrs(void)
|
||||
{
|
||||
|
||||
lv_obj_t * scr = lv_screen_active();
|
||||
|
||||
const char * roller_attrs[] = {
|
||||
"width", "200",
|
||||
"options", "'a\nb\nc\nd\ne' infinite",
|
||||
"selected", "2 true",
|
||||
"options", "a\nb\nc\nd\ne",
|
||||
"options-mode", "infinite",
|
||||
"selected", "2",
|
||||
"selected-animated", "true",
|
||||
"visible_line_count", "3",
|
||||
NULL, NULL,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,8 @@ void test_xml_scale_with_attrs(void)
|
||||
"width", "120",
|
||||
"height", "120",
|
||||
"mode", "round_outer",
|
||||
"range", "0 150",
|
||||
"min_value", "0",
|
||||
"max_value", "150",
|
||||
"total_tick_count", "16",
|
||||
"major_tick_every", "3",
|
||||
"style_length:indicator", "10",
|
||||
@@ -34,7 +35,8 @@ void test_xml_scale_with_attrs(void)
|
||||
lv_obj_center(scale);
|
||||
|
||||
const char * section_attrs[] = {
|
||||
"range", "10 80",
|
||||
"min_value", "10",
|
||||
"max_value", "80",
|
||||
NULL, NULL,
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ static void test_with_attrs(const char * name)
|
||||
lv_xml_create(scr, name, attrs_1);
|
||||
|
||||
const char * attrs_2[] = {
|
||||
"range", "-100 100",
|
||||
"min_value", "-100",
|
||||
"max_value", "100",
|
||||
"mode", "symmetrical",
|
||||
"value", "50",
|
||||
NULL, NULL,
|
||||
|
||||
+9
-18
@@ -10,24 +10,15 @@ Example
|
||||
<enum name="symmetrical" help="sym"/>
|
||||
<enum name="reverse" help="reverse"/>
|
||||
</enumdef>
|
||||
<prop name="angles" help="Start and end angles of the indicator">
|
||||
<param name ="start_angle" type="deg" help="The start angle"/>
|
||||
<param name ="end_angle" type="deg" help="The end angle"/>
|
||||
</prop>
|
||||
<prop name="bg_angles" help="Start and end angles of the background">
|
||||
<param name ="start_angle" type="deg" help="The start angle"/>
|
||||
<param name ="end_angle" type="deg" help="The end angle"/>
|
||||
</prop>
|
||||
<prop name="range" help="The range">
|
||||
<param name ="min" type="int" help="The min range"/>
|
||||
<param name ="max" type="int" help="The max range"/>
|
||||
</prop>
|
||||
<prop name="value" help="The current value">
|
||||
<param name="value" type="int"/>
|
||||
</prop>
|
||||
<prop name="mode" help="The mode">
|
||||
<param name="mode" type="enum:lv_arc_mode"/>
|
||||
</prop>
|
||||
|
||||
<prop name="start_angle" help="Start angles of the indicator"/>
|
||||
<prop name="end_angle" help="End angles of the indicator"/>
|
||||
<prop name="bg_angle_start" help="Start angles of the background"/>
|
||||
<prop name="bg_angle_end" help="End angles of the background"/>
|
||||
<prop name="min_value" type="int"/>
|
||||
<prop name="max_value" type="int"/>
|
||||
<prop name="value" type="int" help="The current value"/>
|
||||
<prop name="mode" type="enum:lv_arc_mode" help="The mode"/>
|
||||
<prop name="bind_value" type="subject" help="Connect a subject to the arc's value"/>
|
||||
</api>
|
||||
</widget>
|
||||
|
||||
+5
-7
@@ -17,19 +17,17 @@ Example
|
||||
<enum name="vertical" help=""/>
|
||||
</enumdef>
|
||||
|
||||
<prop name="range" help="The range">
|
||||
<param name ="min" type="int" help="The min range"/>
|
||||
<param name ="max" type="int" help="The max range"/>
|
||||
</prop>
|
||||
<prop name="min_value" type="int"/>
|
||||
<prop name="max_value" type="int"/>
|
||||
|
||||
<prop name="value" help="The current value">
|
||||
<param name ="value" type="int" help="The current value"/>
|
||||
<param name ="animated" type="bool" help="Set the value with animation" optional="true" default="false"/>
|
||||
<param name ="animated" type="bool" help="Set the value with animation" default="false"/>
|
||||
</prop>
|
||||
|
||||
<prop name="start_value" help="The current left value in case of range mode">
|
||||
<param name ="value" type="int" help="The current value"/>
|
||||
<param name ="animated" type="bool" help="Set the value with animation" optional="true" default="false"/>
|
||||
<param name ="start_value" type="int" help="The current value"/>
|
||||
<param name ="animated" type="bool" help="Set the value with animation" default="false"/>
|
||||
</prop>
|
||||
|
||||
<prop name="mode" type="enum:lv_bar_mode"/>
|
||||
|
||||
@@ -5,15 +5,13 @@ Example
|
||||
|
||||
<widget>
|
||||
<api>
|
||||
<prop name="today_date" help="Current date">
|
||||
<param name="year" type="int" help=""/>
|
||||
<param name="month" type="int" help=""/>
|
||||
<param name="day" type="int" help=""/>
|
||||
</prop>
|
||||
<prop name="month_shown" help="Shown date">
|
||||
<param name="year" type="int" help=""/>
|
||||
<param name="month" type="int" help=""/>
|
||||
</prop>
|
||||
<prop name="today_year" type="int"/>
|
||||
<prop name="today_month" type="int"/>
|
||||
<prop name="today_day" type="int"/>
|
||||
|
||||
<prop name="shown_month" type="int"/>
|
||||
<prop name="shown_day" tyepe="int"/>
|
||||
|
||||
<element name="header_arrow" access="add" help=""/>
|
||||
<element name="header_dropdown" access="add" help="">
|
||||
<prop name="year_list" type="string"/>
|
||||
|
||||
+5
-9
@@ -31,11 +31,9 @@
|
||||
<prop name="type" type="enum:lv_chart_type" help=""/>
|
||||
|
||||
<prop name="point_count" type="int" help=""/>
|
||||
<prop name="update_mode" type="enum:lv_chart_chart_update_mode" help=""/>
|
||||
<prop name="div_line_count" help="">
|
||||
<param name="hdiv" type="int" help=""/>
|
||||
<param name="vdiv" type="int" help=""/>
|
||||
</prop>
|
||||
<prop name="update_mode" type="enum:lv_chart_update_mode" help=""/>
|
||||
<prop name="nor_div_line_count" help=""/>
|
||||
<prop name="ver_div_line_count" help=""/>
|
||||
|
||||
<element name="series" type="lv_chart_series" access="add">
|
||||
<arg name="color" type="color" help=""/>
|
||||
@@ -52,10 +50,8 @@
|
||||
|
||||
<element name="axis" access="set">
|
||||
<arg name="axis" type="enum:lv_chart_axis"/>
|
||||
<prop name="range">
|
||||
<param name="min" type="int" help="the min value"/>
|
||||
<param name="max" type="int" help="the max value"/>
|
||||
</prop>
|
||||
<prop name="min_value" type="int"/>
|
||||
<prop name="max_value" type="int"/>
|
||||
</element>
|
||||
</api>
|
||||
</widget>
|
||||
@@ -5,8 +5,6 @@ Example
|
||||
|
||||
<widget>
|
||||
<api>
|
||||
<prop name="text" help="The text of the checkbox">
|
||||
<param name="text" type="string" help=""/>
|
||||
</prop>
|
||||
<prop name="text" type="string" help="The text of the checkbox"/>
|
||||
</api>
|
||||
</widget>
|
||||
+2
-4
@@ -27,9 +27,7 @@ Example
|
||||
<prop name="rotation" type="int" help=""/>
|
||||
<prop name="scale_x" type="int" help=""/>
|
||||
<prop name="scale_y" type="int" help=""/>
|
||||
<prop name="pivot" help="">
|
||||
<param name="pivot_x" type="int" help=""/>
|
||||
<param name="pivot_y" type="int" help=""/>
|
||||
</prop>
|
||||
<prop name="pivot_x" type="int" help=""/>
|
||||
<prop name="pivot_y" type="int" help=""/>
|
||||
</api>
|
||||
</widget>
|
||||
+2
-2
@@ -16,8 +16,8 @@ Example
|
||||
<prop name="text" type="string" />
|
||||
<prop name="long_mode" type="enum:lv_label_long_mode" />
|
||||
<prop name="bind_text">
|
||||
<param name="subject" type="subject" />
|
||||
<param name="string" type="fmt" default="NULL"/>
|
||||
<param name="bind_text" type="subject" />
|
||||
<param name="fmt" type="string" default="NULL"/>
|
||||
</prop>
|
||||
</api>
|
||||
</widget>
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ Example
|
||||
|
||||
<prop name="selected" help="">
|
||||
<param name="selected" type="int"/>
|
||||
<param name="anim" type="bool" default="false"/>
|
||||
<param name="animated" type="bool" default="false"/>
|
||||
</prop>
|
||||
|
||||
<prop name="visible_row_count" type="int" help=""/>
|
||||
|
||||
+2
-4
@@ -19,10 +19,8 @@
|
||||
<prop name="total_tick_count" type="int" help=""/>
|
||||
<prop name="major_tick_every" type="int" help=""/>
|
||||
<prop name="label_show" type="bool" help=""/>
|
||||
<prop name="range" help="">
|
||||
<param name="range_min" type="int" help=""/>
|
||||
<param name="range_max" type="int" help=""/>
|
||||
</prop>
|
||||
<param name="value_min" type="int" help=""/>
|
||||
<param name="value_max" type="int" help=""/>
|
||||
<prop name="angle_range" type="deg" help=""/>
|
||||
<prop name="rotation" type="deg" help=""/>
|
||||
<prop name="text_src" type="string[NULL]" help=""/>
|
||||
|
||||
+3
-5
@@ -11,10 +11,8 @@ Example
|
||||
<enum name="symmetrical" help="The indicaror is grwing from zero"/>
|
||||
</enumdef>
|
||||
|
||||
<prop name="range">
|
||||
<param name="range_min" type="int"/>
|
||||
<param name="range_max" type="int"/>
|
||||
</prop>
|
||||
<prop name="min_value" type="int"/>
|
||||
<prop name="max_value" type="int"/>
|
||||
|
||||
<prop name="value">
|
||||
<param name="value" type="int"/>
|
||||
@@ -22,7 +20,7 @@ Example
|
||||
</prop>
|
||||
|
||||
<prop name="start_value">
|
||||
<param name="range_min" type="int"/>
|
||||
<param name="start_value" type="int"/>
|
||||
<param name="anim" type="bool" default="false"/>
|
||||
</prop>
|
||||
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
<prop name="row_count" type="int" help=""/>
|
||||
<prop name="column_count" type="int" help=""/>
|
||||
<prop name="selected cell" help="">
|
||||
<param name="row" type="int" help=""/>
|
||||
<param name="column" type="int" help=""/>
|
||||
</prop>
|
||||
|
||||
<element name="column" access="set">
|
||||
<arg name="column" type="int" help=""/>
|
||||
|
||||
Reference in New Issue
Block a user