mirror of
https://github.com/lvgl/lvgl.git
synced 2026-08-17 09:42:19 +08:00
arch(obj): replace lv_obj_flag... with dedicated API for each flag (#10316)
This commit is contained in:
@@ -147,7 +147,7 @@ static void multiple_rgb_images_cb(void)
|
|||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * obj = lv_image_create(lv_screen_active());
|
lv_obj_t * obj = lv_image_create(lv_screen_active());
|
||||||
lv_image_set_src(obj, &img_benchmark_lvgl_logo_rgb);
|
lv_image_set_src(obj, &img_benchmark_lvgl_logo_rgb);
|
||||||
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(obj, true);
|
||||||
|
|
||||||
fall_anim(obj, 80);
|
fall_anim(obj, 80);
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ static void multiple_argb_images_cb(void)
|
|||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * obj = lv_image_create(lv_screen_active());
|
lv_obj_t * obj = lv_image_create(lv_screen_active());
|
||||||
lv_image_set_src(obj, &img_benchmark_lvgl_logo_argb);
|
lv_image_set_src(obj, &img_benchmark_lvgl_logo_argb);
|
||||||
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(obj, true);
|
||||||
|
|
||||||
fall_anim(obj, 80);
|
fall_anim(obj, 80);
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ static void rotated_argb_image_cb(void)
|
|||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * obj = lv_image_create(lv_screen_active());
|
lv_obj_t * obj = lv_image_create(lv_screen_active());
|
||||||
lv_image_set_src(obj, &img_benchmark_lvgl_logo_argb);
|
lv_image_set_src(obj, &img_benchmark_lvgl_logo_argb);
|
||||||
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(obj, true);
|
||||||
|
|
||||||
lv_image_set_rotation(obj, lv_rand(100, 3500));
|
lv_image_set_rotation(obj, lv_rand(100, 3500));
|
||||||
fall_anim(obj, 80);
|
fall_anim(obj, 80);
|
||||||
@@ -242,7 +242,7 @@ static void multiple_labels_cb(void)
|
|||||||
int32_t x;
|
int32_t x;
|
||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * obj = lv_label_create(lv_screen_active());
|
lv_obj_t * obj = lv_label_create(lv_screen_active());
|
||||||
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(obj, true);
|
||||||
lv_label_set_text_static(obj, "Hello LVGL!");
|
lv_label_set_text_static(obj, "Hello LVGL!");
|
||||||
color_anim(obj);
|
color_anim(obj);
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ static void multiple_arcs_cb(void)
|
|||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
|
|
||||||
lv_obj_t * obj = lv_arc_create(lv_screen_active());
|
lv_obj_t * obj = lv_arc_create(lv_screen_active());
|
||||||
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(obj, true);
|
||||||
lv_obj_set_size(obj, 100, 100);
|
lv_obj_set_size(obj, 100, 100);
|
||||||
lv_obj_center(obj);
|
lv_obj_center(obj);
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ static void containers_cb(void)
|
|||||||
int32_t x;
|
int32_t x;
|
||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * card = card_create();
|
lv_obj_t * card = card_create();
|
||||||
if(x == 0) lv_obj_add_flag(card, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(card, true);
|
||||||
fall_anim(card, 30);
|
fall_anim(card, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,7 +361,7 @@ static void containers_with_overlay_cb(void)
|
|||||||
int32_t x;
|
int32_t x;
|
||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * card = card_create();
|
lv_obj_t * card = card_create();
|
||||||
if(x == 0) lv_obj_add_flag(card, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(card, true);
|
||||||
fall_anim(card, 30);
|
fall_anim(card, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ static void containers_with_opa_cb(void)
|
|||||||
int32_t x;
|
int32_t x;
|
||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * card = card_create();
|
lv_obj_t * card = card_create();
|
||||||
if(x == 0) lv_obj_add_flag(card, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(card, true);
|
||||||
lv_obj_set_style_opa(card, LV_OPA_50, 0);
|
lv_obj_set_style_opa(card, LV_OPA_50, 0);
|
||||||
fall_anim(card, 30);
|
fall_anim(card, 30);
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,7 @@ static void containers_with_opa_layer_cb(void)
|
|||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * card = card_create();
|
lv_obj_t * card = card_create();
|
||||||
lv_obj_set_style_opa_layered(card, LV_OPA_50, 0);
|
lv_obj_set_style_opa_layered(card, LV_OPA_50, 0);
|
||||||
if(x == 0) lv_obj_add_flag(card, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(card, true);
|
||||||
fall_anim(card, 30);
|
fall_anim(card, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -441,7 +441,7 @@ static void containers_with_scrolling_cb(void)
|
|||||||
int32_t x;
|
int32_t x;
|
||||||
for(x = 0; x < hor_cnt; x++) {
|
for(x = 0; x < hor_cnt; x++) {
|
||||||
lv_obj_t * card = card_create();
|
lv_obj_t * card = card_create();
|
||||||
if(x == 0) lv_obj_add_flag(card, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(x == 0) lv_obj_set_flex_in_new_track(card, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -525,7 +525,7 @@ void lv_demo_benchmark(void)
|
|||||||
lv_display_t * disp = lv_display_get_default();
|
lv_display_t * disp = lv_display_get_default();
|
||||||
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, sysmon_perf_observer_cb, title, NULL);
|
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, sysmon_perf_observer_cb, title, NULL);
|
||||||
#if LV_USE_PERF_MONITOR_LOG_MODE
|
#if LV_USE_PERF_MONITOR_LOG_MODE
|
||||||
lv_obj_add_flag(title, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(title, true);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
lv_label_set_text(title, "LV_USE_PERF_MONITOR is not enabled");
|
lv_label_set_text(title, "LV_USE_PERF_MONITOR is not enabled");
|
||||||
@@ -549,7 +549,7 @@ void lv_demo_benchmark_summary_display(const lv_demo_benchmark_summary_t * summa
|
|||||||
lv_obj_t * table = lv_table_create(lv_screen_active());
|
lv_obj_t * table = lv_table_create(lv_screen_active());
|
||||||
lv_obj_set_width(table, lv_pct(100));
|
lv_obj_set_width(table, lv_pct(100));
|
||||||
lv_obj_set_style_max_height(table, lv_pct(100), 0);
|
lv_obj_set_style_max_height(table, lv_pct(100), 0);
|
||||||
lv_obj_add_flag(table, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_send_draw_task_events(table, true);
|
||||||
lv_obj_set_style_text_color(table, lv_palette_darken(LV_PALETTE_BLUE_GREY, 2), LV_PART_ITEMS);
|
lv_obj_set_style_text_color(table, lv_palette_darken(LV_PALETTE_BLUE_GREY, 2), LV_PART_ITEMS);
|
||||||
lv_obj_set_style_border_color(table, lv_palette_darken(LV_PALETTE_BLUE_GREY, 2), LV_PART_ITEMS);
|
lv_obj_set_style_border_color(table, lv_palette_darken(LV_PALETTE_BLUE_GREY, 2), LV_PART_ITEMS);
|
||||||
lv_obj_add_event_cb(table, table_draw_task_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
lv_obj_add_event_cb(table, table_draw_task_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ lv_obj_t * lv_demo_gltf(const char * path)
|
|||||||
{
|
{
|
||||||
lv_obj_t * viewer = lv_gltf_create(lv_screen_active());
|
lv_obj_t * viewer = lv_gltf_create(lv_screen_active());
|
||||||
lv_obj_set_size(viewer, LV_PCT(100), LV_PCT(100));
|
lv_obj_set_size(viewer, LV_PCT(100), LV_PCT(100));
|
||||||
lv_obj_remove_flag(viewer, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(viewer, false);
|
||||||
lv_gltf_set_background_mode(viewer, LV_GLTF_BG_MODE_ENVIRONMENT);
|
lv_gltf_set_background_mode(viewer, LV_GLTF_BG_MODE_ENVIRONMENT);
|
||||||
lv_gltf_model_t * model = lv_gltf_load_model_from_file(viewer, path);
|
lv_gltf_model_t * model = lv_gltf_load_model_from_file(viewer, path);
|
||||||
LV_ASSERT_NULL(model);
|
LV_ASSERT_NULL(model);
|
||||||
|
|||||||
@@ -97,32 +97,32 @@ static void selectors_create(lv_obj_t * parent)
|
|||||||
lv_table_set_cell_value(obj, 2, 1, "21");
|
lv_table_set_cell_value(obj, 2, 1, "21");
|
||||||
lv_table_set_cell_value(obj, 3, 0, "30");
|
lv_table_set_cell_value(obj, 3, 0, "30");
|
||||||
lv_table_set_cell_value(obj, 3, 1, "31");
|
lv_table_set_cell_value(obj, 3, 1, "31");
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_calendar_create(parent);
|
obj = lv_calendar_create(parent);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_buttonmatrix_create(parent);
|
obj = lv_buttonmatrix_create(parent);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_checkbox_create(parent);
|
obj = lv_checkbox_create(parent);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_slider_create(parent);
|
obj = lv_slider_create(parent);
|
||||||
lv_slider_set_range(obj, 0, 10);
|
lv_slider_set_range(obj, 0, 10);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_switch_create(parent);
|
obj = lv_switch_create(parent);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_spinbox_create(parent);
|
obj = lv_spinbox_create(parent);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_dropdown_create(parent);
|
obj = lv_dropdown_create(parent);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
obj = lv_roller_create(parent);
|
obj = lv_roller_create(parent);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(obj, true);
|
||||||
|
|
||||||
lv_obj_t * list = lv_list_create(parent);
|
lv_obj_t * list = lv_list_create(parent);
|
||||||
lv_obj_update_layout(list);
|
lv_obj_update_layout(list);
|
||||||
@@ -154,7 +154,7 @@ static void text_input_create(lv_obj_t * parent)
|
|||||||
lv_textarea_set_placeholder_text(ta2, "Type something");
|
lv_textarea_set_placeholder_text(ta2, "Type something");
|
||||||
|
|
||||||
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, true);
|
||||||
|
|
||||||
lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);
|
lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);
|
||||||
lv_obj_add_event_cb(ta2, ta_event_cb, LV_EVENT_ALL, kb);
|
lv_obj_add_event_cb(ta2, ta_event_cb, LV_EVENT_ALL, kb);
|
||||||
@@ -201,7 +201,7 @@ static void ta_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
if(code == LV_EVENT_CLICKED && indev_type == LV_INDEV_TYPE_ENCODER) {
|
if(code == LV_EVENT_CLICKED && indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||||
lv_keyboard_set_textarea(kb, ta);
|
lv_keyboard_set_textarea(kb, ta);
|
||||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, false);
|
||||||
lv_group_focus_obj(kb);
|
lv_group_focus_obj(kb);
|
||||||
lv_group_set_editing(lv_obj_get_group(kb), kb != NULL);
|
lv_group_set_editing(lv_obj_get_group(kb), kb != NULL);
|
||||||
lv_obj_set_height(tv, LV_VER_RES / 2);
|
lv_obj_set_height(tv, LV_VER_RES / 2);
|
||||||
@@ -209,7 +209,7 @@ static void ta_event_cb(lv_event_t * e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(code == LV_EVENT_READY || code == LV_EVENT_CANCEL) {
|
if(code == LV_EVENT_READY || code == LV_EVENT_CANCEL) {
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, true);
|
||||||
lv_obj_set_height(tv, LV_VER_RES);
|
lv_obj_set_height(tv, LV_VER_RES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ static lv_obj_t * add_list_button(lv_obj_t * parent, uint32_t track_id)
|
|||||||
lv_image_set_inner_align(border, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(border, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_width(border, lv_pct(120));
|
lv_obj_set_width(border, lv_pct(120));
|
||||||
lv_obj_align(border, LV_ALIGN_BOTTOM_MID, 0, 0);
|
lv_obj_align(border, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||||
lv_obj_add_flag(border, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(border, true);
|
||||||
|
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,8 +396,8 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
|
|||||||
{
|
{
|
||||||
/*A transparent container in which the player section will be scrolled*/
|
/*A transparent container in which the player section will be scrolled*/
|
||||||
main_cont = lv_obj_create(parent);
|
main_cont = lv_obj_create(parent);
|
||||||
lv_obj_remove_flag(main_cont, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(main_cont, false);
|
||||||
lv_obj_remove_flag(main_cont, LV_OBJ_FLAG_SCROLL_ELASTIC);
|
lv_obj_set_scroll_elastic(main_cont, false);
|
||||||
lv_obj_remove_style_all(main_cont); /*Make it transparent*/
|
lv_obj_remove_style_all(main_cont); /*Make it transparent*/
|
||||||
lv_obj_set_size(main_cont, lv_pct(100), lv_pct(100));
|
lv_obj_set_size(main_cont, lv_pct(100), lv_pct(100));
|
||||||
lv_obj_set_scroll_snap_y(main_cont, LV_SCROLL_SNAP_CENTER); /*Snap the children to the center*/
|
lv_obj_set_scroll_snap_y(main_cont, LV_SCROLL_SNAP_CENTER); /*Snap the children to the center*/
|
||||||
@@ -410,7 +410,7 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
|
|||||||
#else
|
#else
|
||||||
lv_obj_set_size(player, music_width, music_height + LV_DEMO_MUSIC_HANDLE_SIZE * 2);
|
lv_obj_set_size(player, music_width, music_height + LV_DEMO_MUSIC_HANDLE_SIZE * 2);
|
||||||
#endif
|
#endif
|
||||||
lv_obj_remove_flag(player, LV_OBJ_FLAG_SNAPPABLE);
|
lv_obj_set_snappable(player, false);
|
||||||
|
|
||||||
lv_obj_set_style_bg_color(player, lv_color_hex(0xffffff), 0);
|
lv_obj_set_style_bg_color(player, lv_color_hex(0xffffff), 0);
|
||||||
lv_obj_set_style_border_width(player, 0, 0);
|
lv_obj_set_style_border_width(player, 0, 0);
|
||||||
@@ -421,16 +421,16 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
|
|||||||
* It is used only to snap it to center.*/
|
* It is used only to snap it to center.*/
|
||||||
lv_obj_t * placeholder1 = lv_obj_create(main_cont);
|
lv_obj_t * placeholder1 = lv_obj_create(main_cont);
|
||||||
lv_obj_remove_style_all(placeholder1);
|
lv_obj_remove_style_all(placeholder1);
|
||||||
lv_obj_remove_flag(placeholder1, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(placeholder1, false);
|
||||||
|
|
||||||
lv_obj_t * placeholder2 = lv_obj_create(main_cont);
|
lv_obj_t * placeholder2 = lv_obj_create(main_cont);
|
||||||
lv_obj_remove_style_all(placeholder2);
|
lv_obj_remove_style_all(placeholder2);
|
||||||
lv_obj_remove_flag(placeholder2, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(placeholder2, false);
|
||||||
|
|
||||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||||
lv_obj_t * placeholder3 = lv_obj_create(main_cont);
|
lv_obj_t * placeholder3 = lv_obj_create(main_cont);
|
||||||
lv_obj_remove_style_all(placeholder3);
|
lv_obj_remove_style_all(placeholder3);
|
||||||
lv_obj_remove_flag(placeholder3, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(placeholder3, false);
|
||||||
|
|
||||||
lv_obj_set_size(placeholder1, lv_pct(100), music_height);
|
lv_obj_set_size(placeholder1, lv_pct(100), music_height);
|
||||||
lv_obj_set_y(placeholder1, 0);
|
lv_obj_set_y(placeholder1, 0);
|
||||||
@@ -462,14 +462,14 @@ static void create_wave_images(lv_obj_t * parent)
|
|||||||
lv_image_set_inner_align(wave_top, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(wave_top, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_width(wave_top, music_width);
|
lv_obj_set_width(wave_top, music_width);
|
||||||
lv_obj_align(wave_top, LV_ALIGN_TOP_MID, 0, 0);
|
lv_obj_align(wave_top, LV_ALIGN_TOP_MID, 0, 0);
|
||||||
lv_obj_add_flag(wave_top, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(wave_top, true);
|
||||||
|
|
||||||
lv_obj_t * wave_bottom = lv_image_create(parent);
|
lv_obj_t * wave_bottom = lv_image_create(parent);
|
||||||
lv_image_set_src(wave_bottom, &img_lv_demo_music_wave_bottom);
|
lv_image_set_src(wave_bottom, &img_lv_demo_music_wave_bottom);
|
||||||
lv_image_set_inner_align(wave_bottom, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(wave_bottom, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_width(wave_bottom, music_width);
|
lv_obj_set_width(wave_bottom, music_width);
|
||||||
lv_obj_align(wave_bottom, LV_ALIGN_BOTTOM_MID, 0, 0);
|
lv_obj_align(wave_bottom, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||||
lv_obj_add_flag(wave_bottom, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(wave_bottom, true);
|
||||||
|
|
||||||
LV_IMAGE_DECLARE(img_lv_demo_music_corner_left);
|
LV_IMAGE_DECLARE(img_lv_demo_music_corner_left);
|
||||||
LV_IMAGE_DECLARE(img_lv_demo_music_corner_right);
|
LV_IMAGE_DECLARE(img_lv_demo_music_corner_right);
|
||||||
@@ -480,7 +480,7 @@ static void create_wave_images(lv_obj_t * parent)
|
|||||||
#else
|
#else
|
||||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_LEFT, -music_width / 6, 0);
|
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_LEFT, -music_width / 6, 0);
|
||||||
#endif
|
#endif
|
||||||
lv_obj_add_flag(wave_corner, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(wave_corner, true);
|
||||||
|
|
||||||
wave_corner = lv_image_create(parent);
|
wave_corner = lv_image_create(parent);
|
||||||
lv_image_set_src(wave_corner, &img_lv_demo_music_corner_right);
|
lv_image_set_src(wave_corner, &img_lv_demo_music_corner_right);
|
||||||
@@ -489,7 +489,7 @@ static void create_wave_images(lv_obj_t * parent)
|
|||||||
#else
|
#else
|
||||||
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_RIGHT, music_width / 6, 0);
|
lv_obj_align(wave_corner, LV_ALIGN_BOTTOM_RIGHT, music_width / 6, 0);
|
||||||
#endif
|
#endif
|
||||||
lv_obj_add_flag(wave_corner, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(wave_corner, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t * create_title_box(lv_obj_t * parent)
|
static lv_obj_t * create_title_box(lv_obj_t * parent)
|
||||||
@@ -557,7 +557,8 @@ static lv_obj_t * create_spectrum_obj(lv_obj_t * parent)
|
|||||||
#else
|
#else
|
||||||
lv_obj_set_height(obj, 250);
|
lv_obj_set_height(obj, 250);
|
||||||
#endif
|
#endif
|
||||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_clickable(obj, false);
|
||||||
|
lv_obj_set_scrollable(obj, false);
|
||||||
lv_obj_add_event_cb(obj, spectrum_draw_event_cb, LV_EVENT_ALL, NULL);
|
lv_obj_add_event_cb(obj, spectrum_draw_event_cb, LV_EVENT_ALL, NULL);
|
||||||
lv_obj_refresh_ext_draw_size(obj);
|
lv_obj_refresh_ext_draw_size(obj);
|
||||||
album_image_obj = album_image_create(obj);
|
album_image_obj = album_image_create(obj);
|
||||||
@@ -570,7 +571,7 @@ static lv_obj_t * create_ctrl_box(lv_obj_t * parent)
|
|||||||
lv_obj_t * cont = lv_obj_create(parent);
|
lv_obj_t * cont = lv_obj_create(parent);
|
||||||
lv_obj_remove_style_all(cont);
|
lv_obj_remove_style_all(cont);
|
||||||
lv_obj_set_height(cont, LV_SIZE_CONTENT);
|
lv_obj_set_height(cont, LV_SIZE_CONTENT);
|
||||||
lv_obj_remove_flag(cont, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(cont, false);
|
||||||
#if LV_DEMO_MUSIC_LARGE
|
#if LV_DEMO_MUSIC_LARGE
|
||||||
lv_obj_set_style_pad_bottom(cont, 17, 0);
|
lv_obj_set_style_pad_bottom(cont, 17, 0);
|
||||||
#else
|
#else
|
||||||
@@ -600,29 +601,29 @@ static lv_obj_t * create_ctrl_box(lv_obj_t * parent)
|
|||||||
lv_image_set_src(icon, &img_lv_demo_music_btn_prev);
|
lv_image_set_src(icon, &img_lv_demo_music_btn_prev);
|
||||||
lv_obj_set_grid_cell(icon, LV_GRID_ALIGN_CENTER, 2, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
lv_obj_set_grid_cell(icon, LV_GRID_ALIGN_CENTER, 2, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
lv_obj_add_event_cb(icon, prev_click_event_cb, LV_EVENT_CLICKED, NULL);
|
lv_obj_add_event_cb(icon, prev_click_event_cb, LV_EVENT_CLICKED, NULL);
|
||||||
lv_obj_add_flag(icon, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(icon, true);
|
||||||
|
|
||||||
play_obj = lv_imagebutton_create(cont);
|
play_obj = lv_imagebutton_create(cont);
|
||||||
lv_imagebutton_set_src(play_obj, LV_IMAGEBUTTON_STATE_RELEASED, NULL, &img_lv_demo_music_btn_play, NULL);
|
lv_imagebutton_set_src(play_obj, LV_IMAGEBUTTON_STATE_RELEASED, NULL, &img_lv_demo_music_btn_play, NULL);
|
||||||
lv_imagebutton_set_src(play_obj, LV_IMAGEBUTTON_STATE_CHECKED_RELEASED, NULL, &img_lv_demo_music_btn_pause, NULL);
|
lv_imagebutton_set_src(play_obj, LV_IMAGEBUTTON_STATE_CHECKED_RELEASED, NULL, &img_lv_demo_music_btn_pause, NULL);
|
||||||
lv_obj_add_flag(play_obj, LV_OBJ_FLAG_CHECKABLE);
|
lv_obj_set_checkable(play_obj, true);
|
||||||
lv_obj_set_grid_cell(play_obj, LV_GRID_ALIGN_CENTER, 3, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
lv_obj_set_grid_cell(play_obj, LV_GRID_ALIGN_CENTER, 3, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
|
|
||||||
lv_obj_add_event_cb(play_obj, play_event_click_cb, LV_EVENT_CLICKED, NULL);
|
lv_obj_add_event_cb(play_obj, play_event_click_cb, LV_EVENT_CLICKED, NULL);
|
||||||
lv_obj_add_flag(play_obj, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(play_obj, true);
|
||||||
lv_obj_set_width(play_obj, img_lv_demo_music_btn_play.header.w);
|
lv_obj_set_width(play_obj, img_lv_demo_music_btn_play.header.w);
|
||||||
|
|
||||||
icon = lv_image_create(cont);
|
icon = lv_image_create(cont);
|
||||||
lv_image_set_src(icon, &img_lv_demo_music_btn_next);
|
lv_image_set_src(icon, &img_lv_demo_music_btn_next);
|
||||||
lv_obj_set_grid_cell(icon, LV_GRID_ALIGN_CENTER, 4, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
lv_obj_set_grid_cell(icon, LV_GRID_ALIGN_CENTER, 4, 1, LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
lv_obj_add_event_cb(icon, next_click_event_cb, LV_EVENT_CLICKED, NULL);
|
lv_obj_add_event_cb(icon, next_click_event_cb, LV_EVENT_CLICKED, NULL);
|
||||||
lv_obj_add_flag(icon, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(icon, true);
|
||||||
|
|
||||||
LV_IMAGE_DECLARE(img_lv_demo_music_slider_knob);
|
LV_IMAGE_DECLARE(img_lv_demo_music_slider_knob);
|
||||||
slider_obj = lv_slider_create(cont);
|
slider_obj = lv_slider_create(cont);
|
||||||
lv_obj_set_style_anim_duration(slider_obj, 100, 0);
|
lv_obj_set_style_anim_duration(slider_obj, 100, 0);
|
||||||
lv_obj_add_flag(slider_obj, LV_OBJ_FLAG_CLICKABLE); /*No input from the slider*/
|
lv_obj_set_clickable(slider_obj, true); /*No input from the slider*/
|
||||||
lv_obj_remove_flag(slider_obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(slider_obj, false);
|
||||||
|
|
||||||
#if LV_DEMO_MUSIC_LARGE == 0
|
#if LV_DEMO_MUSIC_LARGE == 0
|
||||||
lv_obj_set_height(slider_obj, 3);
|
lv_obj_set_height(slider_obj, 3);
|
||||||
@@ -972,8 +973,8 @@ static lv_obj_t * album_image_create(lv_obj_t * parent)
|
|||||||
lv_image_set_antialias(img, false);
|
lv_image_set_antialias(img, false);
|
||||||
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
|
||||||
lv_obj_add_event_cb(img, album_gesture_event_cb, LV_EVENT_GESTURE, NULL);
|
lv_obj_add_event_cb(img, album_gesture_event_cb, LV_EVENT_GESTURE, NULL);
|
||||||
lv_obj_remove_flag(img, LV_OBJ_FLAG_GESTURE_BUBBLE);
|
lv_obj_set_gesture_bubble(img, false);
|
||||||
lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(img, true);
|
||||||
|
|
||||||
return img;
|
return img;
|
||||||
|
|
||||||
|
|||||||
@@ -878,7 +878,7 @@ static void blend_mode_cb(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_image_recolor(img_recolored, lv_color_hex(0x00ff00), 0);
|
lv_obj_set_style_image_recolor(img_recolored, lv_color_hex(0x00ff00), 0);
|
||||||
lv_obj_set_style_image_recolor_opa(img_recolored, LV_OPA_50, 0);
|
lv_obj_set_style_image_recolor_opa(img_recolored, LV_OPA_50, 0);
|
||||||
lv_obj_set_y(img_recolored, 30);
|
lv_obj_set_y(img_recolored, 30);
|
||||||
lv_obj_add_flag(img_recolored, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(img_recolored, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,19 +81,19 @@ void lv_demo_widgets_with_args(const lv_demo_args_t * args)
|
|||||||
lv_obj_t * tab_bar = lv_tabview_get_tab_bar(tv);
|
lv_obj_t * tab_bar = lv_tabview_get_tab_bar(tv);
|
||||||
lv_obj_set_style_pad_left(tab_bar, LV_HOR_RES / 2, 0);
|
lv_obj_set_style_pad_left(tab_bar, LV_HOR_RES / 2, 0);
|
||||||
lv_obj_t * logo = lv_image_create(tab_bar);
|
lv_obj_t * logo = lv_image_create(tab_bar);
|
||||||
lv_obj_add_flag(logo, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(logo, true);
|
||||||
LV_IMAGE_DECLARE(img_lvgl_logo);
|
LV_IMAGE_DECLARE(img_lvgl_logo);
|
||||||
lv_image_set_src(logo, &img_lvgl_logo);
|
lv_image_set_src(logo, &img_lvgl_logo);
|
||||||
lv_obj_align(logo, LV_ALIGN_LEFT_MID, -LV_HOR_RES / 2 + 25, 0);
|
lv_obj_align(logo, LV_ALIGN_LEFT_MID, -LV_HOR_RES / 2 + 25, 0);
|
||||||
|
|
||||||
lv_obj_t * label = lv_demo_widgets_title_create(tab_bar, "");
|
lv_obj_t * label = lv_demo_widgets_title_create(tab_bar, "");
|
||||||
lv_obj_add_flag(label, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(label, true);
|
||||||
lv_label_set_text_fmt(label, "LVGL v%d.%d.%d", lv_version_major(), lv_version_minor(), lv_version_patch());
|
lv_label_set_text_fmt(label, "LVGL v%d.%d.%d", lv_version_major(), lv_version_minor(), lv_version_patch());
|
||||||
lv_obj_align_to(label, logo, LV_ALIGN_OUT_RIGHT_TOP, 10, 0);
|
lv_obj_align_to(label, logo, LV_ALIGN_OUT_RIGHT_TOP, 10, 0);
|
||||||
|
|
||||||
label = lv_label_create(tab_bar);
|
label = lv_label_create(tab_bar);
|
||||||
lv_label_set_text_static(label, "Widgets demo");
|
lv_label_set_text_static(label, "Widgets demo");
|
||||||
lv_obj_add_flag(label, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(label, true);
|
||||||
lv_obj_add_style(label, &style_text_muted, 0);
|
lv_obj_add_style(label, &style_text_muted, 0);
|
||||||
lv_obj_align_to(label, logo, LV_ALIGN_OUT_RIGHT_BOTTOM, 10, 0);
|
lv_obj_align_to(label, logo, LV_ALIGN_OUT_RIGHT_BOTTOM, 10, 0);
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ static void color_changer_create(lv_obj_t * parent)
|
|||||||
lv_obj_remove_style_all(color_cont);
|
lv_obj_remove_style_all(color_cont);
|
||||||
lv_obj_set_flex_flow(color_cont, LV_FLEX_FLOW_ROW);
|
lv_obj_set_flex_flow(color_cont, LV_FLEX_FLOW_ROW);
|
||||||
lv_obj_set_flex_align(color_cont, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
lv_obj_set_flex_align(color_cont, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||||
lv_obj_add_flag(color_cont, LV_OBJ_FLAG_FLOATING);
|
lv_obj_set_floating(color_cont, true);
|
||||||
|
|
||||||
lv_obj_set_style_bg_color(color_cont, lv_color_white(), 0);
|
lv_obj_set_style_bg_color(color_cont, lv_color_white(), 0);
|
||||||
lv_obj_set_style_pad_right(color_cont, disp_size == DISP_SMALL ? LV_DPX(47) : LV_DPX(55), 0);
|
lv_obj_set_style_pad_right(color_cont, disp_size == DISP_SMALL ? LV_DPX(47) : LV_DPX(55), 0);
|
||||||
@@ -162,11 +162,12 @@ static void color_changer_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_opa(c, LV_OPA_TRANSP, 0);
|
lv_obj_set_style_opa(c, LV_OPA_TRANSP, 0);
|
||||||
lv_obj_set_size(c, 20, 20);
|
lv_obj_set_size(c, 20, 20);
|
||||||
lv_obj_add_event_cb(c, color_event_cb, LV_EVENT_ALL, &palette[i]);
|
lv_obj_add_event_cb(c, color_event_cb, LV_EVENT_ALL, &palette[i]);
|
||||||
lv_obj_remove_flag(c, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
lv_obj_set_scroll_on_focus(c, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_t * btn = lv_button_create(parent);
|
lv_obj_t * btn = lv_button_create(parent);
|
||||||
lv_obj_add_flag(btn, LV_OBJ_FLAG_FLOATING | LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_floating(btn, true);
|
||||||
|
lv_obj_set_clickable(btn, true);
|
||||||
lv_obj_set_style_bg_color(btn, lv_color_white(), LV_STATE_CHECKED);
|
lv_obj_set_style_bg_color(btn, lv_color_white(), LV_STATE_CHECKED);
|
||||||
lv_obj_set_style_pad_all(btn, 10, 0);
|
lv_obj_set_style_pad_all(btn, 10, 0);
|
||||||
lv_obj_set_style_radius(btn, LV_RADIUS_CIRCLE, 0);
|
lv_obj_set_style_radius(btn, LV_RADIUS_CIRCLE, 0);
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_height(chart2_cont, lv_pct(100));
|
lv_obj_set_height(chart2_cont, lv_pct(100));
|
||||||
lv_obj_set_style_max_height(chart2_cont, 300, 0);
|
lv_obj_set_style_max_height(chart2_cont, 300, 0);
|
||||||
lv_obj_set_flex_grow(chart2_cont, 1);
|
lv_obj_set_flex_grow(chart2_cont, 1);
|
||||||
lv_obj_add_flag(chart2_cont, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(chart2_cont, true);
|
||||||
|
|
||||||
static const char * chart2_texts[] = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", NULL};
|
static const char * chart2_texts[] = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", NULL};
|
||||||
chart2 = create_chart_with_scales(chart2_cont, "Monthly revenue", chart2_texts);
|
chart2 = create_chart_with_scales(chart2_cont, "Monthly revenue", chart2_texts);
|
||||||
@@ -117,13 +117,13 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
/*Create all 3 scales first to have their size resolved*/
|
/*Create all 3 scales first to have their size resolved*/
|
||||||
scale1 = create_scale_box(parent, "Monthly Target", "Revenue: -", "Sales: -", "Costs: -");
|
scale1 = create_scale_box(parent, "Monthly Target", "Revenue: -", "Sales: -", "Costs: -");
|
||||||
lv_obj_add_flag(lv_obj_get_parent(scale1), LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(lv_obj_get_parent(scale1), true);
|
||||||
|
|
||||||
scale2 = create_scale_box(parent, "Sessions", "Desktop: -", "Tablet: -", "Mobile: -");
|
scale2 = create_scale_box(parent, "Sessions", "Desktop: -", "Tablet: -", "Mobile: -");
|
||||||
if(disp_size < DISP_LARGE) lv_obj_add_flag(lv_obj_get_parent(scale2), LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(disp_size < DISP_LARGE) lv_obj_set_flex_in_new_track(lv_obj_get_parent(scale2), true);
|
||||||
|
|
||||||
scale3 = create_scale_box(parent, "Network Speed", "Low speed", "Normal Speed", "High Speed");
|
scale3 = create_scale_box(parent, "Network Speed", "Low speed", "Normal Speed", "High Speed");
|
||||||
if(disp_size < DISP_LARGE) lv_obj_add_flag(lv_obj_get_parent(scale3), LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
if(disp_size < DISP_LARGE) lv_obj_set_flex_in_new_track(lv_obj_get_parent(scale3), true);
|
||||||
|
|
||||||
lv_obj_update_layout(parent);
|
lv_obj_update_layout(parent);
|
||||||
int32_t scale_w;
|
int32_t scale_w;
|
||||||
@@ -156,7 +156,7 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_arc_opa(arc, 0, 0);
|
lv_obj_set_style_arc_opa(arc, 0, 0);
|
||||||
lv_obj_set_style_arc_width(arc, 15, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_width(arc, 15, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
|
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
|
||||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(arc, false);
|
||||||
|
|
||||||
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
||||||
lv_anim_set_var(&a, arc);
|
lv_anim_set_var(&a, arc);
|
||||||
@@ -171,7 +171,7 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_arc_opa(arc, 0, 0);
|
lv_obj_set_style_arc_opa(arc, 0, 0);
|
||||||
lv_obj_set_style_arc_width(arc, 15, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_width(arc, 15, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_RED), LV_PART_INDICATOR);
|
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_RED), LV_PART_INDICATOR);
|
||||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(arc, false);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
|
|
||||||
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
||||||
@@ -187,7 +187,7 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_arc_opa(arc, 0, 0);
|
lv_obj_set_style_arc_opa(arc, 0, 0);
|
||||||
lv_obj_set_style_arc_width(arc, 15, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_width(arc, 15, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
|
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
|
||||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(arc, false);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
|
|
||||||
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
|
||||||
@@ -211,7 +211,7 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_arc_width(arc, 10, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_width(arc, 10, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
|
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
|
||||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(arc, false);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
|
|
||||||
arc = lv_arc_create(scale2);
|
arc = lv_arc_create(scale2);
|
||||||
@@ -223,7 +223,7 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_arc_width(arc, 20, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_width(arc, 20, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_RED), LV_PART_INDICATOR);
|
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_RED), LV_PART_INDICATOR);
|
||||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(arc, false);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
|
|
||||||
arc = lv_arc_create(scale2);
|
arc = lv_arc_create(scale2);
|
||||||
@@ -234,7 +234,7 @@ void lv_demo_widgets_analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_arc_width(arc, 30, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_width(arc, 30, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
|
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
|
||||||
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
|
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
|
||||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(arc, false);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
|
|
||||||
lv_timer_t * scale2_timer = lv_timer_create(scale2_timer_cb, 100, scale2);
|
lv_timer_t * scale2_timer = lv_timer_create(scale2_timer_cb, 100, scale2);
|
||||||
@@ -543,7 +543,8 @@ static lv_obj_t * create_chart_with_scales(lv_obj_t * parent, const char * title
|
|||||||
|
|
||||||
lv_obj_t * chart = lv_chart_create(wrapper);
|
lv_obj_t * chart = lv_chart_create(wrapper);
|
||||||
lv_group_add_obj(lv_group_get_default(), chart);
|
lv_group_add_obj(lv_group_get_default(), chart);
|
||||||
lv_obj_add_flag(chart, LV_OBJ_FLAG_SCROLL_ON_FOCUS | LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_scroll_on_focus(chart, true);
|
||||||
|
lv_obj_set_send_draw_task_events(chart, true);
|
||||||
lv_chart_set_div_line_count(chart, 0, 12);
|
lv_chart_set_div_line_count(chart, 0, 12);
|
||||||
lv_chart_set_point_count(chart, 12);
|
lv_chart_set_point_count(chart, 12);
|
||||||
lv_obj_set_grid_cell(chart, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_STRETCH, 0, 1);
|
lv_obj_set_grid_cell(chart, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_STRETCH, 0, 1);
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void lv_demo_widgets_profile_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
/*Create a keyboard*/
|
/*Create a keyboard*/
|
||||||
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, true);
|
||||||
|
|
||||||
/*Create the second panel*/
|
/*Create the second panel*/
|
||||||
lv_obj_t * panel2 = lv_obj_create(parent);
|
lv_obj_t * panel2 = lv_obj_create(parent);
|
||||||
@@ -146,7 +146,7 @@ void lv_demo_widgets_profile_create(lv_obj_t * parent)
|
|||||||
lv_obj_t * slider1 = lv_slider_create(panel3);
|
lv_obj_t * slider1 = lv_slider_create(panel3);
|
||||||
lv_obj_set_width(slider1, LV_PCT(95));
|
lv_obj_set_width(slider1, LV_PCT(95));
|
||||||
lv_obj_add_event_cb(slider1, slider_event_cb, LV_EVENT_ALL, NULL);
|
lv_obj_add_event_cb(slider1, slider_event_cb, LV_EVENT_ALL, NULL);
|
||||||
lv_obj_add_flag(slider1, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_send_draw_task_events(slider1, true);
|
||||||
lv_obj_refresh_ext_draw_size(slider1);
|
lv_obj_refresh_ext_draw_size(slider1);
|
||||||
|
|
||||||
lv_obj_t * team_player_label = lv_label_create(panel3);
|
lv_obj_t * team_player_label = lv_label_create(panel3);
|
||||||
@@ -376,7 +376,7 @@ static void ta_event_cb(lv_event_t * e)
|
|||||||
lv_obj_set_style_max_height(kb, LV_HOR_RES * 2 / 3, 0);
|
lv_obj_set_style_max_height(kb, LV_HOR_RES * 2 / 3, 0);
|
||||||
lv_obj_update_layout(tv); /*Be sure the sizes are recalculated*/
|
lv_obj_update_layout(tv); /*Be sure the sizes are recalculated*/
|
||||||
lv_obj_set_height(tv, LV_VER_RES - lv_obj_get_height(kb));
|
lv_obj_set_height(tv, LV_VER_RES - lv_obj_get_height(kb));
|
||||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, false);
|
||||||
lv_obj_scroll_to_view_recursive(ta, LV_ANIM_OFF);
|
lv_obj_scroll_to_view_recursive(ta, LV_ANIM_OFF);
|
||||||
lv_indev_wait_release(lv_event_get_param(e));
|
lv_indev_wait_release(lv_event_get_param(e));
|
||||||
}
|
}
|
||||||
@@ -384,13 +384,13 @@ static void ta_event_cb(lv_event_t * e)
|
|||||||
else if(code == LV_EVENT_DEFOCUSED) {
|
else if(code == LV_EVENT_DEFOCUSED) {
|
||||||
lv_keyboard_set_textarea(kb, NULL);
|
lv_keyboard_set_textarea(kb, NULL);
|
||||||
lv_obj_set_height(tv, LV_VER_RES);
|
lv_obj_set_height(tv, LV_VER_RES);
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, true);
|
||||||
lv_indev_reset(NULL, ta);
|
lv_indev_reset(NULL, ta);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(code == LV_EVENT_READY || code == LV_EVENT_CANCEL) {
|
else if(code == LV_EVENT_READY || code == LV_EVENT_CANCEL) {
|
||||||
lv_obj_set_height(tv, LV_VER_RES);
|
lv_obj_set_height(tv, LV_VER_RES);
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, true);
|
||||||
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,7 +403,7 @@ static void birthday_event_cb(lv_event_t * e)
|
|||||||
if(code == LV_EVENT_FOCUSED) {
|
if(code == LV_EVENT_FOCUSED) {
|
||||||
if(lv_indev_get_type(lv_indev_active()) == LV_INDEV_TYPE_POINTER) {
|
if(lv_indev_get_type(lv_indev_active()) == LV_INDEV_TYPE_POINTER) {
|
||||||
if(calendar == NULL) {
|
if(calendar == NULL) {
|
||||||
lv_obj_add_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(lv_layer_top(), true);
|
||||||
calendar = lv_calendar_create(lv_layer_top());
|
calendar = lv_calendar_create(lv_layer_top());
|
||||||
lv_obj_set_style_bg_opa(lv_layer_top(), LV_OPA_50, 0);
|
lv_obj_set_style_bg_opa(lv_layer_top(), LV_OPA_50, 0);
|
||||||
lv_obj_set_style_bg_color(lv_layer_top(), lv_palette_main(LV_PALETTE_GREY), 0);
|
lv_obj_set_style_bg_color(lv_layer_top(), lv_palette_main(LV_PALETTE_GREY), 0);
|
||||||
@@ -434,7 +434,7 @@ static void calendar_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
lv_obj_delete(calendar);
|
lv_obj_delete(calendar);
|
||||||
calendar = NULL;
|
calendar = NULL;
|
||||||
lv_obj_remove_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(lv_layer_top(), false);
|
||||||
lv_obj_set_style_bg_opa(lv_layer_top(), LV_OPA_TRANSP, 0);
|
lv_obj_set_style_bg_opa(lv_layer_top(), LV_OPA_TRANSP, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ void lv_demo_widgets_shop_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
lv_obj_t * list = lv_obj_create(parent);
|
lv_obj_t * list = lv_obj_create(parent);
|
||||||
if(disp_size == DISP_SMALL) {
|
if(disp_size == DISP_SMALL) {
|
||||||
lv_obj_add_flag(list, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(list, true);
|
||||||
lv_obj_set_height(list, LV_PCT(100));
|
lv_obj_set_height(list, LV_PCT(100));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -156,7 +156,7 @@ void lv_demo_widgets_shop_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN);
|
||||||
lv_obj_set_flex_grow(list, 1);
|
lv_obj_set_flex_grow(list, 1);
|
||||||
lv_obj_add_flag(list, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(list, true);
|
||||||
|
|
||||||
title = lv_demo_widgets_title_create(list, "Top products");
|
title = lv_demo_widgets_title_create(list, "Top products");
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ void lv_demo_widgets_shop_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
lv_obj_t * notifications = lv_obj_create(parent);
|
lv_obj_t * notifications = lv_obj_create(parent);
|
||||||
if(disp_size == DISP_SMALL) {
|
if(disp_size == DISP_SMALL) {
|
||||||
lv_obj_add_flag(notifications, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(notifications, true);
|
||||||
lv_obj_set_height(notifications, LV_PCT(100));
|
lv_obj_set_height(notifications, LV_PCT(100));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -3,6 +3,14 @@ title: Flags
|
|||||||
description: Some widget attributes can be enabled or disabled using lv_obj_add_flag and lv_obj_remove_flag.
|
description: Some widget attributes can be enabled or disabled using lv_obj_add_flag and lv_obj_remove_flag.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<Callout type="warning" title="Deprecating Flags">
|
||||||
|
Flags are deprecated in LVGL v9.6 and will be removed in LVGL v10.
|
||||||
|
Use a dedicated function instead, such as <ApiLink name="lv_obj_set_hidden"/>.
|
||||||
|
|
||||||
|
<ApiLink name="lv_obj_set_user_flag"/> and <ApiLink name="lv_obj_get_user_flag"/>
|
||||||
|
can be used to replace `LV_OBJ_FLAG_USER_1-4`.
|
||||||
|
</Callout>
|
||||||
|
|
||||||
Some widget attributes can be enabled or disabled using
|
Some widget attributes can be enabled or disabled using
|
||||||
<ApiLink name="lv_obj_add_flag" display="lv_obj_add_flag(widget, LV_OBJ_FLAG_...)" /> and
|
<ApiLink name="lv_obj_add_flag" display="lv_obj_add_flag(widget, LV_OBJ_FLAG_...)" /> and
|
||||||
<ApiLink name="lv_obj_remove_flag" display="lv_obj_remove_flag(widget, LV_OBJ_FLAG_...)" />.
|
<ApiLink name="lv_obj_remove_flag" display="lv_obj_remove_flag(widget, LV_OBJ_FLAG_...)" />.
|
||||||
|
|||||||
@@ -103,6 +103,26 @@ if you need finer control.
|
|||||||
lv_obj_t * obj = lv_obj_find_by_name(parent, "my_widget");
|
lv_obj_t * obj = lv_obj_find_by_name(parent, "my_widget");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- The generic flag API — `lv_obj_add_flag()`, `lv_obj_remove_flag()`,
|
||||||
|
`lv_obj_set_flag()`, `lv_obj_has_flag()` and `lv_obj_has_flag_any()` — is
|
||||||
|
deprecated. Each flag now has a dedicated setter (`lv_obj_set_<flag>(obj, en)`)
|
||||||
|
and getter (`lv_obj_is_<flag>(obj)`):
|
||||||
|
```c
|
||||||
|
/* Before */
|
||||||
|
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
|
||||||
|
lv_obj_set_flag(obj, LV_OBJ_FLAG_SCROLLABLE, en);
|
||||||
|
bool h = lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
|
/* After */
|
||||||
|
lv_obj_set_hidden(obj, true);
|
||||||
|
lv_obj_set_clickable(obj, false);
|
||||||
|
lv_obj_set_scrollable(obj, en);
|
||||||
|
bool h = lv_obj_is_hidden(obj);
|
||||||
|
```
|
||||||
|
The custom-bit flags (`LV_OBJ_FLAG_USER_1`–`4`) can be accessed via
|
||||||
|
`lv_obj_set/get_user_flag()`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Widgets
|
## Widgets
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void lv_example_anim_2(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
||||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(obj, false);
|
||||||
lv_obj_set_style_bg_color(obj, lv_palette_main(LV_PALETTE_RED), 0);
|
lv_obj_set_style_bg_color(obj, lv_palette_main(LV_PALETTE_RED), 0);
|
||||||
lv_obj_set_style_radius(obj, LV_RADIUS_CIRCLE, 0);
|
lv_obj_set_style_radius(obj, LV_RADIUS_CIRCLE, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ static void page_obj_init(lv_obj_t * par)
|
|||||||
ginfo.anim_obj = lv_obj_create(par);
|
ginfo.anim_obj = lv_obj_create(par);
|
||||||
lv_obj_set_size(ginfo.anim_obj, 30, 30);
|
lv_obj_set_size(ginfo.anim_obj, 30, 30);
|
||||||
lv_obj_set_align(ginfo.anim_obj, LV_ALIGN_TOP_LEFT);
|
lv_obj_set_align(ginfo.anim_obj, LV_ALIGN_TOP_LEFT);
|
||||||
lv_obj_remove_flag(ginfo.anim_obj, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(ginfo.anim_obj, false);
|
||||||
lv_obj_set_style_bg_color(ginfo.anim_obj, lv_palette_main(LV_PALETTE_RED), LV_PART_MAIN);
|
lv_obj_set_style_bg_color(ginfo.anim_obj, lv_palette_main(LV_PALETTE_RED), LV_PART_MAIN);
|
||||||
lv_obj_set_grid_cell(ginfo.anim_obj, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 0, 1);
|
lv_obj_set_grid_cell(ginfo.anim_obj, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 0, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ void lv_example_anim_timeline_1(void)
|
|||||||
/* create btn_start */
|
/* create btn_start */
|
||||||
lv_obj_t * btn_start = lv_button_create(par);
|
lv_obj_t * btn_start = lv_button_create(par);
|
||||||
lv_obj_add_event_cb(btn_start, btn_start_event_handler, LV_EVENT_VALUE_CHANGED, anim_timeline);
|
lv_obj_add_event_cb(btn_start, btn_start_event_handler, LV_EVENT_VALUE_CHANGED, anim_timeline);
|
||||||
lv_obj_add_flag(btn_start, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(btn_start, true);
|
||||||
lv_obj_add_flag(btn_start, LV_OBJ_FLAG_CHECKABLE);
|
lv_obj_set_checkable(btn_start, true);
|
||||||
lv_obj_align(btn_start, LV_ALIGN_TOP_MID, -100, 20);
|
lv_obj_align(btn_start, LV_ALIGN_TOP_MID, -100, 20);
|
||||||
|
|
||||||
lv_obj_t * label_start = lv_label_create(btn_start);
|
lv_obj_t * label_start = lv_label_create(btn_start);
|
||||||
@@ -80,7 +80,7 @@ void lv_example_anim_timeline_1(void)
|
|||||||
/* create btn_pause */
|
/* create btn_pause */
|
||||||
lv_obj_t * btn_pause = lv_button_create(par);
|
lv_obj_t * btn_pause = lv_button_create(par);
|
||||||
lv_obj_add_event_cb(btn_pause, btn_pause_event_handler, LV_EVENT_CLICKED, anim_timeline);
|
lv_obj_add_event_cb(btn_pause, btn_pause_event_handler, LV_EVENT_CLICKED, anim_timeline);
|
||||||
lv_obj_add_flag(btn_pause, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(btn_pause, true);
|
||||||
lv_obj_align(btn_pause, LV_ALIGN_TOP_MID, 100, 20);
|
lv_obj_align(btn_pause, LV_ALIGN_TOP_MID, 100, 20);
|
||||||
|
|
||||||
lv_obj_t * label_pause = lv_label_create(btn_pause);
|
lv_obj_t * label_pause = lv_label_create(btn_pause);
|
||||||
@@ -90,7 +90,7 @@ void lv_example_anim_timeline_1(void)
|
|||||||
/* create slider_prg */
|
/* create slider_prg */
|
||||||
lv_obj_t * slider_prg = lv_slider_create(par);
|
lv_obj_t * slider_prg = lv_slider_create(par);
|
||||||
lv_obj_add_event_cb(slider_prg, slider_prg_event_handler, LV_EVENT_VALUE_CHANGED, anim_timeline);
|
lv_obj_add_event_cb(slider_prg, slider_prg_event_handler, LV_EVENT_VALUE_CHANGED, anim_timeline);
|
||||||
lv_obj_add_flag(slider_prg, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(slider_prg, true);
|
||||||
lv_obj_align(slider_prg, LV_ALIGN_BOTTOM_MID, 0, -20);
|
lv_obj_align(slider_prg, LV_ALIGN_BOTTOM_MID, 0, -20);
|
||||||
lv_slider_set_range(slider_prg, 0, LV_ANIM_TIMELINE_PROGRESS_MAX);
|
lv_slider_set_range(slider_prg, 0, LV_ANIM_TIMELINE_PROGRESS_MAX);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void lv_example_event_bubble(void)
|
|||||||
for(i = 0; i < 30; i++) {
|
for(i = 0; i < 30; i++) {
|
||||||
lv_obj_t * btn = lv_button_create(cont);
|
lv_obj_t * btn = lv_button_create(cont);
|
||||||
lv_obj_set_size(btn, 70, 50);
|
lv_obj_set_size(btn, 70, 50);
|
||||||
lv_obj_add_flag(btn, LV_OBJ_FLAG_EVENT_BUBBLE);
|
lv_obj_set_event_bubble(btn, true);
|
||||||
|
|
||||||
lv_obj_t * label = lv_label_create(btn);
|
lv_obj_t * label = lv_label_create(btn);
|
||||||
lv_label_set_text_fmt(label, "%" LV_PRIu32, i);
|
lv_label_set_text_fmt(label, "%" LV_PRIu32, i);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void lv_example_event_draw(void)
|
|||||||
lv_obj_set_size(cont, 200, 200);
|
lv_obj_set_size(cont, 200, 200);
|
||||||
lv_obj_center(cont);
|
lv_obj_center(cont);
|
||||||
lv_obj_add_event_cb(cont, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
lv_obj_add_event_cb(cont, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||||
lv_obj_add_flag(cont, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_send_draw_task_events(cont, true);
|
||||||
lv_timer_create(timer_cb, 30, cont);
|
lv_timer_create(timer_cb, 30, cont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void lv_example_event_trickle(void)
|
|||||||
lv_style_set_bg_color(&style_black, lv_color_black());
|
lv_style_set_bg_color(&style_black, lv_color_black());
|
||||||
|
|
||||||
/*Enable event trickle-down on the container*/
|
/*Enable event trickle-down on the container*/
|
||||||
lv_obj_add_flag(cont, LV_OBJ_FLAG_EVENT_TRICKLE);
|
lv_obj_set_event_trickle(cont, true);
|
||||||
|
|
||||||
lv_obj_add_style(cont, &style_black, LV_STATE_PRESSED);
|
lv_obj_add_style(cont, &style_black, LV_STATE_PRESSED);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void lv_example_flex_ignore_layout(void)
|
|||||||
align and does not occupy a flex slot. */
|
align and does not occupy a flex slot. */
|
||||||
lv_obj_t * button_2 = lv_button_create(container);
|
lv_obj_t * button_2 = lv_button_create(container);
|
||||||
lv_obj_set_align(button_2, LV_ALIGN_CENTER);
|
lv_obj_set_align(button_2, LV_ALIGN_CENTER);
|
||||||
lv_obj_set_flag(button_2, LV_OBJ_FLAG_IGNORE_LAYOUT, true);
|
lv_obj_set_ignore_layout(button_2, true);
|
||||||
lv_obj_set_style_bg_color(button_2, lv_color_hex(0xe74c3c), 0);
|
lv_obj_set_style_bg_color(button_2, lv_color_hex(0xe74c3c), 0);
|
||||||
lv_obj_t * label_2 = lv_label_create(button_2);
|
lv_obj_t * label_2 = lv_label_create(button_2);
|
||||||
lv_label_set_text(label_2, "I'm Free!");
|
lv_label_set_text(label_2, "I'm Free!");
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void lv_example_flex_new_track(void)
|
|||||||
|
|
||||||
/* Track 2 — forced onto a new track */
|
/* Track 2 — forced onto a new track */
|
||||||
lv_obj_t * label_6 = lv_label_create(container);
|
lv_obj_t * label_6 = lv_label_create(container);
|
||||||
lv_obj_set_flag(label_6, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK, true);
|
lv_obj_set_flex_in_new_track(label_6, true);
|
||||||
lv_obj_set_style_bg_color(label_6, lv_color_hex(0xe74c3c), 0);
|
lv_obj_set_style_bg_color(label_6, lv_color_hex(0xe74c3c), 0);
|
||||||
lv_label_set_text(label_6, "Sat");
|
lv_label_set_text(label_6, "Sat");
|
||||||
lv_obj_add_style(label_6, &style_day, 0);
|
lv_obj_add_style(label_6, &style_day, 0);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void lv_example_grid_ignore_layout(void)
|
|||||||
lv_obj_add_style(label_4, &style_cell, 0);
|
lv_obj_add_style(label_4, &style_cell, 0);
|
||||||
|
|
||||||
lv_obj_t * label_5 = lv_label_create(container);
|
lv_obj_t * label_5 = lv_label_create(container);
|
||||||
lv_obj_set_flag(label_5, LV_OBJ_FLAG_IGNORE_LAYOUT, true);
|
lv_obj_set_ignore_layout(label_5, true);
|
||||||
lv_obj_set_align(label_5, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_5, LV_ALIGN_CENTER);
|
||||||
lv_obj_set_style_bg_color(label_5, lv_color_hex(0xe74c3c), 0);
|
lv_obj_set_style_bg_color(label_5, lv_color_hex(0xe74c3c), 0);
|
||||||
lv_label_set_text(label_5, "FREE");
|
lv_label_set_text(label_5, "FREE");
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void lv_example_split(void)
|
|||||||
{
|
{
|
||||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||||
lv_obj_set_size(cont, lv_pct(100), lv_pct(100));
|
lv_obj_set_size(cont, lv_pct(100), lv_pct(100));
|
||||||
lv_obj_remove_flag(cont, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(cont, false);
|
||||||
lv_obj_set_style_pad_all(cont, 0, 0);
|
lv_obj_set_style_pad_all(cont, 0, 0);
|
||||||
lv_obj_set_style_border_width(cont, 0, 0);
|
lv_obj_set_style_border_width(cont, 0, 0);
|
||||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW);
|
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW);
|
||||||
@@ -64,8 +64,7 @@ void lv_example_split(void)
|
|||||||
/* Divider: the draggable handle */
|
/* Divider: the draggable handle */
|
||||||
lv_obj_t * divider = lv_obj_create(cont);
|
lv_obj_t * divider = lv_obj_create(cont);
|
||||||
lv_obj_set_size(divider, SPLIT_DIVIDER_W, lv_pct(100));
|
lv_obj_set_size(divider, SPLIT_DIVIDER_W, lv_pct(100));
|
||||||
lv_obj_remove_flag(divider, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(divider, false);
|
||||||
lv_obj_add_flag(divider, LV_OBJ_FLAG_CLICKABLE);
|
|
||||||
lv_obj_set_style_radius(divider, 0, 0);
|
lv_obj_set_style_radius(divider, 0, 0);
|
||||||
lv_obj_set_style_border_width(divider, 0, 0);
|
lv_obj_set_style_border_width(divider, 0, 0);
|
||||||
lv_obj_set_style_bg_color(divider, lv_palette_main(LV_PALETTE_GREY), 0);
|
lv_obj_set_style_bg_color(divider, lv_palette_main(LV_PALETTE_GREY), 0);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ void lv_example_split_vertical(void)
|
|||||||
{
|
{
|
||||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||||
lv_obj_set_size(cont, lv_pct(100), lv_pct(100));
|
lv_obj_set_size(cont, lv_pct(100), lv_pct(100));
|
||||||
lv_obj_remove_flag(cont, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(cont, false);
|
||||||
lv_obj_set_style_pad_all(cont, 0, 0);
|
lv_obj_set_style_pad_all(cont, 0, 0);
|
||||||
lv_obj_set_style_border_width(cont, 0, 0);
|
lv_obj_set_style_border_width(cont, 0, 0);
|
||||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN);
|
||||||
@@ -63,8 +63,7 @@ void lv_example_split_vertical(void)
|
|||||||
/* Divider: the draggable handle */
|
/* Divider: the draggable handle */
|
||||||
lv_obj_t * divider = lv_obj_create(cont);
|
lv_obj_t * divider = lv_obj_create(cont);
|
||||||
lv_obj_set_size(divider, lv_pct(100), SPLIT_DIVIDER_H);
|
lv_obj_set_size(divider, lv_pct(100), SPLIT_DIVIDER_H);
|
||||||
lv_obj_remove_flag(divider, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(divider, false);
|
||||||
lv_obj_add_flag(divider, LV_OBJ_FLAG_CLICKABLE);
|
|
||||||
lv_obj_set_style_radius(divider, 0, 0);
|
lv_obj_set_style_radius(divider, 0, 0);
|
||||||
lv_obj_set_style_border_width(divider, 0, 0);
|
lv_obj_set_style_border_width(divider, 0, 0);
|
||||||
lv_obj_set_style_bg_color(divider, lv_palette_main(LV_PALETTE_GREY), 0);
|
lv_obj_set_style_bg_color(divider, lv_palette_main(LV_PALETTE_GREY), 0);
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ static void btn_event_handler(lv_event_t * e)
|
|||||||
|
|
||||||
if(code == LV_EVENT_VALUE_CHANGED) {
|
if(code == LV_EVENT_VALUE_CHANGED) {
|
||||||
if(lv_obj_has_state(btn, LV_STATE_CHECKED))
|
if(lv_obj_has_state(btn, LV_STATE_CHECKED))
|
||||||
lv_obj_add_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(file_explorer, true);
|
||||||
else
|
else
|
||||||
lv_obj_remove_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(file_explorer, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ void lv_example_file_explorer_2(void)
|
|||||||
lv_obj_set_style_radius(btn, 2, 0);
|
lv_obj_set_style_radius(btn, 2, 0);
|
||||||
lv_obj_set_style_pad_all(btn, 4, 0);
|
lv_obj_set_style_pad_all(btn, 4, 0);
|
||||||
lv_obj_align(btn, LV_ALIGN_LEFT_MID, 0, 0);
|
lv_obj_align(btn, LV_ALIGN_LEFT_MID, 0, 0);
|
||||||
lv_obj_add_flag(btn, LV_OBJ_FLAG_CHECKABLE);
|
lv_obj_set_checkable(btn, true);
|
||||||
|
|
||||||
lv_obj_t * label = lv_label_create(btn);
|
lv_obj_t * label = lv_label_create(btn);
|
||||||
lv_label_set_text(label, LV_SYMBOL_LIST);
|
lv_label_set_text(label, LV_SYMBOL_LIST);
|
||||||
|
|||||||
@@ -93,10 +93,10 @@ void lv_example_gestures(void)
|
|||||||
|
|
||||||
lv_obj_set_style_bg_color(root_view, lv_color_hex(0xffffff), LV_PART_MAIN);
|
lv_obj_set_style_bg_color(root_view, lv_color_hex(0xffffff), LV_PART_MAIN);
|
||||||
label = lv_label_create(root_view);
|
label = lv_label_create(root_view);
|
||||||
lv_obj_remove_flag(root_view, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(root_view, false);
|
||||||
|
|
||||||
lv_label_set_text(label, "Zoom, rotate or move");
|
lv_label_set_text(label, "Zoom, rotate or move");
|
||||||
lv_obj_add_flag(label, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(label, true);
|
||||||
|
|
||||||
lv_style_init(&label_style);
|
lv_style_init(&label_style);
|
||||||
lv_style_set_bg_color(&label_style, lv_color_hex(RECT_COLOR));
|
lv_style_set_bg_color(&label_style, lv_color_hex(RECT_COLOR));
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void lv_example_gridnav_1(void)
|
|||||||
for(i = 0; i < 10; i++) {
|
for(i = 0; i < 10; i++) {
|
||||||
lv_obj_t * obj = lv_button_create(cont1);
|
lv_obj_t * obj = lv_button_create(cont1);
|
||||||
lv_obj_set_size(obj, 70, LV_SIZE_CONTENT);
|
lv_obj_set_size(obj, 70, LV_SIZE_CONTENT);
|
||||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_CHECKABLE);
|
lv_obj_set_checkable(obj, true);
|
||||||
lv_group_remove_obj(obj); /*Not needed, we use the gridnav instead*/
|
lv_group_remove_obj(obj); /*Not needed, we use the gridnav instead*/
|
||||||
|
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ static void ta_event_cb(lv_event_t * e)
|
|||||||
if(code == LV_EVENT_FOCUSED) {
|
if(code == LV_EVENT_FOCUSED) {
|
||||||
if(lv_indev_get_type(lv_indev_active()) != LV_INDEV_TYPE_KEYPAD) {
|
if(lv_indev_get_type(lv_indev_active()) != LV_INDEV_TYPE_KEYPAD) {
|
||||||
lv_keyboard_set_textarea(kb, ta);
|
lv_keyboard_set_textarea(kb, ta);
|
||||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(code == LV_EVENT_CANCEL) {
|
else if(code == LV_EVENT_CANCEL) {
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, true);
|
||||||
lv_obj_remove_state(ta, LV_STATE_FOCUSED);
|
lv_obj_remove_state(ta, LV_STATE_FOCUSED);
|
||||||
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ static void ta_event_cb(lv_event_t * e)
|
|||||||
if(code == LV_EVENT_FOCUSED) {
|
if(code == LV_EVENT_FOCUSED) {
|
||||||
if(lv_indev_get_type(lv_indev_active()) != LV_INDEV_TYPE_KEYPAD) {
|
if(lv_indev_get_type(lv_indev_active()) != LV_INDEV_TYPE_KEYPAD) {
|
||||||
lv_keyboard_set_textarea(kb, ta);
|
lv_keyboard_set_textarea(kb, ta);
|
||||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(code == LV_EVENT_READY) {
|
else if(code == LV_EVENT_READY) {
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_set_hidden(kb, true);
|
||||||
lv_obj_remove_state(ta, LV_STATE_FOCUSED);
|
lv_obj_remove_state(ta, LV_STATE_FOCUSED);
|
||||||
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
lv_indev_reset(NULL, ta); /*To forget the last clicked object to make it focusable again*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ static void ui_init(void)
|
|||||||
/*Create button which will be active only when logged in*/
|
/*Create button which will be active only when logged in*/
|
||||||
btn = lv_button_create(lv_screen_active());
|
btn = lv_button_create(lv_screen_active());
|
||||||
lv_obj_set_pos(btn, 10, 80);
|
lv_obj_set_pos(btn, 10, 80);
|
||||||
lv_obj_add_flag(btn, LV_OBJ_FLAG_CHECKABLE);
|
lv_obj_set_checkable(btn, true);
|
||||||
lv_obj_bind_state_if_not_eq(btn, &auth_state_subject, LV_STATE_DISABLED, LOGGED_IN);
|
lv_obj_bind_state_if_not_eq(btn, &auth_state_subject, LV_STATE_DISABLED, LOGGED_IN);
|
||||||
lv_obj_bind_checked(btn, &engine_subject);
|
lv_obj_bind_checked(btn, &engine_subject);
|
||||||
label = lv_label_create(btn);
|
label = lv_label_create(btn);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ static void set_btn_clicked_event_cb(lv_event_t * e)
|
|||||||
lv_obj_align(cont, LV_ALIGN_BOTTOM_MID, 0, 0);
|
lv_obj_align(cont, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||||
|
|
||||||
lv_obj_t * hour_roller = lv_roller_create(cont);
|
lv_obj_t * hour_roller = lv_roller_create(cont);
|
||||||
lv_obj_add_flag(hour_roller, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(hour_roller, true);
|
||||||
lv_subject_add_observer_obj(&format_subject, hour_roller_options_update, hour_roller, NULL);
|
lv_subject_add_observer_obj(&format_subject, hour_roller_options_update, hour_roller, NULL);
|
||||||
lv_roller_bind_value(hour_roller, &hour_subject);
|
lv_roller_bind_value(hour_roller, &hour_subject);
|
||||||
lv_obj_set_pos(hour_roller, 0, 0);
|
lv_obj_set_pos(hour_roller, 0, 0);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ void lv_example_observer_4(void)
|
|||||||
lv_subject_add_observer_obj(¤t_tab_subject, indicator_observer_cb, indicator, NULL);
|
lv_subject_add_observer_obj(¤t_tab_subject, indicator_observer_cb, indicator, NULL);
|
||||||
lv_obj_set_height(indicator, 10);
|
lv_obj_set_height(indicator, 10);
|
||||||
lv_obj_align(indicator, LV_ALIGN_BOTTOM_LEFT, 0, 0);
|
lv_obj_align(indicator, LV_ALIGN_BOTTOM_LEFT, 0, 0);
|
||||||
lv_obj_add_flag(indicator, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_set_ignore_layout(indicator, true);
|
||||||
|
|
||||||
/*Be sure the indicator has the correct size*/
|
/*Be sure the indicator has the correct size*/
|
||||||
lv_obj_update_layout(indicator);
|
lv_obj_update_layout(indicator);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ static void fw_update_win_observer_cb(lv_observer_t * observer, lv_subject_t * s
|
|||||||
lv_arc_bind_value(arc, &fw_download_percent_subject);
|
lv_arc_bind_value(arc, &fw_download_percent_subject);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
lv_obj_set_size(arc, 130, 130);
|
lv_obj_set_size(arc, 130, 130);
|
||||||
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(arc, false);
|
||||||
|
|
||||||
lv_obj_t * label = lv_label_create(cont);
|
lv_obj_t * label = lv_label_create(cont);
|
||||||
lv_label_bind_text(label, &fw_download_percent_subject, "%d %%");
|
lv_label_bind_text(label, &fw_download_percent_subject, "%d %%");
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void lv_example_snapshot_1(void)
|
|||||||
lv_obj_set_style_bg_color(img, lv_color_black(), 0);
|
lv_obj_set_style_bg_color(img, lv_color_black(), 0);
|
||||||
lv_obj_set_style_bg_opa(img, LV_OPA_COVER, 0);
|
lv_obj_set_style_bg_opa(img, LV_OPA_COVER, 0);
|
||||||
// lv_obj_set_style_transform_scale(img, 400, LV_STATE_PRESSED);
|
// lv_obj_set_style_transform_scale(img, 400, LV_STATE_PRESSED);
|
||||||
lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(img, true);
|
||||||
lv_obj_add_event_cb(img, event_cb, LV_EVENT_PRESSED, snapshot_obj);
|
lv_obj_add_event_cb(img, event_cb, LV_EVENT_PRESSED, snapshot_obj);
|
||||||
lv_obj_add_event_cb(img, event_cb, LV_EVENT_RELEASED, snapshot_obj);
|
lv_obj_add_event_cb(img, event_cb, LV_EVENT_RELEASED, snapshot_obj);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void lv_example_scroll_chain(void)
|
|||||||
lv_obj_set_size(container_2, lv_pct(100), 90);
|
lv_obj_set_size(container_2, lv_pct(100), 90);
|
||||||
lv_obj_set_flex_flow(container_2, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(container_2, LV_FLEX_FLOW_COLUMN);
|
||||||
lv_obj_set_style_pad_row(container_2, 6, 0);
|
lv_obj_set_style_pad_row(container_2, 6, 0);
|
||||||
lv_obj_set_flag(container_2, LV_OBJ_FLAG_SCROLL_CHAIN, false);
|
lv_obj_set_scroll_chain(container_2, false);
|
||||||
lv_obj_set_style_border_color(container_2, lv_color_hex(0x9429ff), 0);
|
lv_obj_set_style_border_color(container_2, lv_color_hex(0x9429ff), 0);
|
||||||
lv_obj_set_style_border_width(container_2, 2, 0);
|
lv_obj_set_style_border_width(container_2, 2, 0);
|
||||||
lv_obj_t * button_2 = lv_button_create(container_2);
|
lv_obj_t * button_2 = lv_button_create(container_2);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void lv_example_scroll_floating(void)
|
|||||||
lv_obj_t * button_7 = lv_button_create(container);
|
lv_obj_t * button_7 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_7, 44, 44);
|
lv_obj_set_size(button_7, 44, 44);
|
||||||
lv_obj_set_align(button_7, LV_ALIGN_BOTTOM_RIGHT);
|
lv_obj_set_align(button_7, LV_ALIGN_BOTTOM_RIGHT);
|
||||||
lv_obj_set_flag(button_7, LV_OBJ_FLAG_FLOATING, true);
|
lv_obj_set_floating(button_7, true);
|
||||||
lv_obj_set_style_bg_color(button_7, lv_color_hex(0x9429ff), 0);
|
lv_obj_set_style_bg_color(button_7, lv_color_hex(0x9429ff), 0);
|
||||||
lv_obj_add_style(button_7, &style_fab, 0);
|
lv_obj_add_style(button_7, &style_fab, 0);
|
||||||
lv_obj_t * label_7 = lv_label_create(button_7);
|
lv_obj_t * label_7 = lv_label_create(button_7);
|
||||||
|
|||||||
@@ -30,66 +30,66 @@ void lv_example_scroll_one(void)
|
|||||||
lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW);
|
lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW);
|
||||||
lv_obj_set_style_pad_column(container, 10, 0);
|
lv_obj_set_style_pad_column(container, 10, 0);
|
||||||
lv_obj_set_scroll_snap_x(container, LV_SCROLL_SNAP_CENTER);
|
lv_obj_set_scroll_snap_x(container, LV_SCROLL_SNAP_CENTER);
|
||||||
lv_obj_set_flag(container, LV_OBJ_FLAG_SCROLL_ONE, true);
|
lv_obj_set_scroll_one(container, true);
|
||||||
lv_obj_t * button_1 = lv_button_create(container);
|
lv_obj_t * button_1 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_1, 80, lv_pct(100));
|
lv_obj_set_size(button_1, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_1, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_1, false);
|
||||||
lv_obj_t * label_1 = lv_label_create(button_1);
|
lv_obj_t * label_1 = lv_label_create(button_1);
|
||||||
lv_obj_set_align(label_1, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_1, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_1, "Panel 1");
|
lv_label_set_text(label_1, "Panel 1");
|
||||||
|
|
||||||
lv_obj_t * button_2 = lv_button_create(container);
|
lv_obj_t * button_2 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_2, 80, lv_pct(100));
|
lv_obj_set_size(button_2, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_2, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_2, false);
|
||||||
lv_obj_t * label_2 = lv_label_create(button_2);
|
lv_obj_t * label_2 = lv_label_create(button_2);
|
||||||
lv_obj_set_align(label_2, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_2, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_2, "Panel 2");
|
lv_label_set_text(label_2, "Panel 2");
|
||||||
|
|
||||||
lv_obj_t * button_3 = lv_button_create(container);
|
lv_obj_t * button_3 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_3, 80, lv_pct(100));
|
lv_obj_set_size(button_3, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_3, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_3, false);
|
||||||
lv_obj_t * label_3 = lv_label_create(button_3);
|
lv_obj_t * label_3 = lv_label_create(button_3);
|
||||||
lv_obj_set_align(label_3, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_3, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_3, "Panel 3");
|
lv_label_set_text(label_3, "Panel 3");
|
||||||
|
|
||||||
lv_obj_t * button_4 = lv_button_create(container);
|
lv_obj_t * button_4 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_4, 80, lv_pct(100));
|
lv_obj_set_size(button_4, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_4, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_4, false);
|
||||||
lv_obj_t * label_4 = lv_label_create(button_4);
|
lv_obj_t * label_4 = lv_label_create(button_4);
|
||||||
lv_obj_set_align(label_4, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_4, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_4, "Panel 4");
|
lv_label_set_text(label_4, "Panel 4");
|
||||||
|
|
||||||
lv_obj_t * button_5 = lv_button_create(container);
|
lv_obj_t * button_5 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_5, 80, lv_pct(100));
|
lv_obj_set_size(button_5, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_5, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_5, false);
|
||||||
lv_obj_t * label_5 = lv_label_create(button_5);
|
lv_obj_t * label_5 = lv_label_create(button_5);
|
||||||
lv_obj_set_align(label_5, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_5, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_5, "Panel 5");
|
lv_label_set_text(label_5, "Panel 5");
|
||||||
|
|
||||||
lv_obj_t * button_6 = lv_button_create(container);
|
lv_obj_t * button_6 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_6, 80, lv_pct(100));
|
lv_obj_set_size(button_6, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_6, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_6, false);
|
||||||
lv_obj_t * label_6 = lv_label_create(button_6);
|
lv_obj_t * label_6 = lv_label_create(button_6);
|
||||||
lv_obj_set_align(label_6, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_6, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_6, "Panel 6");
|
lv_label_set_text(label_6, "Panel 6");
|
||||||
|
|
||||||
lv_obj_t * button_7 = lv_button_create(container);
|
lv_obj_t * button_7 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_7, 80, lv_pct(100));
|
lv_obj_set_size(button_7, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_7, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_7, false);
|
||||||
lv_obj_t * label_7 = lv_label_create(button_7);
|
lv_obj_t * label_7 = lv_label_create(button_7);
|
||||||
lv_obj_set_align(label_7, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_7, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_7, "Panel 7");
|
lv_label_set_text(label_7, "Panel 7");
|
||||||
|
|
||||||
lv_obj_t * button_8 = lv_button_create(container);
|
lv_obj_t * button_8 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_8, 80, lv_pct(100));
|
lv_obj_set_size(button_8, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_8, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_8, false);
|
||||||
lv_obj_t * label_8 = lv_label_create(button_8);
|
lv_obj_t * label_8 = lv_label_create(button_8);
|
||||||
lv_obj_set_align(label_8, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_8, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_8, "Panel 8");
|
lv_label_set_text(label_8, "Panel 8");
|
||||||
|
|
||||||
lv_obj_t * button_9 = lv_button_create(container);
|
lv_obj_t * button_9 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_9, 80, lv_pct(100));
|
lv_obj_set_size(button_9, 80, lv_pct(100));
|
||||||
lv_obj_set_flag(button_9, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_9, false);
|
||||||
lv_obj_t * label_9 = lv_label_create(button_9);
|
lv_obj_t * label_9 = lv_label_create(button_9);
|
||||||
lv_obj_set_align(label_9, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_9, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_9, "Panel 9");
|
lv_label_set_text(label_9, "Panel 9");
|
||||||
|
|||||||
@@ -3,14 +3,26 @@
|
|||||||
|
|
||||||
static lv_obj_t * list;
|
static lv_obj_t * list;
|
||||||
|
|
||||||
|
typedef void (*scroll_flag_setter_t)(lv_obj_t *, bool);
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
const char * title;
|
||||||
|
scroll_flag_setter_t setter;
|
||||||
|
} scroll_flags[] = {
|
||||||
|
{ "Scrollable", lv_obj_set_scrollable },
|
||||||
|
{ "Scroll chain", lv_obj_set_scroll_chain },
|
||||||
|
{ "Elastic scroll", lv_obj_set_scroll_elastic },
|
||||||
|
{ "Scroll momentum", lv_obj_set_scroll_momentum },
|
||||||
|
};
|
||||||
|
|
||||||
static void flag_switch_cb(lv_event_t * e)
|
static void flag_switch_cb(lv_event_t * e)
|
||||||
{
|
{
|
||||||
lv_obj_t * sw = lv_event_get_target_obj(e);
|
lv_obj_t * sw = lv_event_get_target_obj(e);
|
||||||
lv_obj_flag_t flag = (lv_obj_flag_t)(lv_uintptr_t)lv_event_get_user_data(e);
|
uint32_t idx = (uint32_t)(lv_uintptr_t)lv_event_get_user_data(e);
|
||||||
lv_obj_set_flag(list, flag, lv_obj_has_state(sw, LV_STATE_CHECKED));
|
scroll_flags[idx].setter(list, lv_obj_has_state(sw, LV_STATE_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_flag_row(lv_obj_t * parent, const char * title, lv_obj_flag_t flag)
|
static void add_flag_row(lv_obj_t * parent, uint32_t idx)
|
||||||
{
|
{
|
||||||
lv_obj_t * row = lv_obj_create(parent);
|
lv_obj_t * row = lv_obj_create(parent);
|
||||||
lv_obj_remove_style_all(row);
|
lv_obj_remove_style_all(row);
|
||||||
@@ -19,13 +31,13 @@ static void add_flag_row(lv_obj_t * parent, const char * title, lv_obj_flag_t fl
|
|||||||
lv_obj_set_flex_align(row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
lv_obj_set_flex_align(row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||||
|
|
||||||
lv_obj_t * label = lv_label_create(row);
|
lv_obj_t * label = lv_label_create(row);
|
||||||
lv_label_set_text(label, title);
|
lv_label_set_text(label, scroll_flags[idx].title);
|
||||||
lv_obj_set_flex_grow(label, 1);
|
lv_obj_set_flex_grow(label, 1);
|
||||||
|
|
||||||
lv_obj_t * sw = lv_switch_create(row);
|
lv_obj_t * sw = lv_switch_create(row);
|
||||||
lv_obj_add_state(sw, LV_STATE_CHECKED); /* flags start enabled */
|
lv_obj_add_state(sw, LV_STATE_CHECKED); /* flags start enabled */
|
||||||
lv_obj_add_flag(list, flag);
|
scroll_flags[idx].setter(list, true);
|
||||||
lv_obj_add_event_cb(sw, flag_switch_cb, LV_EVENT_VALUE_CHANGED, (void *)(lv_uintptr_t)flag);
|
lv_obj_add_event_cb(sw, flag_switch_cb, LV_EVENT_VALUE_CHANGED, (void *)(lv_uintptr_t)idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,9 +46,10 @@ static void add_flag_row(lv_obj_t * parent, const char * title, lv_obj_flag_t fl
|
|||||||
*
|
*
|
||||||
* These four flags change how a Widget reacts to scrolling but only show
|
* These four flags change how a Widget reacts to scrolling but only show
|
||||||
* their effect through interaction, so one example covers them together.
|
* their effect through interaction, so one example covers them together.
|
||||||
* A scrollable list sits above four switches; each switch adds or removes
|
* A scrollable list sits above four switches; each switch toggles the
|
||||||
* its flag on the list with `lv_obj_set_flag`, so the change can be felt
|
* corresponding behaviour on the list with its dedicated setter (e.g.
|
||||||
* immediately by dragging the list.
|
* `lv_obj_set_scrollable`), so the change can be felt immediately by dragging
|
||||||
|
* the list.
|
||||||
*/
|
*/
|
||||||
void lv_example_scroll_properties(void)
|
void lv_example_scroll_properties(void)
|
||||||
{
|
{
|
||||||
@@ -56,10 +69,9 @@ void lv_example_scroll_properties(void)
|
|||||||
lv_obj_center(label);
|
lv_obj_center(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_flag_row(panel, "Scrollable", LV_OBJ_FLAG_SCROLLABLE);
|
for(uint32_t i = 0; i < sizeof(scroll_flags) / sizeof(scroll_flags[0]); i++) {
|
||||||
add_flag_row(panel, "Scroll chain", LV_OBJ_FLAG_SCROLL_CHAIN);
|
add_flag_row(panel, i);
|
||||||
add_flag_row(panel, "Elastic scroll", LV_OBJ_FLAG_SCROLL_ELASTIC);
|
}
|
||||||
add_flag_row(panel, "Scroll momentum", LV_OBJ_FLAG_SCROLL_MOMENTUM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void lv_example_scroll_scrollable(void)
|
|||||||
lv_obj_set_size(container_3, 130, lv_pct(100));
|
lv_obj_set_size(container_3, 130, lv_pct(100));
|
||||||
lv_obj_set_flex_flow(container_3, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(container_3, LV_FLEX_FLOW_COLUMN);
|
||||||
lv_obj_set_style_pad_row(container_3, 8, 0);
|
lv_obj_set_style_pad_row(container_3, 8, 0);
|
||||||
lv_obj_set_flag(container_3, LV_OBJ_FLAG_SCROLLABLE, false);
|
lv_obj_set_scrollable(container_3, false);
|
||||||
lv_obj_set_style_border_color(container_3, lv_color_hex(0x9429ff), 0);
|
lv_obj_set_style_border_color(container_3, lv_color_hex(0x9429ff), 0);
|
||||||
lv_obj_set_style_border_width(container_3, 2, 0);
|
lv_obj_set_style_border_width(container_3, 2, 0);
|
||||||
lv_obj_t * label_6 = lv_label_create(container_3);
|
lv_obj_t * label_6 = lv_label_create(container_3);
|
||||||
|
|||||||
@@ -31,44 +31,44 @@ void lv_example_scroll_snap(void)
|
|||||||
lv_obj_set_scroll_snap_x(container, LV_SCROLL_SNAP_CENTER);
|
lv_obj_set_scroll_snap_x(container, LV_SCROLL_SNAP_CENTER);
|
||||||
lv_obj_t * button_1 = lv_button_create(container);
|
lv_obj_t * button_1 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_1, 120, lv_pct(100));
|
lv_obj_set_size(button_1, 120, lv_pct(100));
|
||||||
lv_obj_set_flag(button_1, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_1, false);
|
||||||
lv_obj_t * label_1 = lv_label_create(button_1);
|
lv_obj_t * label_1 = lv_label_create(button_1);
|
||||||
lv_obj_set_align(label_1, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_1, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_1, "Panel 1");
|
lv_label_set_text(label_1, "Panel 1");
|
||||||
|
|
||||||
lv_obj_t * button_2 = lv_button_create(container);
|
lv_obj_t * button_2 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_2, 120, lv_pct(100));
|
lv_obj_set_size(button_2, 120, lv_pct(100));
|
||||||
lv_obj_set_flag(button_2, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_2, false);
|
||||||
lv_obj_t * label_2 = lv_label_create(button_2);
|
lv_obj_t * label_2 = lv_label_create(button_2);
|
||||||
lv_obj_set_align(label_2, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_2, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_2, "Panel 2");
|
lv_label_set_text(label_2, "Panel 2");
|
||||||
|
|
||||||
lv_obj_t * button_3 = lv_button_create(container);
|
lv_obj_t * button_3 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_3, 120, lv_pct(100));
|
lv_obj_set_size(button_3, 120, lv_pct(100));
|
||||||
lv_obj_set_flag(button_3, LV_OBJ_FLAG_SNAPPABLE, false);
|
lv_obj_set_snappable(button_3, false);
|
||||||
lv_obj_set_style_bg_color(button_3, lv_color_hex(0x9429ff), 0);
|
lv_obj_set_style_bg_color(button_3, lv_color_hex(0x9429ff), 0);
|
||||||
lv_obj_set_flag(button_3, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_3, false);
|
||||||
lv_obj_t * label_3 = lv_label_create(button_3);
|
lv_obj_t * label_3 = lv_label_create(button_3);
|
||||||
lv_obj_set_align(label_3, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_3, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_3, "No snap");
|
lv_label_set_text(label_3, "No snap");
|
||||||
|
|
||||||
lv_obj_t * button_4 = lv_button_create(container);
|
lv_obj_t * button_4 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_4, 120, lv_pct(100));
|
lv_obj_set_size(button_4, 120, lv_pct(100));
|
||||||
lv_obj_set_flag(button_4, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_4, false);
|
||||||
lv_obj_t * label_4 = lv_label_create(button_4);
|
lv_obj_t * label_4 = lv_label_create(button_4);
|
||||||
lv_obj_set_align(label_4, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_4, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_4, "Panel 4");
|
lv_label_set_text(label_4, "Panel 4");
|
||||||
|
|
||||||
lv_obj_t * button_5 = lv_button_create(container);
|
lv_obj_t * button_5 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_5, 120, lv_pct(100));
|
lv_obj_set_size(button_5, 120, lv_pct(100));
|
||||||
lv_obj_set_flag(button_5, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_5, false);
|
||||||
lv_obj_t * label_5 = lv_label_create(button_5);
|
lv_obj_t * label_5 = lv_label_create(button_5);
|
||||||
lv_obj_set_align(label_5, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_5, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_5, "Panel 5");
|
lv_label_set_text(label_5, "Panel 5");
|
||||||
|
|
||||||
lv_obj_t * button_6 = lv_button_create(container);
|
lv_obj_t * button_6 = lv_button_create(container);
|
||||||
lv_obj_set_size(button_6, 120, lv_pct(100));
|
lv_obj_set_size(button_6, 120, lv_pct(100));
|
||||||
lv_obj_set_flag(button_6, LV_OBJ_FLAG_SCROLL_ON_FOCUS, false);
|
lv_obj_set_scroll_on_focus(button_6, false);
|
||||||
lv_obj_t * label_6 = lv_label_create(button_6);
|
lv_obj_t * label_6 = lv_label_create(button_6);
|
||||||
lv_obj_set_align(label_6, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_6, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(label_6, "Panel 6");
|
lv_label_set_text(label_6, "Panel 6");
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ void lv_example_style_transform_card(void)
|
|||||||
lv_arc_set_range(arc, 0, 270);
|
lv_arc_set_range(arc, 0, 270);
|
||||||
lv_arc_set_value(arc, 225);
|
lv_arc_set_value(arc, 225);
|
||||||
lv_obj_add_event_cb(arc, arc_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
lv_obj_add_event_cb(arc, arc_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||||
lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST);
|
lv_obj_set_adv_hittest(arc, true);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
|
|
||||||
lv_obj_t * slider = lv_slider_create(lv_screen_active());
|
lv_obj_t * slider = lv_slider_create(lv_screen_active());
|
||||||
@@ -126,9 +126,9 @@ static lv_obj_t * card_create(void)
|
|||||||
{
|
{
|
||||||
lv_obj_t * card = lv_obj_create(lv_screen_active());
|
lv_obj_t * card = lv_obj_create(lv_screen_active());
|
||||||
lv_obj_add_style(card, &style_card, 0);
|
lv_obj_add_style(card, &style_card, 0);
|
||||||
lv_obj_remove_flag(card, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_set_clickable(card, false);
|
||||||
lv_obj_remove_flag(card, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_set_scrollable(card, false);
|
||||||
lv_obj_remove_flag(card, LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
|
lv_obj_set_scroll_chain_hor(card, false);
|
||||||
|
|
||||||
lv_obj_t * avatar = lv_image_create(card);
|
lv_obj_t * avatar = lv_image_create(card);
|
||||||
lv_image_set_src(avatar, &img_transform_avatar_15);
|
lv_image_set_src(avatar, &img_transform_avatar_15);
|
||||||
@@ -141,7 +141,7 @@ static lv_obj_t * card_create(void)
|
|||||||
lv_obj_set_style_text_font(name, LV_FONT_DEFAULT, 0);
|
lv_obj_set_style_text_font(name, LV_FONT_DEFAULT, 0);
|
||||||
|
|
||||||
lv_obj_t * btn = lv_button_create(card);
|
lv_obj_t * btn = lv_button_create(card);
|
||||||
lv_obj_remove_flag(card, LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
|
lv_obj_set_scroll_chain_hor(card, false);
|
||||||
lv_obj_set_grid_cell(btn, LV_GRID_ALIGN_START, 2, 1, LV_GRID_ALIGN_CENTER, 3, 1);
|
lv_obj_set_grid_cell(btn, LV_GRID_ALIGN_START, 2, 1, LV_GRID_ALIGN_CENTER, 3, 1);
|
||||||
lv_obj_add_style(btn, &style_btn, 0);
|
lv_obj_add_style(btn, &style_btn, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void lv_example_arc_bind_value(void)
|
|||||||
lv_obj_t * arc = lv_arc_create(screen);
|
lv_obj_t * arc = lv_arc_create(screen);
|
||||||
lv_obj_set_size(arc, 160, 160);
|
lv_obj_set_size(arc, 160, 160);
|
||||||
lv_arc_bind_value(arc, &subject_value);
|
lv_arc_bind_value(arc, &subject_value);
|
||||||
lv_obj_set_flag(arc, LV_OBJ_FLAG_CLICKABLE, false);
|
lv_obj_set_clickable(arc, false);
|
||||||
lv_obj_set_style_bg_opa(arc, (255 * 0 / 100), LV_PART_KNOB);
|
lv_obj_set_style_bg_opa(arc, (255 * 0 / 100), LV_PART_KNOB);
|
||||||
lv_obj_t * lv_label_0 = lv_label_create(arc);
|
lv_obj_t * lv_label_0 = lv_label_create(arc);
|
||||||
lv_obj_set_align(lv_label_0, LV_ALIGN_CENTER);
|
lv_obj_set_align(lv_label_0, LV_ALIGN_CENTER);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void lv_example_arc_pie_chart(void)
|
|||||||
/* 5 slices with uneven sweeps so the colours look like a real data breakdown.
|
/* 5 slices with uneven sweeps so the colours look like a real data breakdown.
|
||||||
Angles measured clockwise from 3 o'clock; the seam between E and A is at 12 o'clock (270°). */
|
Angles measured clockwise from 3 o'clock; the seam between E and A is at 12 o'clock (270°). */
|
||||||
lv_obj_t * arc_1 = lv_arc_create(screen);
|
lv_obj_t * arc_1 = lv_arc_create(screen);
|
||||||
lv_obj_set_flag(arc_1, LV_OBJ_FLAG_CLICKABLE, false);
|
lv_obj_set_clickable(arc_1, false);
|
||||||
lv_arc_set_bg_start_angle(arc_1, 270);
|
lv_arc_set_bg_start_angle(arc_1, 270);
|
||||||
lv_arc_set_bg_end_angle(arc_1, 325);
|
lv_arc_set_bg_end_angle(arc_1, 325);
|
||||||
lv_obj_set_style_arc_color(arc_1, lv_color_hex(0xef4444), LV_PART_MAIN);
|
lv_obj_set_style_arc_color(arc_1, lv_color_hex(0xef4444), LV_PART_MAIN);
|
||||||
@@ -63,7 +63,7 @@ void lv_example_arc_pie_chart(void)
|
|||||||
lv_obj_add_style(arc_1, &style_pie_knob, LV_PART_KNOB);
|
lv_obj_add_style(arc_1, &style_pie_knob, LV_PART_KNOB);
|
||||||
|
|
||||||
lv_obj_t * arc_2 = lv_arc_create(screen);
|
lv_obj_t * arc_2 = lv_arc_create(screen);
|
||||||
lv_obj_set_flag(arc_2, LV_OBJ_FLAG_CLICKABLE, false);
|
lv_obj_set_clickable(arc_2, false);
|
||||||
lv_arc_set_bg_start_angle(arc_2, 325);
|
lv_arc_set_bg_start_angle(arc_2, 325);
|
||||||
lv_arc_set_bg_end_angle(arc_2, 38);
|
lv_arc_set_bg_end_angle(arc_2, 38);
|
||||||
lv_obj_set_style_arc_color(arc_2, lv_color_hex(0xf59e0b), LV_PART_MAIN);
|
lv_obj_set_style_arc_color(arc_2, lv_color_hex(0xf59e0b), LV_PART_MAIN);
|
||||||
@@ -72,7 +72,7 @@ void lv_example_arc_pie_chart(void)
|
|||||||
lv_obj_add_style(arc_2, &style_pie_knob, LV_PART_KNOB);
|
lv_obj_add_style(arc_2, &style_pie_knob, LV_PART_KNOB);
|
||||||
|
|
||||||
lv_obj_t * arc_3 = lv_arc_create(screen);
|
lv_obj_t * arc_3 = lv_arc_create(screen);
|
||||||
lv_obj_set_flag(arc_3, LV_OBJ_FLAG_CLICKABLE, false);
|
lv_obj_set_clickable(arc_3, false);
|
||||||
lv_arc_set_bg_start_angle(arc_3, 38);
|
lv_arc_set_bg_start_angle(arc_3, 38);
|
||||||
lv_arc_set_bg_end_angle(arc_3, 162);
|
lv_arc_set_bg_end_angle(arc_3, 162);
|
||||||
lv_obj_set_style_arc_color(arc_3, lv_color_hex(0x22c55e), LV_PART_MAIN);
|
lv_obj_set_style_arc_color(arc_3, lv_color_hex(0x22c55e), LV_PART_MAIN);
|
||||||
@@ -81,7 +81,7 @@ void lv_example_arc_pie_chart(void)
|
|||||||
lv_obj_add_style(arc_3, &style_pie_knob, LV_PART_KNOB);
|
lv_obj_add_style(arc_3, &style_pie_knob, LV_PART_KNOB);
|
||||||
|
|
||||||
lv_obj_t * arc_4 = lv_arc_create(screen);
|
lv_obj_t * arc_4 = lv_arc_create(screen);
|
||||||
lv_obj_set_flag(arc_4, LV_OBJ_FLAG_CLICKABLE, false);
|
lv_obj_set_clickable(arc_4, false);
|
||||||
lv_arc_set_bg_start_angle(arc_4, 162);
|
lv_arc_set_bg_start_angle(arc_4, 162);
|
||||||
lv_arc_set_bg_end_angle(arc_4, 190);
|
lv_arc_set_bg_end_angle(arc_4, 190);
|
||||||
lv_obj_set_style_arc_color(arc_4, lv_color_hex(0x3b82f6), LV_PART_MAIN);
|
lv_obj_set_style_arc_color(arc_4, lv_color_hex(0x3b82f6), LV_PART_MAIN);
|
||||||
@@ -90,7 +90,7 @@ void lv_example_arc_pie_chart(void)
|
|||||||
lv_obj_add_style(arc_4, &style_pie_knob, LV_PART_KNOB);
|
lv_obj_add_style(arc_4, &style_pie_knob, LV_PART_KNOB);
|
||||||
|
|
||||||
lv_obj_t * arc_5 = lv_arc_create(screen);
|
lv_obj_t * arc_5 = lv_arc_create(screen);
|
||||||
lv_obj_set_flag(arc_5, LV_OBJ_FLAG_CLICKABLE, false);
|
lv_obj_set_clickable(arc_5, false);
|
||||||
lv_arc_set_bg_start_angle(arc_5, 190);
|
lv_arc_set_bg_start_angle(arc_5, 190);
|
||||||
lv_arc_set_bg_end_angle(arc_5, 270);
|
lv_arc_set_bg_end_angle(arc_5, 270);
|
||||||
lv_obj_set_style_arc_color(arc_5, lv_color_hex(0xa855f7), LV_PART_MAIN);
|
lv_obj_set_style_arc_color(arc_5, lv_color_hex(0xa855f7), LV_PART_MAIN);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void lv_example_button_states(void)
|
|||||||
/* Checkable, starts checked */
|
/* Checkable, starts checked */
|
||||||
lv_obj_t * button_2 = lv_button_create(screen);
|
lv_obj_t * button_2 = lv_button_create(screen);
|
||||||
lv_obj_set_size(button_2, 160, 40);
|
lv_obj_set_size(button_2, 160, 40);
|
||||||
lv_obj_set_flag(button_2, LV_OBJ_FLAG_CHECKABLE, true);
|
lv_obj_set_checkable(button_2, true);
|
||||||
lv_obj_set_state(button_2, LV_STATE_CHECKED, true);
|
lv_obj_set_state(button_2, LV_STATE_CHECKED, true);
|
||||||
lv_obj_t * label_2 = lv_label_create(button_2);
|
lv_obj_t * label_2 = lv_label_create(button_2);
|
||||||
lv_obj_set_align(label_2, LV_ALIGN_CENTER);
|
lv_obj_set_align(label_2, LV_ALIGN_CENTER);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void lv_example_button_styling(void)
|
|||||||
/* Checkable button: swaps to the checked style on toggle */
|
/* Checkable button: swaps to the checked style on toggle */
|
||||||
lv_obj_t * button_2 = lv_button_create(screen);
|
lv_obj_t * button_2 = lv_button_create(screen);
|
||||||
lv_obj_set_size(button_2, 180, 48);
|
lv_obj_set_size(button_2, 180, 48);
|
||||||
lv_obj_set_flag(button_2, LV_OBJ_FLAG_CHECKABLE, true);
|
lv_obj_set_checkable(button_2, true);
|
||||||
lv_obj_add_style(button_2, &style_button, 0);
|
lv_obj_add_style(button_2, &style_button, 0);
|
||||||
lv_obj_add_style(button_2, &style_button_pressed, LV_STATE_PRESSED);
|
lv_obj_add_style(button_2, &style_button_pressed, LV_STATE_PRESSED);
|
||||||
lv_obj_add_style(button_2, &style_button_checked, LV_STATE_CHECKED);
|
lv_obj_add_style(button_2, &style_button_checked, LV_STATE_CHECKED);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void lv_example_chart_area_gradient(void)
|
|||||||
lv_chart_set_div_line_count(chart, 5, 7);
|
lv_chart_set_div_line_count(chart, 5, 7);
|
||||||
|
|
||||||
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||||
lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_send_draw_task_events(chart, true);
|
||||||
|
|
||||||
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ void lv_example_chart_recolor_bars(void)
|
|||||||
|
|
||||||
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_color_hex(0xff0000), LV_CHART_AXIS_PRIMARY_Y);
|
lv_chart_series_t * ser = lv_chart_add_series(chart, lv_color_hex(0xff0000), LV_CHART_AXIS_PRIMARY_Y);
|
||||||
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||||
lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_send_draw_task_events(chart, true);
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i = 0; i < 24; i++) {
|
for(i = 0; i < 24; i++) {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void lv_example_chart_scatter(void)
|
|||||||
lv_obj_set_size(chart, 200, 150);
|
lv_obj_set_size(chart, 200, 150);
|
||||||
lv_obj_align(chart, LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(chart, LV_ALIGN_CENTER, 0, 0);
|
||||||
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||||
lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_send_draw_task_events(chart, true);
|
||||||
lv_obj_set_style_line_width(chart, 0, LV_PART_ITEMS); /*Remove the lines*/
|
lv_obj_set_style_line_width(chart, 0, LV_PART_ITEMS); /*Remove the lines*/
|
||||||
|
|
||||||
lv_chart_set_type(chart, LV_CHART_TYPE_SCATTER);
|
lv_chart_set_type(chart, LV_CHART_TYPE_SCATTER);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void lv_example_keyboard_custom_draw(void)
|
|||||||
{
|
{
|
||||||
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
|
||||||
lv_obj_add_event_cb(kb, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
lv_obj_add_event_cb(kb, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
|
lv_obj_set_send_draw_task_events(kb, true);
|
||||||
lv_obj_center(kb);
|
lv_obj_center(kb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void lv_example_menu_floating_button(void)
|
|||||||
/*Create floating btn*/
|
/*Create floating btn*/
|
||||||
lv_obj_t * float_btn = lv_button_create(lv_screen_active());
|
lv_obj_t * float_btn = lv_button_create(lv_screen_active());
|
||||||
lv_obj_set_size(float_btn, 50, 50);
|
lv_obj_set_size(float_btn, 50, 50);
|
||||||
lv_obj_add_flag(float_btn, LV_OBJ_FLAG_FLOATING);
|
lv_obj_set_floating(float_btn, true);
|
||||||
lv_obj_align(float_btn, LV_ALIGN_BOTTOM_RIGHT, -10, -10);
|
lv_obj_align(float_btn, LV_ALIGN_BOTTOM_RIGHT, -10, -10);
|
||||||
lv_obj_add_event_cb(float_btn, float_button_event_cb, LV_EVENT_CLICKED, menu);
|
lv_obj_add_event_cb(float_btn, float_button_event_cb, LV_EVENT_CLICKED, menu);
|
||||||
lv_obj_set_style_radius(float_btn, LV_RADIUS_CIRCLE, 0);
|
lv_obj_set_style_radius(float_btn, LV_RADIUS_CIRCLE, 0);
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ static lv_obj_t * create_text(lv_obj_t * parent, const char * icon, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(builder_variant == LV_MENU_ITEM_BUILDER_VARIANT_2 && icon && txt) {
|
if(builder_variant == LV_MENU_ITEM_BUILDER_VARIANT_2 && icon && txt) {
|
||||||
lv_obj_add_flag(img, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(img, true);
|
||||||
lv_obj_swap(img, label);
|
lv_obj_swap(img, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ static lv_obj_t * create_slider(lv_obj_t * parent, const char * icon, const char
|
|||||||
lv_slider_set_value(slider, val, LV_ANIM_OFF);
|
lv_slider_set_value(slider, val, LV_ANIM_OFF);
|
||||||
|
|
||||||
if(icon == NULL) {
|
if(icon == NULL) {
|
||||||
lv_obj_add_flag(slider, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_set_flex_in_new_track(slider, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user