refactor: scr -> screen, act->active, del->delete, remove in obj_clear_flag/state

This commit is contained in:
Gabor Kiss-Vamosi
2023-10-12 20:37:27 +02:00
parent 0ff2d1c2e4
commit 9ec5417dd3
468 changed files with 1330 additions and 1288 deletions

View File

@@ -749,7 +749,7 @@ static void benchmark_init(void)
lv_timer_set_period(anim_timer, 2);
}
lv_obj_t * scr = lv_scr_act();
lv_obj_t * scr = lv_screen_active();
lv_obj_remove_style_all(scr);
lv_obj_set_style_bg_opa(scr, LV_OPA_COVER, 0);
lv_obj_set_style_bg_color(scr, lv_palette_lighten(LV_PALETTE_GREY, 4), 0);
@@ -859,7 +859,7 @@ static void next_scene_timer_cb(lv_timer_t * timer)
lv_result_t res = load_next_scene();
if(res == LV_RESULT_INVALID) {
lv_timer_del(timer);
lv_timer_delete(timer);
generate_report();
}
}
@@ -882,7 +882,7 @@ static void single_scene_finsih_timer_cb(lv_timer_t * timer)
benchmark_event_remove();
show_scene_report();
lv_obj_clean(scene_bg);
lv_obj_invalidate(lv_scr_act());
lv_obj_invalidate(lv_screen_active());
}
static void dummy_flush_cb(lv_display_t * drv, const lv_area_t * area, uint8_t * pxmap)
@@ -987,19 +987,19 @@ static void generate_report(void)
uint32_t opa_speed_pct = (fps_opa_unweighted * 100) / fps_normal_unweighted;
lv_obj_clean(lv_scr_act());
lv_obj_clean(lv_screen_active());
scene_bg = NULL;
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
title = lv_label_create(lv_scr_act());
title = lv_label_create(lv_screen_active());
lv_label_set_text_fmt(title, "Weighted FPS: %"LV_PRIu32, fps_weighted);
subtitle = lv_label_create(lv_scr_act());
subtitle = lv_label_create(lv_screen_active());
lv_label_set_text_fmt(subtitle, "Opa. speed: %"LV_PRIu32"%%", opa_speed_pct);
lv_coord_t w = lv_obj_get_content_width(lv_scr_act());
lv_obj_t * table = lv_table_create(lv_scr_act());
lv_coord_t w = lv_obj_get_content_width(lv_screen_active());
lv_obj_t * table = lv_table_create(lv_screen_active());
// lv_obj_clean_style_list(table, LV_PART_MAIN);
lv_table_set_col_cnt(table, 2);

View File

@@ -85,7 +85,7 @@ static void ctrl_pad_btn_remove_event_handler(lv_event_t * e)
lv_obj_clean(ui->root);
}
else {
lv_obj_del(ui->obj_cur);
lv_obj_delete(ui->obj_cur);
ui->obj_cur = NULL;
}
}
@@ -114,7 +114,7 @@ void ctrl_pad_obj_update(lv_obj_t * obj, view_t * ui)
lv_obj_add_state(checkbox, LV_STATE_CHECKED);
}
else {
lv_obj_clear_state(checkbox, LV_STATE_CHECKED);
lv_obj_remove_state(checkbox, LV_STATE_CHECKED);
}
}
@@ -144,7 +144,8 @@ static void ctrl_pad_checkbox_event_handler(lv_event_t * e)
view_t * ui = lv_event_get_user_data(e);
if(ui->obj_cur) {
bool checked = lv_obj_has_state(lv_event_get_target(e), LV_STATE_CHECKED);
checked ? lv_obj_add_flag(ui->obj_cur, LV_OBJ_FLAG_SCROLLABLE) : lv_obj_clear_flag(ui->obj_cur, LV_OBJ_FLAG_SCROLLABLE);
checked ? lv_obj_add_flag(ui->obj_cur, LV_OBJ_FLAG_SCROLLABLE) : lv_obj_remove_flag(ui->obj_cur,
LV_OBJ_FLAG_SCROLLABLE);
}
}

View File

@@ -40,7 +40,7 @@ static view_t view;
void lv_demo_flex_layout(void)
{
view_create(lv_scr_act(), &view);
view_create(lv_screen_active(), &view);
ctrl_pad_attach(&view);
}

View File

@@ -69,7 +69,7 @@ void view_create(lv_obj_t * par, view_t * ui)
lv_obj_set_style_shadow_color(obj, lv_color_hex3(0xaaa), 0);
lv_obj_set_style_shadow_width(obj, 20, 0);
lv_obj_set_style_shadow_ofs_y(obj, 2, 0);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(
obj,

View File

@@ -69,7 +69,7 @@ static void obj_child_node_event_handler(lv_event_t * e)
lv_obj_t * obj = lv_event_get_target(e);
if(ui->obj_cur) {
lv_obj_clear_state(ui->obj_cur, LV_STATE_CHECKED);
lv_obj_remove_state(ui->obj_cur, LV_STATE_CHECKED);
}
lv_obj_add_state(obj, LV_STATE_CHECKED);

View File

@@ -66,7 +66,7 @@ void lv_demo_keypad_encoder(void)
}
}
tv = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, LV_DPI_DEF / 3);
tv = lv_tabview_create(lv_screen_active(), LV_DIR_TOP, LV_DPI_DEF / 3);
t1 = lv_tabview_add_tab(tv, "Selectors");
t2 = lv_tabview_add_tab(tv, "Text input");
@@ -153,7 +153,7 @@ static void text_input_create(lv_obj_t * parent)
lv_textarea_set_one_line(ta2, true);
lv_textarea_set_placeholder_text(ta2, "Type something");
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_event(ta1, ta_event_cb, LV_EVENT_ALL, kb);
@@ -205,7 +205,7 @@ static void ta_event_cb(lv_event_t * e)
if(code == LV_EVENT_CLICKED && indev_type == LV_INDEV_TYPE_ENCODER) {
lv_keyboard_set_textarea(kb, ta);
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_group_focus_obj(kb);
lv_group_set_editing(lv_obj_get_group(kb), kb);
lv_obj_set_height(tv, LV_VER_RES / 2);

View File

@@ -17,7 +17,7 @@ class KeyboardEncoder:
cur_drv = cur_drv.get_next()
self.tv = lv.tabview(lv.scr_act(), lv.DIR.TOP, lv.DPI_DEF // 3)
self.tv = lv.tabview(lv.screen_active(), lv.DIR.TOP, lv.DPI_DEF // 3)
self.t1 = self.tv.add_tab("Selectors")
self.t2 = self.tv.add_tab("Text input")
@@ -93,7 +93,7 @@ class KeyboardEncoder:
ta2.set_one_line(True)
ta2.set_placeholder_text("Type something")
self.kb = lv.keyboard(lv.scr_act())
self.kb = lv.keyboard(lv.screen_active())
self.kb.add_flag(lv.obj.FLAG.HIDDEN)
ta1.add_event(self.ta_event_cb, lv.EVENT.ALL, None)
@@ -141,7 +141,7 @@ class KeyboardEncoder:
if code == lv.EVENT.CLICKED and indev_type == lv.INDEV_TYPE.ENCODER:
self.kb.set_textarea(ta)
self.kb.clear_flag(lv.obj.FLAG.HIDDEN)
self.kb.remove_flag(lv.obj.FLAG.HIDDEN)
self.kb.group_focus_obj()
self.kb.get_group().set_editing()
self.tv.set_height(lv.pct(50))

View File

@@ -158,11 +158,11 @@ void lv_demo_multilang(void)
emoji_font = lv_imgfont_create(20, get_imgfont_path, NULL);
font_multilang_small.fallback = emoji_font;
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_pad_row(lv_scr_act(), 0, 0);
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0xececec), 0);
lv_obj_set_style_bg_grad_color(lv_scr_act(), lv_color_hex(0xf9f9f9), 0);
lv_obj_set_style_bg_grad_dir(lv_scr_act(), LV_GRAD_DIR_HOR, 0);
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_pad_row(lv_screen_active(), 0, 0);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0xececec), 0);
lv_obj_set_style_bg_grad_color(lv_screen_active(), lv_color_hex(0xf9f9f9), 0);
lv_obj_set_style_bg_grad_dir(lv_screen_active(), LV_GRAD_DIR_HOR, 0);
static const lv_coord_t grid_cols[] = {LV_GRID_CONTENT, 4, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
static const lv_coord_t grid_rows[] = {LV_GRID_CONTENT, -10, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
@@ -224,7 +224,7 @@ void lv_demo_multilang(void)
uint32_t i;
for(i = 0; card_info[i].image; i++) {
card_create(lv_scr_act(), &card_info[i]);
card_create(lv_screen_active(), &card_info[i]);
}
lv_timer_create(inactive_timer_cb, 1000, NULL);
@@ -239,12 +239,12 @@ static void inactive_timer_cb(lv_timer_t * t)
LV_UNUSED(t);
static bool scrolled = false;
lv_obj_t * cont = lv_obj_get_child(lv_scr_act(), 0);
lv_obj_t * cont = lv_obj_get_child(lv_screen_active(), 0);
if(cont == NULL) return;
if(scrolled) {
lv_obj_scroll_by(cont, -100, 0, LV_ANIM_ON);
lv_obj_clear_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
scrolled = false;
return;
}
@@ -275,14 +275,14 @@ static void scroll_event_cb(lv_event_t * e)
if(scroll_x < w / 2) {
lv_obj_set_scroll_snap_x(cont, LV_SCROLL_SNAP_NONE);
lv_obj_clear_flag(cont, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(cont, LV_OBJ_FLAG_CLICKABLE);
lv_indev_wait_release(indev);
lv_obj_scroll_to_view(lv_obj_get_child(cont, 0), LV_ANIM_ON);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_exec_cb(&a, shrink_anim_cb);
lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb);
lv_anim_set_ready_cb(&a, lv_obj_delete_anim_ready_cb);
lv_anim_set_values(&a, 255, 0);
lv_anim_set_time(&a, 400);
lv_anim_set_var(&a, cont);
@@ -296,14 +296,14 @@ static void card_create(lv_obj_t * parent, card_info_t * info)
lv_obj_add_style(cont, &style_card_cont, 0);
lv_obj_set_scroll_snap_x(cont, LV_SCROLL_SNAP_CENTER);
lv_obj_add_event(cont, scroll_event_cb, LV_EVENT_RELEASED, NULL);
lv_obj_clear_flag(cont, LV_OBJ_FLAG_SCROLL_ELASTIC);
lv_obj_remove_flag(cont, LV_OBJ_FLAG_SCROLL_ELASTIC);
lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF);
lv_obj_t * remove = lv_obj_create(cont);
lv_obj_add_style(remove, &style_hide, 0);
lv_obj_clear_flag(remove, LV_OBJ_FLAG_SNAPPABLE);
lv_obj_remove_flag(remove, LV_OBJ_FLAG_SNAPPABLE);
lv_obj_add_flag(remove, LV_OBJ_FLAG_FLOATING);
lv_obj_clear_flag(remove, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(remove, LV_OBJ_FLAG_CLICKABLE);
lv_obj_t * hide_label = lv_label_create(remove);
lv_label_set_text(hide_label, "Hide");
@@ -314,7 +314,7 @@ static void card_create(lv_obj_t * parent, card_info_t * info)
lv_obj_t * card = lv_obj_create(cont);
lv_obj_add_style(card, &style_card, 0);
lv_obj_clear_flag(card, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
lv_obj_remove_flag(card, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
lv_obj_t * avatar = lv_image_create(card);
lv_image_set_src(avatar, info->image);
@@ -333,7 +333,7 @@ static void card_create(lv_obj_t * parent, card_info_t * info)
lv_obj_set_style_text_line_space(description, -3, 0);
lv_obj_t * btn = lv_button_create(card);
lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
lv_obj_remove_flag(card, LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
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);

View File

@@ -113,10 +113,10 @@ static const uint32_t time_list[] = {
void lv_demo_music(void)
{
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x343247), 0);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x343247), 0);
list = _lv_demo_music_list_create(lv_scr_act());
ctrl = _lv_demo_music_main_create(lv_scr_act());
list = _lv_demo_music_list_create(lv_screen_active());
ctrl = _lv_demo_music_main_create(lv_screen_active());
#if LV_DEMO_MUSIC_AUTO_PLAY
lv_timer_create(auto_step_cb, 1000, NULL);
@@ -241,7 +241,7 @@ static void auto_step_cb(lv_timer_t * t)
break;
}
case 41:
lv_scr_load(lv_obj_create(NULL));
lv_screen_load(lv_obj_create(NULL));
_lv_demo_music_pause();
break;
}

View File

@@ -160,7 +160,7 @@ void _lv_demo_music_list_button_check(uint32_t track_id, bool state)
lv_obj_scroll_to_view(btn, LV_ANIM_ON);
}
else {
lv_obj_clear_state(btn, LV_STATE_CHECKED);
lv_obj_remove_state(btn, LV_STATE_CHECKED);
lv_image_set_src(icon, &img_lv_demo_music_btn_list_play);
}
}

View File

@@ -288,11 +288,11 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
/* Create an intro from a logo + label */
LV_IMAGE_DECLARE(img_lv_demo_music_logo);
lv_obj_t * logo = lv_image_create(lv_scr_act());
lv_obj_t * logo = lv_image_create(lv_screen_active());
lv_image_set_src(logo, &img_lv_demo_music_logo);
lv_obj_move_foreground(logo);
lv_obj_t * title = lv_label_create(lv_scr_act());
lv_obj_t * title = lv_label_create(lv_screen_active());
lv_label_set_text(title, "LVGL Demo\nMusic player");
lv_obj_set_style_text_align(title, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_set_style_text_font(title, font_large, 0);
@@ -306,7 +306,7 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_anim_set_time(&a, 400);
lv_anim_set_delay(&a, INTRO_TIME + 800);
lv_anim_set_values(&a, LV_SCALE_NONE, 10);
lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb);
lv_anim_set_ready_cb(&a, lv_obj_delete_anim_ready_cb);
lv_anim_start(&a);
lv_obj_update_layout(main_cont);
@@ -371,11 +371,11 @@ void _lv_demo_music_pause(void)
playing = false;
spectrum_i_pause = spectrum_i;
spectrum_i = 0;
lv_anim_del(spectrum_obj, spectrum_anim_cb);
lv_anim_delete(spectrum_obj, spectrum_anim_cb);
lv_obj_invalidate(spectrum_obj);
lv_image_set_zoom(album_image_obj, LV_SCALE_NONE);
if(sec_counter_timer) lv_timer_pause(sec_counter_timer);
lv_obj_clear_state(play_obj, LV_STATE_CHECKED);
lv_obj_remove_state(play_obj, LV_STATE_CHECKED);
}
/**********************
@@ -386,8 +386,8 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
{
/*A transparent container in which the player section will be scrolled*/
main_cont = lv_obj_create(parent);
lv_obj_clear_flag(main_cont, LV_OBJ_FLAG_CLICKABLE);
lv_obj_clear_flag(main_cont, LV_OBJ_FLAG_SCROLL_ELASTIC);
lv_obj_remove_flag(main_cont, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(main_cont, LV_OBJ_FLAG_SCROLL_ELASTIC);
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_scroll_snap_y(main_cont, LV_SCROLL_SNAP_CENTER); /*Snap the children to the center*/
@@ -400,7 +400,7 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
#else
lv_obj_set_size(player, LV_HOR_RES, LV_VER_RES + LV_DEMO_MUSIC_HANDLE_SIZE * 2);
#endif
lv_obj_clear_flag(player, LV_OBJ_FLAG_SNAPPABLE);
lv_obj_remove_flag(player, LV_OBJ_FLAG_SNAPPABLE);
lv_obj_set_style_bg_color(player, lv_color_hex(0xffffff), 0);
lv_obj_set_style_border_width(player, 0, 0);
@@ -411,16 +411,16 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
* It is used only to snap it to center.*/
lv_obj_t * placeholder1 = lv_obj_create(main_cont);
lv_obj_remove_style_all(placeholder1);
lv_obj_clear_flag(placeholder1, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(placeholder1, LV_OBJ_FLAG_CLICKABLE);
lv_obj_t * placeholder2 = lv_obj_create(main_cont);
lv_obj_remove_style_all(placeholder2);
lv_obj_clear_flag(placeholder2, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(placeholder2, LV_OBJ_FLAG_CLICKABLE);
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
lv_obj_t * placeholder3 = lv_obj_create(main_cont);
lv_obj_remove_style_all(placeholder3);
lv_obj_clear_flag(placeholder3, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(placeholder3, LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_size(placeholder1, lv_pct(100), LV_VER_RES);
lv_obj_set_y(placeholder1, 0);
@@ -545,7 +545,7 @@ static lv_obj_t * create_spectrum_obj(lv_obj_t * parent)
#else
lv_obj_set_height(obj, 250);
#endif
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
lv_obj_add_event(obj, spectrum_draw_event_cb, LV_EVENT_ALL, NULL);
lv_obj_refresh_ext_draw_size(obj);
album_image_obj = album_image_create(obj);
@@ -714,7 +714,7 @@ static void track_load(uint32_t id)
}
#endif
lv_anim_set_exec_cb(&a, _obj_set_x_anim_cb);
lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb);
lv_anim_set_ready_cb(&a, lv_obj_delete_anim_ready_cb);
lv_anim_start(&a);
lv_anim_set_path_cb(&a, lv_anim_path_linear);
@@ -766,7 +766,7 @@ static void del_counter_timer_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
if(code == LV_EVENT_DELETE && sec_counter_timer) {
lv_timer_del(sec_counter_timer);
lv_timer_delete(sec_counter_timer);
sec_counter_timer = NULL;
}
}
@@ -891,9 +891,9 @@ static void spectrum_draw_event_cb(lv_event_t * e)
}
}
else if(code == LV_EVENT_DELETE) {
lv_anim_del(NULL, start_anim_cb);
lv_anim_del(NULL, spectrum_anim_cb);
if(start_anim && stop_start_anim_timer) lv_timer_del(stop_start_anim_timer);
lv_anim_delete(NULL, start_anim_cb);
lv_anim_delete(NULL, spectrum_anim_cb);
if(start_anim && stop_start_anim_timer) lv_timer_delete(stop_start_anim_timer);
}
}
@@ -963,7 +963,7 @@ static lv_obj_t * album_image_create(lv_obj_t * parent)
lv_image_set_antialias(img, false);
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
lv_obj_add_event(img, album_gesture_event_cb, LV_EVENT_GESTURE, NULL);
lv_obj_clear_flag(img, LV_OBJ_FLAG_GESTURE_BUBBLE);
lv_obj_remove_flag(img, LV_OBJ_FLAG_GESTURE_BUBBLE);
lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE);
return img;

View File

@@ -37,7 +37,7 @@ static lv_obj_t * list;
**********************/
void lv_demo_scroll(void)
{
lv_obj_t * panel = lv_obj_create(lv_scr_act());
lv_obj_t * panel = lv_obj_create(lv_screen_active());
lv_obj_set_style_shadow_width(panel, 16, 0);
lv_obj_set_style_shadow_ofs_y(panel, 8, 0);
lv_obj_set_style_shadow_ofs_x(panel, 4, 0);
@@ -94,8 +94,8 @@ static lv_obj_t * switch_create(lv_obj_t * parent, const char * title, lv_obj_fl
lv_obj_add_flag(list, flag);
}
else {
lv_obj_clear_state(sw, LV_STATE_CHECKED);
lv_obj_clear_flag(list, flag);
lv_obj_remove_state(sw, LV_STATE_CHECKED);
lv_obj_remove_flag(list, flag);
}
return cont;
@@ -107,7 +107,7 @@ static void generic_swicth_event_cb(lv_event_t * e)
lv_obj_flag_t flag = (lv_obj_flag_t)((lv_uintptr_t)lv_event_get_user_data(e));
if(lv_obj_has_state(sw, LV_STATE_CHECKED)) lv_obj_add_flag(list, flag);
else lv_obj_clear_flag(list, flag);
else lv_obj_remove_flag(list, flag);
}
#endif

View File

@@ -20,8 +20,8 @@
/**********************
* STATIC PROTOTYPES
**********************/
static void auto_del(lv_obj_t * obj, uint32_t delay);
static void msgbox_del(lv_timer_t * tmr);
static void auto_delete(lv_obj_t * obj, uint32_t delay);
static void msgbox_delete(lv_timer_t * tmr);
static void set_y_anim(void * obj, int32_t v);
static void set_width_anim(void * obj, int32_t v);
static void arc_set_end_angle_anim(void * obj, int32_t v);
@@ -84,7 +84,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
break;
case 0:
/* Holder for all object types */
main_page = lv_obj_create(lv_scr_act());
main_page = lv_obj_create(lv_screen_active());
lv_obj_set_size(main_page, LV_HOR_RES / 2, LV_VER_RES);
lv_obj_set_flex_flow(main_page, LV_FLEX_FLOW_COLUMN);
@@ -96,7 +96,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
break;
case 1: {
obj = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, 50);
obj = lv_tabview_create(lv_screen_active(), LV_DIR_TOP, 50);
lv_obj_set_size(obj, LV_HOR_RES / 2, LV_VER_RES / 2);
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
lv_obj_t * t = lv_tabview_add_tab(obj, "First");
@@ -108,7 +108,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
t = lv_tabview_add_tab(obj, LV_SYMBOL_CLOSE);
lv_tabview_set_act(obj, 1, LV_ANIM_ON);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 30);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 30);
}
break;
@@ -130,14 +130,14 @@ static void obj_test_task_cb(lv_timer_t * tmr)
lv_anim_start(&a);
/*Delete the object a few sec later*/
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 10);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 10);
obj = lv_label_create(obj);
lv_label_set_text_fmt(obj, "Formatted:\n%d %s", 12, "Volt");
break;
case 3:
ta = lv_textarea_create(lv_scr_act());
ta = lv_textarea_create(lv_screen_active());
lv_obj_align_to(ta, main_page, LV_ALIGN_OUT_RIGHT_TOP, 10, 10);
lv_obj_set_size(ta, LV_HOR_RES / 3, LV_VER_RES / 4);
lv_textarea_set_placeholder_text(ta, "The placeholder");
@@ -147,7 +147,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
obj = lv_button_create(main_page);
lv_obj_set_size(obj, 100, 70);
lv_obj_set_style_bg_image_src(obj, LV_SYMBOL_DUMMY"Text from\nstyle", 0);
lv_obj_del_async(obj); /*Delete on next call of `lv_task_handler` (so not now)*/
lv_obj_delete_async(obj); /*Delete on next call of `lv_task_handler` (so not now)*/
break;
case 5:
@@ -163,29 +163,29 @@ static void obj_test_task_cb(lv_timer_t * tmr)
lv_bar_set_value(obj, 1800, LV_ANIM_ON);
lv_bar_set_start_value(obj, -500, LV_ANIM_ON);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 70);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 70);
obj = lv_slider_create(main_page);
lv_obj_set_style_anim_time(obj, LV_DEMO_STRESS_TIME_STEP * 8, 0);
lv_slider_set_value(obj, 5000, LV_ANIM_ON); /*Animate to out of range value*/
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 22);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 22);
obj = lv_switch_create(main_page);
obj = lv_switch_create(main_page);
lv_obj_add_state(obj, LV_STATE_CHECKED);
auto_del(obj, 730);
auto_delete(obj, 730);
break;
case 8:
obj = lv_win_create(lv_scr_act());
obj = lv_win_create(lv_screen_active());
lv_obj_set_size(obj, LV_HOR_RES / 2, LV_VER_RES / 2);
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
lv_win_add_title(obj, "Window title");
lv_win_add_button(obj, LV_SYMBOL_CLOSE, 40);
lv_win_add_button(obj, LV_SYMBOL_DOWN, 40);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 5);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 5);
obj = lv_calendar_create(lv_win_get_content(obj));
break;
@@ -194,7 +194,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
"Here area some dummy sentences to be sure the text area will be really scrollable.");
break;
case 10:
obj = lv_keyboard_create(lv_scr_act());
obj = lv_keyboard_create(lv_screen_active());
lv_keyboard_set_mode(obj, LV_KEYBOARD_MODE_TEXT_UPPER);
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
@@ -203,7 +203,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
lv_anim_set_exec_cb(&a, set_y_anim);
lv_anim_start(&a);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 18);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 18);
break;
case 11:
@@ -211,14 +211,14 @@ static void obj_test_task_cb(lv_timer_t * tmr)
lv_dropdown_set_options(obj, "Zero\nOne\nTwo\nThree\nFour\nFive\nSix\nSeven\nEight");
lv_dropdown_open(obj);
lv_dropdown_set_selected(obj, 2);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 11);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 11);
break;
case 12:
obj = lv_roller_create(main_page);
lv_roller_set_options(obj, "Zero\nOne\nTwo\nThree\nFour\nFive\nSix\nSeven\nEight", LV_ROLLER_MODE_INFINITE);
lv_roller_set_selected(obj, 2, LV_ANIM_ON);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 20 + 22);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 20 + 22);
break;
case 13:
@@ -237,13 +237,13 @@ static void obj_test_task_cb(lv_timer_t * tmr)
lv_scale_set_mode(obj, LV_SCALE_MODE_ROUND_INNER);
lv_obj_scroll_to_view(obj, LV_ANIM_ON);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 6 + 30);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 6 + 30);
break;
case 14:
obj = lv_msgbox_create(NULL, "Title", "Some text on the message box with average length", mbox_buttons, true);
lv_timer_t * msgbox_tmr = lv_timer_create(msgbox_del, LV_DEMO_STRESS_TIME_STEP * 5 + 30, obj);
lv_timer_t * msgbox_tmr = lv_timer_create(msgbox_delete, LV_DEMO_STRESS_TIME_STEP * 5 + 30, obj);
lv_timer_set_repeat_count(msgbox_tmr, 1);
lv_obj_align(obj, LV_ALIGN_RIGHT_MID, -10, 0);
break;
@@ -253,9 +253,9 @@ static void obj_test_task_cb(lv_timer_t * tmr)
break;
case 16: {
lv_obj_t * tv = lv_tileview_create(lv_scr_act());
lv_obj_t * tv = lv_tileview_create(lv_screen_active());
lv_obj_set_size(tv, 200, 200);
auto_del(tv, LV_DEMO_STRESS_TIME_STEP * 4 + 5);
auto_delete(tv, LV_DEMO_STRESS_TIME_STEP * 4 + 5);
obj = lv_tileview_add_tile(tv, 0, 0, LV_DIR_ALL);
obj = lv_label_create(obj);
@@ -278,18 +278,18 @@ static void obj_test_task_cb(lv_timer_t * tmr)
{
lv_obj_t * b;
b = lv_list_add_button(obj, LV_SYMBOL_OK, "1. Some very long text to scroll");
auto_del(b, 10);
auto_delete(b, 10);
lv_list_add_button(obj, LV_SYMBOL_OK, "2. Some very long text to scroll");
lv_list_add_button(obj, LV_SYMBOL_OK, "3. Some very long text to scroll");
b = lv_list_add_button(obj, LV_SYMBOL_OK, "4. Some very long text to scroll");
auto_del(b, LV_DEMO_STRESS_TIME_STEP);
auto_delete(b, LV_DEMO_STRESS_TIME_STEP);
b = lv_list_add_button(obj, LV_SYMBOL_OK, "5. Some very long text to scroll");
auto_del(b, LV_DEMO_STRESS_TIME_STEP + 90);
auto_delete(b, LV_DEMO_STRESS_TIME_STEP + 90);
b = lv_list_add_button(obj, LV_SYMBOL_OK, "6. Some very long text to scroll");
auto_del(b, LV_DEMO_STRESS_TIME_STEP + 10);
auto_delete(b, LV_DEMO_STRESS_TIME_STEP + 10);
lv_obj_scroll_to_view(lv_obj_get_child(obj, -1), LV_ANIM_ON);
}
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 15);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 15);
obj = lv_table_create(main_page);
lv_table_set_cell_value(obj, 0, 0, "0,0");
@@ -347,7 +347,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
lv_spinbox_set_step(obj, 1);
lv_spinbox_increment(obj);
lv_spinbox_increment(obj);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 15);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 15);
lv_obj_scroll_by(main_page, 0, 20, LV_ANIM_ON);
@@ -368,7 +368,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
lv_chart_set_next_value(obj, s1, 48);
lv_chart_set_next_value(obj, s1, 72);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 3);
}
lv_obj_scroll_by(main_page, 0, 20, LV_ANIM_ON);
@@ -377,14 +377,14 @@ static void obj_test_task_cb(lv_timer_t * tmr)
case 24:
obj = lv_checkbox_create(main_page);
lv_checkbox_set_text(obj, "An option to select");
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 20);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 20);
obj = lv_checkbox_create(main_page);
lv_obj_add_state(obj, LV_STATE_CHECKED);
obj = lv_checkbox_create(main_page);
lv_obj_add_state(obj, LV_STATE_CHECKED | LV_STATE_DISABLED);
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 1 + 60);
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 1 + 60);
lv_obj_scroll_by(main_page, 0, 20, LV_ANIM_ON);
@@ -395,7 +395,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
{
uint16_t i;
for(i = 0; i < 64; i++) {
lv_textarea_del_char_forward(ta);
lv_textarea_delete_char_forward(ta);
}
}
break;
@@ -405,11 +405,11 @@ static void obj_test_task_cb(lv_timer_t * tmr)
break;
case 29:
lv_obj_clean(main_page);
lv_obj_del(ta);
lv_obj_delete(ta);
ta = NULL;
break;
case 31:
lv_obj_clean(lv_scr_act());
lv_obj_clean(lv_screen_active());
main_page = NULL;
g_state = -2;
break;
@@ -420,19 +420,19 @@ static void obj_test_task_cb(lv_timer_t * tmr)
g_state++;
}
static void auto_del(lv_obj_t * obj, uint32_t delay)
static void auto_delete(lv_obj_t * obj, uint32_t delay)
{
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
lv_anim_set_time(&a, 0);
lv_anim_set_delay(&a, delay);
lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb);
lv_anim_set_ready_cb(&a, lv_obj_delete_anim_ready_cb);
lv_anim_start(&a);
}
static void msgbox_del(lv_timer_t * tmr)
static void msgbox_delete(lv_timer_t * tmr)
{
lv_msgbox_close(tmr->user_data);
}

View File

@@ -88,7 +88,7 @@ void lv_demo_transform(void)
lv_obj_center(card_to_transform);
lv_coord_t disp_w = lv_display_get_horizontal_resolution(NULL);
lv_obj_t * arc = lv_arc_create(lv_scr_act());
lv_obj_t * arc = lv_arc_create(lv_screen_active());
lv_obj_set_size(arc, disp_w - 20, disp_w - 20);
lv_arc_set_range(arc, 0, 270);
lv_arc_set_value(arc, 225);
@@ -96,7 +96,7 @@ void lv_demo_transform(void)
lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST);
lv_obj_center(arc);
lv_obj_t * slider = lv_slider_create(lv_scr_act());
lv_obj_t * slider = lv_slider_create(lv_screen_active());
lv_obj_set_width(slider, lv_pct(70));
lv_obj_align(slider, LV_ALIGN_BOTTOM_MID, 0, -20);
lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
@@ -110,9 +110,9 @@ void lv_demo_transform(void)
static lv_obj_t * card_create(void)
{
lv_obj_t * card = lv_obj_create(lv_scr_act());
lv_obj_t * card = lv_obj_create(lv_screen_active());
lv_obj_add_style(card, &style_card, 0);
lv_obj_clear_flag(card, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
lv_obj_remove_flag(card, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
lv_obj_t * avatar = lv_image_create(card);
lv_image_set_src(avatar, &img_transform_avatar_15);
@@ -125,7 +125,7 @@ static lv_obj_t * card_create(void)
lv_obj_set_style_text_font(name, &lv_font_montserrat_18, 0);
lv_obj_t * btn = lv_button_create(card);
lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
lv_obj_remove_flag(card, LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
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);

View File

@@ -162,9 +162,9 @@ void lv_demo_widgets(void)
lv_style_set_border_width(&style_bullet, 0);
lv_style_set_radius(&style_bullet, LV_RADIUS_CIRCLE);
tv = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, tab_h);
tv = lv_tabview_create(lv_screen_active(), LV_DIR_TOP, tab_h);
lv_obj_set_style_text_font(lv_scr_act(), font_normal, 0);
lv_obj_set_style_text_font(lv_screen_active(), font_normal, 0);
if(disp_size == DISP_LARGE) {
lv_obj_t * tab_buttons = lv_tabview_get_tab_buttons(tv);
@@ -247,7 +247,7 @@ static void profile_create(lv_obj_t * parent)
lv_obj_center(label);
/*Create a keyboard*/
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
/*Create the second panel*/
@@ -657,7 +657,7 @@ static void analytics_create(lv_obj_t * parent)
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_color(arc, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
lv_anim_set_var(&a, arc);
@@ -672,7 +672,7 @@ static void analytics_create(lv_obj_t * parent)
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_color(arc, lv_palette_main(LV_PALETTE_RED), LV_PART_INDICATOR);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_center(arc);
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
@@ -688,7 +688,7 @@ static void analytics_create(lv_obj_t * parent)
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_color(arc, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_center(arc);
lv_anim_set_exec_cb(&a, scale1_indic1_anim_cb);
@@ -710,7 +710,7 @@ static void analytics_create(lv_obj_t * parent)
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_color(arc, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_center(arc);
arc = lv_arc_create(scale2);
@@ -721,7 +721,7 @@ static void analytics_create(lv_obj_t * parent)
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_color(arc, lv_palette_main(LV_PALETTE_RED), LV_PART_INDICATOR);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_center(arc);
arc = lv_arc_create(scale2);
@@ -731,7 +731,7 @@ static void analytics_create(lv_obj_t * parent)
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_color(arc, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_center(arc);
lv_timer_t * scale2_timer = lv_timer_create(scale2_timer_cb, 100, scale2);
@@ -999,7 +999,7 @@ static void color_changer_create(lv_obj_t * parent)
lv_obj_set_style_opa(c, LV_OPA_TRANSP, 0);
lv_obj_set_size(c, 20, 20);
lv_obj_add_event(c, color_event_cb, LV_EVENT_ALL, &palette[i]);
lv_obj_clear_flag(c, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
lv_obj_remove_flag(c, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
}
lv_obj_t * btn = lv_button_create(parent);
@@ -1216,7 +1216,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_update_layout(tv); /*Be sure the sizes are recalculated*/
lv_obj_set_height(tv, LV_VER_RES - lv_obj_get_height(kb));
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_scroll_to_view_recursive(ta, LV_ANIM_OFF);
lv_indev_wait_release(lv_event_get_param(e));
}
@@ -1272,9 +1272,9 @@ static void calendar_event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%02d.%02d.%d", d.day, d.month, d.year);
lv_textarea_set_text(ta, buf);
lv_obj_del(calendar);
lv_obj_delete(calendar);
calendar = NULL;
lv_obj_clear_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_style_bg_opa(lv_layer_top(), LV_OPA_TRANSP, 0);
}
}
@@ -1494,7 +1494,7 @@ static void scale2_event_cb(lv_event_t * e)
lv_event_code_t code = lv_event_get_code(e);
if(code == LV_EVENT_DELETE) {
lv_timer_t * scale2_timer = lv_event_get_user_data(e);
if(scale2_timer) lv_timer_del(scale2_timer);
if(scale2_timer) lv_timer_delete(scale2_timer);
}
}

View File

@@ -675,7 +675,7 @@ Fixes
`25ce6e3 <https://github.com/lvgl/lvgl/commit/25ce6e3ae9e144e2df5dad34475dda3542015f6a>`__
- fix(indev): do not send keys to objects in disabled state
`b0a46c4 <https://github.com/lvgl/lvgl/commit/b0a46c4837c922cb1303ef768da3209e7efa45ae>`__
- fix(disp): make lv_scr_load work better with lv_scr_load_anim and
- fix(disp): make lv_screen_load work better with lv_screen_load_anim and
auto_del = true
`52287fd <https://github.com/lvgl/lvgl/commit/52287fd64ad59c35794d1f4486b777f4eb686abc>`__
- fix(draw): create intermediate layer for blend modes too
@@ -1084,7 +1084,7 @@ Fixes
`2944 <https://github.com/littlevgl/lvgl/pull/2944>`__
- fix(rlottie): fix variable name
`2971 <https://github.com/littlevgl/lvgl/pull/2971>`__
- fix(group): in lv_group_del() remove group from indev (lvgl#2963)
- fix(group): in lv_group_delete() remove group from indev (lvgl#2963)
`2964 <https://github.com/littlevgl/lvgl/pull/2964>`__
- fix(obj): old parent's scroll is not updated in lv_obj_set_parent()
`2965 <https://github.com/littlevgl/lvgl/pull/2965>`__
@@ -1623,7 +1623,7 @@ New Features
- feat(event) add LV_SCREEN\_(UN)LOAD_START
`7bae9e3 <https://github.com/lvgl/lvgl/commit/7bae9e3ddde9d6bdc06ae437f20a789cd330a556>`__
- feat(obj) add lv_obj_del_delayed()
- feat(obj) add lv_obj_delete_delayed()
`c6a2e15 <https://github.com/lvgl/lvgl/commit/c6a2e15ec23c8e96f71bafa8e43ef67fc4a73d0a>`__
- feat(docs) add view on GitHub link
@@ -1811,7 +1811,7 @@ Fixes
and lv_tick_inc()
`2675 <https://github.com/lvgl/lvgl/pull/2675>`__
- fix(anim_timeline) avoid calling lv_anim_del(NULL, NULL)
- fix(anim_timeline) avoid calling lv_anim_delete(NULL, NULL)
`2628 <https://github.com/lvgl/lvgl/pull/2628>`__
- fix(kconfig) sync Kconfig with the latest lv_conf_template.h
@@ -2245,7 +2245,7 @@ Fixes
`e41c507 <https://github.com/lvgl/lvgl/commit/e41c50780495c7d6ac6a2b0edf12fc98c9d85a6b>`__
- fix(disp) be sure the pending scr load animation is finished in
lv_scr_load_anim
lv_screen_load_anim
`eb6ae52 <https://github.com/lvgl/lvgl/commit/eb6ae526432453e4b9dbc7a760cd65d164050548>`__
- fix(color) fox color premult precision with 16-bit color depth
@@ -2999,7 +2999,7 @@ Others
- Fix typo in commands to build rlottie
`2723 <https://github.com/lvgl/lvgl/pull/2723>`__
- del(.gitmodules): delete .gitmodules
- delete(.gitmodules): delete .gitmodules
`2718 <https://github.com/lvgl/lvgl/pull/2718>`__
- lv_obj_draw_part_dsc_t.text_length added
@@ -3542,7 +3542,7 @@ v7.8.1 (15.12.2020)
Bugfixes
~~~~~~~~
- fix(lv_scr_load_anim) fix when multiple screens are loaded at the
- fix(lv_screen_load_anim) fix when multiple screens are loaded at the
same time with delay
- fix(page) fix LV_SCROLLBAR_MODE_DRAG
@@ -3822,7 +3822,7 @@ v7.2.0 (21.07.2020)
New features
~~~~~~~~~~~~
- Add screen transitions with lv_scr_load_anim()
- Add screen transitions with lv_screen_load_anim()
- Add display background color, wallpaper and opacity. Shown when the
screen is transparent. Can be used with
lv_disp_set_bg_opa/color/image().

View File

@@ -88,7 +88,7 @@ A simple example
btn.align(lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text('Hello World!')
lv.scr_load(scr)
lv.screen_load(scr)
How can I use it?

View File

@@ -59,7 +59,7 @@ LV_ARC
import PikaStdLib
mem = PikaStdLib.MemChecker()
# Create an Arc
arc = lv.arc(lv.scr_act())
arc = lv.arc(lv.screen_active())
arc.set_end_angle(200)
arc.set_size(150, 150)
arc.center()
@@ -75,7 +75,7 @@ LV_BAR
import pika_lvgl as lv
import PikaStdLib
mem = PikaStdLib.MemChecker()
bar1 = lv.bar(lv.scr_act())
bar1 = lv.bar(lv.screen_active())
bar1.set_size(200, 20)
bar1.center()
bar1.set_value(70, lv.ANIM.OFF)
@@ -97,9 +97,9 @@ LV_BTN
def event_cb_2(evt):
print('in evt2')
print('mem used now: %0.2f kB' % (mem.getNow()))
btn1 = lv.btn(lv.scr_act())
btn1 = lv.btn(lv.screen_active())
btn1.align(lv.ALIGN.TOP_MID, 0, 10)
btn2 = lv.btn(lv.scr_act())
btn2 = lv.btn(lv.screen_active())
btn2.align(lv.ALIGN.TOP_MID, 0, 50)
btn1.add_event(event_cb_1, lv.EVENT.CLICKED, 0)
btn2.add_event(event_cb_2, lv.EVENT.CLICKED, 0)
@@ -115,18 +115,18 @@ LV_CHECKBOX
import pika_lvgl as lv
import PikaStdLib
mem = PikaStdLib.MemChecker()
cb = lv.checkbox(lv.scr_act())
cb = lv.checkbox(lv.screen_active())
cb.set_text("Apple")
cb.align(lv.ALIGN.TOP_LEFT, 0 ,0)
cb = lv.checkbox(lv.scr_act())
cb = lv.checkbox(lv.screen_active())
cb.set_text("Banana")
cb.add_state(lv.STATE.CHECKED)
cb.align(lv.ALIGN.TOP_LEFT, 0 ,30)
cb = lv.checkbox(lv.scr_act())
cb = lv.checkbox(lv.screen_active())
cb.set_text("Lemon")
cb.add_state(lv.STATE.DISABLED)
cb.align(lv.ALIGN.TOP_LEFT, 0 ,60)
cb = lv.checkbox(lv.scr_act())
cb = lv.checkbox(lv.screen_active())
cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
cb.set_text("Melon")
cb.align(lv.ALIGN.TOP_LEFT, 0 ,90)

View File

@@ -130,7 +130,7 @@ Example with the encoder device to assign a :code:`lv_group_t`:
lv_obj_t *arc;
lv_group_t *arc_group;
arc = lv_arc_create(lv_scr_act());
arc = lv_arc_create(lv_screen_active());
lv_obj_align(arc, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_size(arc, 150, 150);

View File

@@ -59,11 +59,11 @@ the *main.c* file. \* Create some frame buffer(s) as global variables:
.. code:: c
// Change the active screen's background color
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
/*Create a spinner*/
lv_obj_t * spinner = lv_spinner_create(lv_scr_act(), 1000, 60);
lv_obj_t * spinner = lv_spinner_create(lv_screen_active(), 1000, 60);
lv_obj_set_size(spinner, 64, 64);
lv_obj_align(spinner, LV_ALIGN_BOTTOM_MID, 0, 0);
@@ -183,11 +183,11 @@ variables:
.. code:: c
// Change the active screen's background color
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
/*Create a spinner*/
lv_obj_t * spinner = lv_spinner_create(lv_scr_act(), 1000, 60);
lv_obj_t * spinner = lv_spinner_create(lv_screen_active(), 1000, 60);
lv_obj_set_size(spinner, 64, 64);
lv_obj_align(spinner, LV_ALIGN_BOTTOM_MID, 0, 0);

View File

@@ -85,7 +85,7 @@ A simple example
.. code:: python
lv.start() # start LVGL
scr = lv.scr_act() # get default screen
scr = lv.screen_active() # get default screen
btn = lv.btn(scr) # create button
btn.center()
label = lv.label(btn) # create a label in the button

View File

@@ -126,8 +126,8 @@ other words, the parts of the children outside the parent are clipped.
A Screen is the "root" parent. You can have any number of screens.
To get the current screen call :cpp:func:`lv_scr_act`, and to load a screen
use :cpp:expr:`lv_scr_load(scr1)`.
To get the current screen call :cpp:func:`lv_screen_active`, and to load a screen
use :cpp:expr:`lv_screen_load(scr1)`.
You can create a new object with ``lv_<type>_create(parent)``. It will
return an :cpp:type:`lv_obj_t` ``*`` variable that can be used as a reference to the
@@ -137,7 +137,7 @@ For example:
.. code:: c
lv_obj_t * slider1 = lv_slider_create(lv_scr_act());
lv_obj_t * slider1 = lv_slider_create(lv_screen_active());
To set some basic attributes ``lv_obj_set_<parameter_name>(obj, <value>)`` functions can be used. For
example:
@@ -239,7 +239,7 @@ To manually add or remove states use:
.. code:: c
lv_obj_add_state(obj, LV_STATE_...);
lv_obj_clear_state(obj, LV_STATE_...);
lv_obj_remove_state(obj, LV_STATE_...);
Styles
~~~~~~
@@ -342,9 +342,9 @@ Learn more about :ref:`micropython`.
# Create a Button and a Label
scr = lv.obj()
btn = lv.btn(scr)
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
btn.align(lv.screen_active(), lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text("Button")
# Load the screen
lv.scr_load(scr)
lv.screen_load(scr)

View File

@@ -88,7 +88,7 @@ They can be combined.eg:
:c:expr:`LV_FREETYPE_FONT_STYLE_BOLD | LV_FREETYPE_FONT_STYLE_ITALIC`.
Use the :c:expr:`lv_freetype_font_create()` function to create a font. To
delete a font, use :c:expr:`lv_freetype_font_del()`. For more detailed usage,
delete a font, use :c:expr:`lv_freetype_font_delete()`. For more detailed usage,
please refer to example code.
Example

View File

@@ -56,7 +56,7 @@ Usage
Enable :c:macro:`LV_USE_FILE_EXPLORER` in ``lv_conf.h``.
First use :c:expr:`lv_file_explorer_create(lv_scr_act())` to create a file
First use :c:expr:`lv_file_explorer_create(lv_screen_active())` to create a file
explorer, The default size is the screen size. After that, you can
customize the style like widget.
@@ -80,7 +80,7 @@ customize the style like widget.
``lv_conf.h`` 中打开 :c:macro:`LV_USE_FILE_EXPLORER`\ 。
首先,使用 :c:expr:`lv_file_explorer_create(lv_scr_act())`
首先,使用 :c:expr:`lv_file_explorer_create(lv_screen_active())`
函数创建一个文件浏览器,默认大小为屏幕大小,之后可以像组件那样自定义样式。
.. raw:: html

View File

@@ -48,7 +48,7 @@ Usage
Enable :c:macro:`LV_USE_IME_PINYIN` in ``lv_conf.h``.
First use :c:expr:`lv_ime_pinyin_create(lv_scr_act())` to create a Pinyin
First use :c:expr:`lv_ime_pinyin_create(lv_screen_active())` to create a Pinyin
input method plug-in, then use
:c:expr:`lv_ime_pinyin_set_keyboard(pinyin_ime, kb)` to add the ``keyboard``
you created to the Pinyin input method plug-in. You can use
@@ -85,7 +85,7 @@ the keyboard and dictionary at any time.
``lv_conf.h`` 中打开 :c:macro:`LV_USE_IME_PINYIN`\ 。
首先,使用 :c:expr:`lv_ime_pinyin_create(lv_scr_act())`
首先,使用 :c:expr:`lv_ime_pinyin_create(lv_screen_active())`
函数创建一个拼音输入法插件, 然后使用
:c:expr:`lv_ime_pinyin_set_keyboard(pinyin_ime, kb)`
函数将您创建的键盘组件添加到插件中。
@@ -248,7 +248,7 @@ only need to call this function to set up and use your dictionary:
.. code:: c
lv_obj_t * pinyin_ime = lv_100ask_pinyin_ime_create(lv_scr_act());
lv_obj_t * pinyin_ime = lv_100ask_pinyin_ime_create(lv_screen_active());
lv_100ask_pinyin_ime_set_dict(pinyin_ime, your_pinyin_dict);
Modes

View File

@@ -18,7 +18,7 @@ random operations at random times within this range. Call
If you want to pause the monkey, call
:c:expr:`lv_monkey_set_enable(monkey, false)`. To delete the monkey, call
:c:expr:`lv_monkey_del(monkey)`.
:c:expr:`lv_monkey_delete(monkey)`.
Note that ``input_range`` has different meanings in different ``type``:

View File

@@ -123,7 +123,7 @@ pixels so *20* means *20 px/sec* speed.
Delete animations
*****************
You can delete an animation with :cpp:expr:`lv_anim_del(var, func)` if you
You can delete an animation with :cpp:expr:`lv_anim_delete(var, func)` if you
provide the animated variable and its animator function.
Timeline
@@ -159,7 +159,7 @@ duration of the entire animation timeline.
Call :cpp:expr:`lv_anim_timeline_get_reverse(at)` function to get whether to
reverse the animation timeline.
Call :cpp:expr:`lv_anim_timeline_del(at)` function to delete the animation
Call :cpp:expr:`lv_anim_timeline_delete(at)` function to delete the animation
timeline.
.. image:: /misc/anim-timeline.png

View File

@@ -290,7 +290,7 @@ Here are some examples to set an object's size using a style:
lv_style_init(&style);
lv_style_set_width(&style, 100);
lv_obj_t * btn = lv_btn_create(lv_scr_act());
lv_obj_t * btn = lv_btn_create(lv_screen_active());
lv_obj_add_style(btn, &style, LV_PART_MAIN);
As you will see below there are some other great features of size and
@@ -453,7 +453,7 @@ behave with layouts:
- :cpp:enumerator:`LV_OBJ_FLAG_IGNORE_LAYOUT` The object is simply ignored by the layouts. Its coordinates can be set as usual.
- :cpp:enumerator:`LV_OBJ_FLAG_FLOATING` Same as :cpp:enumerator:`LV_OBJ_FLAG_IGNORE_LAYOUT` but the object with :cpp:enumerator:`LV_OBJ_FLAG_FLOATING` will be ignored in :c:macro:`LV_SIZE_CONTENT` calculations.
These flags can be added/removed with :cpp:expr:`lv_obj_add_flag(obj, FLAG)` and :cpp:expr:`lv_obj_clear_flag(obj, FLAG)`
These flags can be added/removed with :cpp:expr:`lv_obj_add_flag(obj, FLAG)` and :cpp:expr:`lv_obj_remove_flag(obj, FLAG)`
Adding new layouts
------------------

View File

@@ -34,7 +34,7 @@ Therefore, the whole concept of multi-display handling is completely
hidden if you register only one display. By default, the last created
(and only) display is used.
:cpp:func:`lv_scr_act`, :cpp:func:`lv_scr_load`, :cpp:func:`lv_layer_top`,
:cpp:func:`lv_screen_active`, :cpp:func:`lv_screen_load`, :cpp:func:`lv_layer_top`,
:cpp:func:`lv_layer_sys`, :c:macro:`LV_HOR_RES` and :c:macro:`LV_VER_RES` are always applied
on the most recently created (default) display. If you pass ``NULL`` as
``disp`` parameter to display related functions the default display will
@@ -84,14 +84,14 @@ To create a screen, use
``lv_obj_t * scr = lv_<type>_create(NULL, copy)``. ``copy`` can be an
existing screen copied into the new screen.
To load a screen, use :cpp:expr:`lv_scr_load(scr)`. To get the active screen,
use :cpp:expr:`lv_scr_act()`. These functions work on the default display. If
To load a screen, use :cpp:expr:`lv_screen_load(scr)`. To get the active screen,
use :cpp:expr:`lv_screen_active()`. These functions work on the default display. If
you want to specify which display to work on, use
:cpp:expr:`lv_disp_get_scr_act(disp)` and :cpp:expr:`lv_disp_load_scr(disp, scr)`. A
:cpp:expr:`lv_disp_get_screen_act(disp)` and :cpp:expr:`lv_disp_load_scr(disp, scr)`. A
screen can be loaded with animations too. Read more
`here <object.html#load-screens>`__.
Screens can be deleted with :cpp:expr:`lv_obj_del(scr)`, but ensure that you do
Screens can be deleted with :cpp:expr:`lv_obj_delete(scr)`, but ensure that you do
not delete the currently loaded screen.
Transparent screens
@@ -114,9 +114,9 @@ In summary, to enable transparent screens and displays for OSD menu-like
UIs:
- Set the screen's ``bg_opa`` to transparent:
:cpp:expr:`lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP, 0)`
:cpp:expr:`lv_obj_set_style_bg_opa(lv_screen_active(), LV_OPA_TRANSP, 0)`
- Set the bottom layer's ``bg_opa`` to transparent:
:cpp:expr:`lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP, 0)`
:cpp:expr:`lv_obj_set_style_bg_opa(lv_screen_active(), LV_OPA_TRANSP, 0)`
- Set the screen's bg_opa to 0:
:cpp:expr:`lv_obj_set_style_bg_opa(lv_layer_bottom(), LV_OPA_TRANSP, 0)`
- Set a color format with alpha channel. E.g.

View File

@@ -20,7 +20,7 @@ In practice, it looks like this:
.. code:: c
lv_obj_t * btn = lv_btn_create(lv_scr_act());
lv_obj_t * btn = lv_btn_create(lv_screen_active());
lv_obj_add_event(btn, my_event_cb, LV_EVENT_CLICKED, NULL); /*Assign an event callback*/
...
@@ -132,7 +132,7 @@ Other events
- :cpp:enumerator:`LV_EVENT_STYLE_CHANGED`: Object's style has changed
- :cpp:enumerator:`LV_EVENT_BASE_DIR_CHANGED`: The base dir has changed
- :cpp:enumerator:`LV_EVENT_GET_SELF_SIZE`: Get the internal size of a widget
- :cpp:enumerator:`LV_EVENT_SCREEN_UNLOAD_START`: A screen unload started, fired immediately when lv_scr_load/lv_scr_load_anim is called
- :cpp:enumerator:`LV_EVENT_SCREEN_UNLOAD_START`: A screen unload started, fired immediately when lv_screen_load/lv_screen_load_anim is called
- :cpp:enumerator:`LV_EVENT_SCREEN_LOAD_START`: A screen load started, fired when the screen change delay is expired
- :cpp:enumerator:`LV_EVENT_SCREEN_LOADED`: A screen was loaded, called when all animations are finished
- :cpp:enumerator:`LV_EVENT_SCREEN_UNLOADED`: A screen was unloaded, called when all animations are finished

View File

@@ -33,7 +33,7 @@ To test it try
.. code:: c
lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
lv_obj_t * label1 = lv_label_create(lv_screen_active(), NULL);
lv_label_set_text(label1, LV_SYMBOL_OK);
If all works well, a ✓ character should be displayed.

View File

@@ -153,7 +153,7 @@ The simplest way to use an image in LVGL is to display it with an
.. code:: c
lv_obj_t * icon = lv_image_create(lv_scr_act(), NULL);
lv_obj_t * icon = lv_image_create(lv_screen_active(), NULL);
/*From variable*/
lv_image_set_src(icon, &my_icon_dsc);

View File

@@ -25,12 +25,12 @@ Pointer input devices (like a mouse) can have a cursor.
lv_indev_t * mouse_indev = lv_indev_create();
...
LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image source.*/
lv_obj_t * cursor_obj = lv_image_create(lv_scr_act()); /*Create an image object for the cursor */
lv_obj_t * cursor_obj = lv_image_create(lv_screen_active()); /*Create an image object for the cursor */
lv_image_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/
lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/
Note that the cursor object should have
:cpp:expr:`lv_obj_clear_flag(cursor_obj, LV_OBJ_FLAG_CLICKABLE)`. For images,
:cpp:expr:`lv_obj_remove_flag(cursor_obj, LV_OBJ_FLAG_CLICKABLE)`. For images,
*clicking* is disabled by default.
Gestures
@@ -68,7 +68,7 @@ event. For example:
lv_obj_add_event(screen1, my_event, LV_EVENT_GESTURE, NULL);
To prevent passing the gesture event to the parent from an object use
:cpp:expr:`lv_obj_clear_flag(obj, LV_OBJ_FLAG_GESTURE_BUBBLE)`.
:cpp:expr:`lv_obj_remove_flag(obj, LV_OBJ_FLAG_GESTURE_BUBBLE)`.
Note that, gestures are not triggered if an object is being scrolled.

View File

@@ -18,7 +18,7 @@ its children.
/*Create a screen*/
lv_obj_t * scr = lv_obj_create(NULL, NULL);
lv_scr_load(scr); /*Load the screen*/
lv_screen_load(scr); /*Load the screen*/
/*Create 2 buttons*/
lv_obj_t * btn1 = lv_btn_create(scr, NULL); /*Create a button on the screen*/
@@ -36,7 +36,7 @@ its children.
lv_label_set_text(label2, "Button 2"); /*Set the text of the label*/
/*Delete the second label*/
lv_obj_del(label2);
lv_obj_delete(label2);
Change order
************
@@ -60,7 +60,7 @@ Top and sys layers
LVGL uses two special layers named ``layer_top`` and ``layer_sys``. Both
are visible and common on all screens of a display. **They are not,
however, shared among multiple physical displays.** The ``layer_top`` is
always on top of the default screen (:cpp:func:`lv_scr_act`), and
always on top of the default screen (:cpp:func:`lv_screen_active`), and
``layer_sys`` is on top of ``layer_top``.
The ``layer_top`` can be used by the user to create some content visible

View File

@@ -83,7 +83,7 @@ it. Therefore, all positions are relative to the parent.
.. code:: c
lv_obj_t * parent = lv_obj_create(lv_scr_act()); /*Create a parent object on the current screen*/
lv_obj_t * parent = lv_obj_create(lv_screen_active()); /*Create a parent object on the current screen*/
lv_obj_set_size(parent, 100, 80); /*Set the size of the parent*/
lv_obj_t * obj1 = lv_obj_create(parent); /*Create an object on the previously created parent object*/
@@ -146,11 +146,11 @@ the object and all of its children.
.. code:: c
void lv_obj_del(lv_obj_t * obj);
void lv_obj_delete(lv_obj_t * obj);
:cpp:func:`lv_obj_del` will delete the object immediately. If for any reason you
can't delete the object immediately you can use
:cpp:expr:`lv_obj_del_async(obj)` which will perform the deletion on the next
:cpp:expr:`lv_obj_delete_async(obj)` which will perform the deletion on the next
call of :cpp:func:`lv_timer_handler`. This is useful e.g. if you want to
delete the parent of an object in the child's :cpp:enumerator:`LV_EVENT_DELETE`
handler.
@@ -158,7 +158,7 @@ handler.
You can remove all the children of an object (but not the object itself)
using :cpp:expr:`lv_obj_clean(obj)`.
You can use :cpp:expr:`lv_obj_del_delayed(obj, 1000)` to delete an object after
You can use :cpp:expr:`lv_obj_delete_delayed(obj, 1000)` to delete an object after
some time. The delay is expressed in milliseconds.
Screens
@@ -183,12 +183,12 @@ Get the active screen
There is always an active screen on each display. By default, the
library creates and loads a "Base object" as a screen for each display.
To get the currently active screen use the :cpp:func:`lv_scr_act` function.
To get the currently active screen use the :cpp:func:`lv_screen_active` function.
Load screens
------------
To load a new screen, use :cpp:expr:`lv_scr_load(scr1)`.
To load a new screen, use :cpp:expr:`lv_screen_load(scr1)`.
Layers
------
@@ -215,7 +215,7 @@ Load screen with animation
^^^^^^^^^^^^^^^^^^^^^^^^^^
A new screen can be loaded with animation by using
:cpp:expr:`lv_scr_load_anim(scr, transition_type, time, delay, auto_del)`. The
:cpp:expr:`lv_screen_load_anim(scr, transition_type, time, delay, auto_del)`. The
following transition types exist:
- :cpp:enumerator:`LV_SCR_LOAD_ANIM_NONE`: Switch immediately after ``delay`` milliseconds
@@ -227,7 +227,7 @@ following transition types exist:
Setting ``auto_del`` to ``true`` will automatically delete the old
screen when the animation is finished.
The new screen will become active (returned by :cpp:func:`lv_scr_act`) when
The new screen will become active (returned by :cpp:func:`lv_screen_active`) when
the animation starts after ``delay`` time. All inputs are disabled
during the screen animation.
@@ -239,7 +239,7 @@ Screens are created on the currently selected *default display*. The
:cpp:func:`lv_disp_drv_register`. You can also explicitly select a new default
display using :cpp:expr:`lv_disp_set_default(disp)`.
:cpp:func:`lv_scr_act`, :cpp:func:`lv_scr_load` and :cpp:func:`lv_scr_load_anim` operate
:cpp:func:`lv_screen_active`, :cpp:func:`lv_screen_load` and :cpp:func:`lv_screen_load_anim` operate
on the default display.
Visit `Multi-display support </overview/display>`__ to learn more.
@@ -291,7 +291,7 @@ The states are usually automatically changed by the library as the user
interacts with an object (presses, releases, focuses, etc.). However,
the states can be changed manually too. To set or clear given state (but
leave the other states untouched) use
``lv_obj_add/clear_state(obj, LV_STATE_...)`` In both cases OR-ed state
``lv_obj_add/remove_state(obj, LV_STATE_...)`` In both cases OR-ed state
values can be used as well. E.g.
:cpp:expr:`lv_obj_add_state(obj, part, LV_STATE_PRESSED | LV_PRESSED_CHECKED)`.

View File

@@ -98,7 +98,7 @@ Scrollable
----------
It's possible to make an object non-scrollable with
:cpp:expr:`lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE)`.
:cpp:expr:`lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE)`.
Non-scrollable objects can still propagate the scrolling (chain) to
their parents.

View File

@@ -336,7 +336,7 @@ notified. There are 3 options to do this:
1. If you know that the changed properties can be applied by a simple redraw
(e.g. color or opacity changes) just call :cpp:expr:`lv_obj_invalidate(obj)`
or :cpp:expr:`lv_obj_invalidate(lv_scr_act())`.
or :cpp:expr:`lv_obj_invalidate(lv_screen_active())`.
2. If more complex style properties were changed or added, and you know which
object(s) are affected by that style call :cpp:expr:`lv_obj_refresh_style(obj, part, property)`.
To refresh all parts and properties use :cpp:expr:`lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY)`.

View File

@@ -35,7 +35,7 @@ For example:
/*Do something with LVGL*/
if(something_happened) {
something_happened = false;
lv_btn_create(lv_scr_act(), NULL);
lv_btn_create(lv_screen_active(), NULL);
}
}
@@ -102,7 +102,7 @@ For example:
/*Free some resources related to `scr`*/
/*Finally delete the screen*/
lv_obj_del(scr);
lv_obj_delete(scr);
}
...
@@ -110,12 +110,12 @@ For example:
/*Do something with the object on the current screen*/
/*Delete screen on next call of `lv_timer_handler`, not right now.*/
lv_async_call(my_screen_clean_up, lv_scr_act());
lv_async_call(my_screen_clean_up, lv_screen_active());
/*The screen is still valid so you can do other things with it*/
If you just want to delete an object and don't need to clean anything up
in ``my_screen_cleanup`` you could just use :cpp:func:`lv_obj_del_async` which
in ``my_screen_cleanup`` you could just use :cpp:func:`lv_obj_delete_async` which
will delete the object on the next call to :cpp:func:`lv_timer_handler`.
API

View File

@@ -229,7 +229,7 @@ You can do this in the following way:
.. code:: c
/*Delete the original display refresh timer*/
lv_timer_del(disp->refr_timer);
lv_timer_delete(disp->refr_timer);
disp->refr_timer = NULL;

View File

@@ -245,7 +245,7 @@ You can do this in the following way:
.. code:: c
/*Delete the original input device read timer*/
lv_timer_del(indev->read_timer);
lv_timer_delete(indev->read_timer);
indev->read_timer = NULL;

View File

@@ -41,7 +41,7 @@ Here is some pseudocode to illustrate the concept:
{
/* You must always hold the mutex while using LVGL APIs */
mutex_lock(&lvgl_mutex);
lv_obj_t *img = lv_image_create(lv_scr_act());
lv_obj_t *img = lv_image_create(lv_screen_active());
mutex_unlock(&lvgl_mutex);
while(1) {

View File

@@ -96,7 +96,7 @@ the object non-clickable:
.. code:: c
lv_obj_remove_style(arc, NULL, LV_PART_KNOB);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
Advanced hit test
-----------------

View File

@@ -43,7 +43,7 @@ common state add/clear function:
.. code:: c
lv_obj_add_state(cb, LV_STATE_CHECKED); /*Make the checkbox checked*/
lv_obj_clear_state(cb, LV_STATE_CHECKED); /*MAke the checkbox unchecked*/
lv_obj_remove_state(cb, LV_STATE_CHECKED); /*MAke the checkbox unchecked*/
lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); /*Make the checkbox checked and disabled*/
To get whether the checkbox is checked or not use:

View File

@@ -46,7 +46,7 @@ they will be used in pressed state instead of the released images.
States
------
Instead of the regular ``lv_obj_add/clear_state()`` functions the
Instead of the regular ``lv_obj_add/remove_state()`` functions the
:cpp:expr:`lv_imgbtn_set_state(imgbtn, LV_IMGBTN_STATE_...)` functions should be
used to manually set a state.

View File

@@ -115,7 +115,7 @@ representing a layout that covers the entire display.
When you have created a screen like
``lv_obj_t * screen = lv_obj_create(NULL)``, you can make it active with
:cpp:expr:`lv_scr_load(screen)`. The :cpp:func:`lv_scr_act` function gives you a
:cpp:expr:`lv_screen_load(screen)`. The :cpp:func:`lv_screen_active` function gives you a
pointer to the active screen.
If you have multiple displays, it's important to know that the screen
@@ -154,7 +154,7 @@ Flags
-----
There are some attributes which can be enabled/disabled by
``lv_obj_add/clear_flag(obj, LV_OBJ_FLAG_...)``:
``lv_obj_add/remove_flag(obj, LV_OBJ_FLAG_...)``:
- :cpp:enumerator:`LV_OBJ_FLAG_HIDDEN` Make the object hidden. (Like it wasn't there at all)
- :cpp:enumerator:`LV_OBJ_FLAG_CLICKABLE` Make the object clickable by input devices
@@ -194,7 +194,7 @@ Some examples:
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
/*Make an object non-clickable*/
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
Groups
------

View File

@@ -34,7 +34,7 @@ To get the current state of the switch (with ``true`` being on), use
:cpp:expr:`lv_obj_has_state(obj, LV_STATE_CHECKED)`.
Call :cpp:expr:`lv_obj_add_state(obj, LV_STATE_CHECKED)` to turn it on, or
:cpp:expr:`lv_obj_clear_state(obj, LV_STATE_CHECKED)` to turn it off.
:cpp:expr:`lv_obj_remove_state(obj, LV_STATE_CHECKED)` to turn it off.
Events
******

View File

@@ -61,8 +61,8 @@ Delete character
----------------
To delete a character from the left of the current cursor position use
:cpp:expr:`lv_textarea_del_char(textarea)`. To delete from the right use
:cpp:expr:`lv_textarea_del_char_forward(textarea)`
:cpp:expr:`lv_textarea_delete_char(textarea)`. To delete from the right use
:cpp:expr:`lv_textarea_delete_char_forward(textarea)`
Move the cursor
---------------

View File

@@ -37,8 +37,8 @@ void pika_lvgl_lv_timer_t_set_cb(PikaObj* self, Arg* cb) {
}
void pika_lvgl_lv_timer_t__del(PikaObj* self) {
void pika_lvgl_lv_timer_t__delete(PikaObj* self) {
lv_timer_t* lv_timer = obj_getPtr(self, "lv_timer");
lv_timer_del(lv_timer);
lv_timer_delete(lv_timer);
}
#endif

View File

@@ -145,9 +145,9 @@ void pika_lvgl_PALETTE___init__(PikaObj* self) {
obj_setInt(self, "NONE", LV_PALETTE_NONE);
}
PikaObj* pika_lvgl_scr_act(PikaObj* self) {
PikaObj* pika_lvgl_screen_act(PikaObj* self) {
PikaObj* new_obj = newNormalObj(New_TinyObj);
lv_obj_t* lv_obj = lv_scr_act();
lv_obj_t* lv_obj = lv_screen_active();
obj_setPtr(new_obj, "lv_obj", lv_obj);
return new_obj;
}

View File

@@ -39,12 +39,12 @@ static void sw_event_cb(lv_event_t * e)
*/
void lv_example_anim_1(void)
{
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello animations!");
lv_obj_set_pos(label, 100, 10);
lv_obj_t * sw = lv_switch_create(lv_scr_act());
lv_obj_t * sw = lv_switch_create(lv_screen_active());
lv_obj_center(sw);
lv_obj_add_state(sw, LV_STATE_CHECKED);
lv_obj_add_event(sw, sw_event_cb, LV_EVENT_VALUE_CHANGED, label);

View File

@@ -27,12 +27,12 @@ def sw_event_cb(e,label):
# Start animation on an event
#
label = lv.label(lv.scr_act())
label = lv.label(lv.screen_active())
label.set_text("Hello animations!")
label.set_pos(100, 10)
sw = lv.switch(lv.scr_act())
sw = lv.switch(lv.screen_active())
sw.center()
sw.add_state(lv.STATE.CHECKED)
sw.add_event(lambda e: sw_event_cb(e,label), lv.EVENT.VALUE_CHANGED, None)

View File

@@ -18,7 +18,7 @@ static void anim_size_cb(void * var, int32_t v)
void lv_example_anim_2(void)
{
lv_obj_t * obj = lv_obj_create(lv_scr_act());
lv_obj_t * obj = lv_obj_create(lv_screen_active());
lv_obj_set_style_bg_color(obj, lv_palette_main(LV_PALETTE_RED), 0);
lv_obj_set_style_radius(obj, LV_RADIUS_CIRCLE, 0);

View File

@@ -8,7 +8,7 @@ def anim_size_cb(obj, v):
#
# Create a playback animation
#
obj = lv.obj(lv.scr_act())
obj = lv.obj(lv.screen_active())
obj.set_style_bg_color(lv.palette_main(lv.PALETTE.RED), 0)
obj.set_style_radius(lv.RADIUS_CIRCLE, 0)

View File

@@ -40,7 +40,7 @@ void lv_example_anim_3(void)
static lv_coord_t row_dsc[] = {30, 10, 10, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_style_pad_all(cont, 2, LV_PART_MAIN);
lv_obj_set_style_pad_column(cont, 10, LV_PART_MAIN);
lv_obj_set_style_pad_row(cont, 10, LV_PART_MAIN);
@@ -122,7 +122,7 @@ static void page_obj_init(lv_obj_t * par)
ginfo.anim_obj = lv_obj_create(par);
lv_obj_set_size(ginfo.anim_obj, 30, 30);
lv_obj_set_align(ginfo.anim_obj, LV_ALIGN_TOP_LEFT);
lv_obj_clear_flag(ginfo.anim_obj, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_remove_flag(ginfo.anim_obj, LV_OBJ_FLAG_SCROLLABLE);
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);

View File

@@ -19,7 +19,7 @@ class LvExampleAnim_3():
self.p1 = 0
self.p2 = 0
self.cont = lv.obj(lv.scr_act())
self.cont = lv.obj(lv.screen_active())
self.cont.set_style_pad_all(2, lv.PART.MAIN)
self.cont.set_style_pad_column(10, lv.PART.MAIN)
self.cont.set_style_pad_row(10, lv.PART.MAIN)
@@ -42,7 +42,7 @@ class LvExampleAnim_3():
self.anim_obj = lv.obj(par)
self.anim_obj.set_size(30, 30)
self.anim_obj.set_align(lv.ALIGN.TOP_LEFT)
self.anim_obj.clear_flag(lv.obj.FLAG.SCROLLABLE)
self.anim_obj.remove_flag(lv.obj.FLAG.SCROLLABLE)
self.anim_obj.set_style_bg_color(lv.palette_main(lv.PALETTE.RED), lv.PART.MAIN)
self.anim_obj.set_grid_cell(lv.GRID_ALIGN.START, 0, 1,lv.GRID_ALIGN.START, 0, 1)

View File

@@ -102,11 +102,11 @@ static void btn_start_event_handler(lv_event_t * e)
lv_anim_timeline_start(anim_timeline);
}
static void btn_del_event_handler(lv_event_t * e)
static void btn_delete_event_handler(lv_event_t * e)
{
LV_UNUSED(e);
if(anim_timeline) {
lv_anim_timeline_del(anim_timeline);
lv_anim_timeline_delete(anim_timeline);
anim_timeline = NULL;
}
}
@@ -136,7 +136,7 @@ static void slider_prg_event_handler(lv_event_t * e)
*/
void lv_example_anim_timeline_1(void)
{
lv_obj_t * par = lv_scr_act();
lv_obj_t * par = lv_screen_active();
lv_obj_set_flex_flow(par, LV_FLEX_FLOW_ROW);
lv_obj_set_flex_align(par, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
@@ -153,7 +153,7 @@ void lv_example_anim_timeline_1(void)
/* create btn_del */
lv_obj_t * btn_del = lv_button_create(par);
lv_obj_add_event(btn_del, btn_del_event_handler, LV_EVENT_CLICKED, NULL);
lv_obj_add_event(btn_del, btn_delete_event_handler, LV_EVENT_CLICKED, NULL);
lv_obj_add_flag(btn_del, LV_OBJ_FLAG_IGNORE_LAYOUT);
lv_obj_align(btn_del, LV_ALIGN_TOP_MID, 0, 20);

View File

@@ -7,7 +7,7 @@ class LV_ExampleAnimTimeline_1(object):
# Create an animation timeline
#
self.par = lv.scr_act()
self.par = lv.screen_active()
self.par.set_flex_flow(lv.FLEX_FLOW.ROW)
self.par.set_flex_align(lv.FLEX_ALIGN.SPACE_AROUND, lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.CENTER)
@@ -22,7 +22,7 @@ class LV_ExampleAnimTimeline_1(object):
self.label_run.center()
self.button_del = lv.button(self.par)
self.button_del.add_event(self.button_del_event_handler, lv.EVENT.CLICKED, None)
self.button_del.add_event(self.button_delete_event_handler, lv.EVENT.CLICKED, None)
self.button_del.add_flag(lv.obj.FLAG.IGNORE_LAYOUT)
self.button_del.align(lv.ALIGN.TOP_MID, 50, 20)
@@ -134,9 +134,9 @@ class LV_ExampleAnimTimeline_1(object):
self.anim_timeline.set_reverse(reverse)
self.anim_timeline.start()
def button_del_event_handler(self,e):
def button_delete_event_handler(self,e):
if self.anim_timeline:
self.anim_timeline._del()
self.anim_timeline._delete()
self.anim_timeline = None

View File

@@ -17,7 +17,7 @@ static void event_cb(lv_event_t * e)
*/
void lv_example_event_1(void)
{
lv_obj_t * btn = lv_button_create(lv_scr_act());
lv_obj_t * btn = lv_button_create(lv_screen_active());
lv_obj_set_size(btn, 100, 50);
lv_obj_center(btn);
lv_obj_add_event(btn, event_cb, LV_EVENT_CLICKED, NULL);

View File

@@ -5,7 +5,7 @@ class Event_1():
# Add click event to a button
#
button = lv.button(lv.scr_act())
button = lv.button(lv.screen_active())
button.set_size(100, 50)
button.center()
button.add_event(self.event_cb, lv.EVENT.CLICKED, None)

View File

@@ -29,7 +29,7 @@ static void event_cb(lv_event_t * e)
*/
void lv_example_event_2(void)
{
lv_obj_t * btn = lv_button_create(lv_scr_act());
lv_obj_t * btn = lv_button_create(lv_screen_active());
lv_obj_set_size(btn, 100, 50);
lv_obj_center(btn);
@@ -37,7 +37,7 @@ void lv_example_event_2(void)
lv_label_set_text(btn_label, "Click me!");
lv_obj_center(btn_label);
lv_obj_t * info_label = lv_label_create(lv_scr_act());
lv_obj_t * info_label = lv_label_create(lv_screen_active());
lv_label_set_text(info_label, "The last button event:\nNone");
lv_obj_add_event(btn, event_cb, LV_EVENT_ALL, info_label);

View File

@@ -8,7 +8,7 @@ def event_cb(e,label):
label.set_text("The last button event:\nLV_EVENT_LONG_PRESSED")
elif code == lv.EVENT.LONG_PRESSED_REPEAT:
label.set_text("The last button event:\nLV_EVENT_LONG_PRESSED_REPEAT")
button = lv.button(lv.scr_act())
button = lv.button(lv.screen_active())
button.set_size(100, 50)
button.center()
@@ -16,7 +16,7 @@ button_label = lv.label(button)
button_label.set_text("Click me!")
button_label.center()
info_label = lv.label(lv.scr_act())
info_label = lv.label(lv.screen_active())
info_label.set_text("The last button event:\nNone")
button.add_event(lambda e: event_cb(e,info_label), lv.EVENT.ALL, None)

View File

@@ -22,7 +22,7 @@ static void event_cb(lv_event_t * e)
void lv_example_event_3(void)
{
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 290, 200);
lv_obj_center(cont);
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);

View File

@@ -17,7 +17,7 @@ def event_cb(e):
# Demonstrate event bubbling
#
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(290, 200)
cont.center()
cont.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)

View File

@@ -47,7 +47,7 @@ static void event_cb(lv_event_t * e)
*/
void lv_example_event_4(void)
{
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 200, 200);
lv_obj_center(cont);
lv_obj_add_event(cont, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);

View File

@@ -6,7 +6,7 @@ class LV_Example_Event_4:
#
self.size = 0
self.size_dec = False
self.cont = lv.obj(lv.scr_act())
self.cont = lv.obj(lv.screen_active())
self.cont.set_size(200, 200)
self.cont.center()
self.cont.add_event(self.event_cb, lv.EVENT.DRAW_TASK_ADDED, None)

View File

@@ -7,12 +7,12 @@
void lv_example_get_started_1(void)
{
/*Change the active screen's background color*/
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x003a57), LV_PART_MAIN);
/*Create a white label, set its text and align it to the center*/
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello world");
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xffffff), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}

View File

@@ -1,9 +1,9 @@
# Change the active screen's background color
scr = lv.scr_act()
scr = lv.screen_active()
scr.set_style_bg_color(lv.color_hex(0x003a57), lv.PART.MAIN)
# Create a white label, set its text and align it to the center
label = lv.label(lv.scr_act())
label = lv.label(lv.screen_active())
label.set_text("Hello world")
label.set_style_text_color(lv.color_hex(0xffffff), lv.PART.MAIN)
label.align(lv.ALIGN.CENTER, 0, 0)

View File

@@ -20,7 +20,7 @@ static void btn_event_cb(lv_event_t * e)
*/
void lv_example_get_started_2(void)
{
lv_obj_t * btn = lv_button_create(lv_scr_act()); /*Add a button the current screen*/
lv_obj_t * btn = lv_button_create(lv_screen_active()); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 120, 50); /*Set its size*/
lv_obj_add_event(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/

View File

@@ -5,7 +5,7 @@ class CounterBtn():
# Create a button with a label and react on click event.
#
button = lv.button(lv.scr_act()) # Add a button the current screen
button = lv.button(lv.screen_active()) # Add a button the current screen
button.set_pos(10, 10) # Set its position
button.set_size(120, 50) # Set its size
button.align(lv.ALIGN.CENTER,0,0)

View File

@@ -50,7 +50,7 @@ void lv_example_get_started_3(void)
style_init();
/*Create a button and use the new styles*/
lv_obj_t * btn = lv_button_create(lv_scr_act());
lv_obj_t * btn = lv_button_create(lv_screen_active());
/* Remove the styles coming from the theme
* Note that size and position are also stored as style properties
* so lv_obj_remove_style_all will remove the set size and position too */
@@ -66,7 +66,7 @@ void lv_example_get_started_3(void)
lv_obj_center(label);
/*Create another button and use the red style too*/
lv_obj_t * btn2 = lv_button_create(lv_scr_act());
lv_obj_t * btn2 = lv_button_create(lv_screen_active());
lv_obj_remove_style_all(btn2); /*Remove the styles coming from the theme*/
lv_obj_set_pos(btn2, 10, 80);
lv_obj_set_size(btn2, 120, 50);

View File

@@ -32,7 +32,7 @@ style_button_pressed.set_bg_color(lv.palette_main(lv.PALETTE.BLUE))
style_button_pressed.set_bg_grad_color(lv.palette_darken(lv.PALETTE.RED, 3))
# Create a button and use the new styles
button = lv.button(lv.scr_act()) # Add a button the current screen
button = lv.button(lv.screen_active()) # Add a button the current screen
# Remove the styles coming from the theme
# Note that size and position are also stored as style properties
# so lv_obj_remove_style_all will remove the set size and position too
@@ -47,12 +47,12 @@ label.set_text("Button") # Set the labels text
label.center()
# Create a slider in the center of the display
slider = lv.slider(lv.scr_act())
slider = lv.slider(lv.screen_active())
slider.set_width(200) # Set the width
slider.center() # Align to the center of the parent (screen)
# Create another button and use the red style too
button2 = lv.button(lv.scr_act())
button2 = lv.button(lv.screen_active())
button2.remove_style_all() # Remove the styles coming from the theme
button2.set_pos(10, 80) # Set its position
button2.set_size(120, 50) # Set its size

View File

@@ -18,13 +18,13 @@ static void slider_event_cb(lv_event_t * e)
void lv_example_get_started_4(void)
{
/*Create a slider in the center of the display*/
lv_obj_t * slider = lv_slider_create(lv_scr_act());
lv_obj_t * slider = lv_slider_create(lv_screen_active());
lv_obj_set_width(slider, 200); /*Set the width*/
lv_obj_center(slider); /*Align to the center of the parent (screen)*/
lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Assign an event function*/
/*Create a label above the slider*/
label = lv_label_create(lv_scr_act());
label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "0");
lv_obj_align_to(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align top of the slider*/
}

View File

@@ -9,13 +9,13 @@ def slider_event_cb(e):
#
# Create a slider in the center of the display
slider = lv.slider(lv.scr_act())
slider = lv.slider(lv.screen_active())
slider.set_width(200) # Set the width
slider.center() # Align to the center of the parent (screen)
slider.add_event(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) # Assign an event function
# Create a label above the slider
label = lv.label(lv.scr_act())
label = lv.label(lv.screen_active())
label.set_text("0")
label.align_to(slider, lv.ALIGN.OUT_TOP_MID, 0, -15) # Align below the slider

View File

@@ -7,13 +7,13 @@
void lv_example_flex_1(void)
{
/*Create a container with ROW flex direction*/
lv_obj_t * cont_row = lv_obj_create(lv_scr_act());
lv_obj_t * cont_row = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont_row, 300, 75);
lv_obj_align(cont_row, LV_ALIGN_TOP_MID, 0, 5);
lv_obj_set_flex_flow(cont_row, LV_FLEX_FLOW_ROW);
/*Create a container with COLUMN flex direction*/
lv_obj_t * cont_col = lv_obj_create(lv_scr_act());
lv_obj_t * cont_col = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont_col, 200, 150);
lv_obj_align_to(cont_col, cont_row, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
lv_obj_set_flex_flow(cont_col, LV_FLEX_FLOW_COLUMN);

View File

@@ -3,13 +3,13 @@
#
# Create a container with ROW flex direction
cont_row = lv.obj(lv.scr_act())
cont_row = lv.obj(lv.screen_active())
cont_row.set_size(300, 75)
cont_row.align(lv.ALIGN.TOP_MID, 0, 5)
cont_row.set_flex_flow(lv.FLEX_FLOW.ROW)
# Create a container with COLUMN flex direction
cont_col = lv.obj(lv.scr_act())
cont_col = lv.obj(lv.screen_active())
cont_col.set_size(200, 150)
cont_col.align_to(cont_row, lv.ALIGN.OUT_BOTTOM_MID, 0, 5)
cont_col.set_flex_flow(lv.FLEX_FLOW.COLUMN)

View File

@@ -12,7 +12,7 @@ void lv_example_flex_2(void)
lv_style_set_flex_main_place(&style, LV_FLEX_ALIGN_SPACE_EVENLY);
lv_style_set_layout(&style, LV_LAYOUT_FLEX);
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_add_style(cont, &style, 0);

View File

@@ -7,7 +7,7 @@ style.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)
style.set_flex_main_place(lv.FLEX_ALIGN.SPACE_EVENLY)
style.set_layout(lv.LAYOUT.FLEX)
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(300, 220)
cont.center()
cont.add_style(style, 0)

View File

@@ -6,7 +6,7 @@
*/
void lv_example_flex_3(void)
{
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW);

View File

@@ -2,7 +2,7 @@
# Demonstrate flex grow.
#
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(300, 220)
cont.center()
cont.set_flex_flow(lv.FLEX_FLOW.ROW)

View File

@@ -7,7 +7,7 @@
void lv_example_flex_4(void)
{
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN_REVERSE);

View File

@@ -1,7 +1,7 @@
#
# Reverse the order of flex items
#
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(300, 220)
cont.center()
cont.set_flex_flow(lv.FLEX_FLOW.COLUMN_REVERSE)

View File

@@ -16,7 +16,7 @@ static void column_gap_anim(void * obj, int32_t v)
*/
void lv_example_flex_5(void)
{
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);

View File

@@ -9,7 +9,7 @@ def column_gap_anim(obj, v):
# Demonstrate the effect of column and row gap style properties
#
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(300, 220)
cont.center()
cont.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP)

View File

@@ -7,7 +7,7 @@
*/
void lv_example_flex_6(void)
{
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_style_base_dir(cont, LV_BASE_DIR_RTL, 0);
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);

View File

@@ -3,7 +3,7 @@
# Also demonstrate how horizontal scrolling works with RTL.
#
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_style_base_dir(lv.BASE_DIR.RTL,0)
cont.set_size(300, 220)
cont.center()

View File

@@ -10,7 +10,7 @@ void lv_example_grid_1(void)
static lv_coord_t row_dsc[] = {50, 50, 50, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_style_grid_column_dsc_array(cont, col_dsc, 0);
lv_obj_set_style_grid_row_dsc_array(cont, row_dsc, 0);
lv_obj_set_size(cont, 300, 220);

View File

@@ -6,7 +6,7 @@ col_dsc = [70, 70, 70, lv.GRID_TEMPLATE_LAST]
row_dsc = [50, 50, 50, lv.GRID_TEMPLATE_LAST]
# Create a container with grid
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_style_grid_column_dsc_array(col_dsc, 0)
cont.set_style_grid_row_dsc_array(row_dsc, 0)
cont.set_size(300, 220)

View File

@@ -11,7 +11,7 @@ void lv_example_grid_2(void)
static lv_coord_t row_dsc[] = {50, 50, 50, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);

View File

@@ -6,7 +6,7 @@ col_dsc = [70, 70, 70, lv.GRID_TEMPLATE_LAST]
row_dsc = [50, 50, 50, lv.GRID_TEMPLATE_LAST]
# Create a container with grid
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_grid_dsc_array(col_dsc, row_dsc)
cont.set_size(300, 220)
cont.center()

View File

@@ -17,7 +17,7 @@ void lv_example_grid_3(void)
static lv_coord_t row_dsc[] = {50, LV_GRID_FR(1), 50, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);

View File

@@ -15,7 +15,7 @@ col_dsc = [60, lv.grid_fr(1), lv.grid_fr(2), lv.GRID_TEMPLATE_LAST]
row_dsc = [40, lv.grid_fr(1), 40, lv.GRID_TEMPLATE_LAST]
# Create a container with grid
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(300, 220)
cont.center()
cont.set_grid_dsc_array(col_dsc, row_dsc)

View File

@@ -13,7 +13,7 @@ void lv_example_grid_4(void)
/*Add space between the columns and move the rows to the bottom (end)*/
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_grid_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, LV_GRID_ALIGN_END);
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);
lv_obj_set_size(cont, 300, 220);

View File

@@ -9,7 +9,7 @@ row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
# Add space between the columns and move the rows to the bottom (end)
# Create a container with grid
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_grid_align(lv.GRID_ALIGN.SPACE_BETWEEN, lv.GRID_ALIGN.END)
cont.set_grid_dsc_array(col_dsc, row_dsc)
cont.set_size(300, 220)

View File

@@ -22,7 +22,7 @@ void lv_example_grid_5(void)
static lv_coord_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_set_grid_dsc_array(cont, col_dsc, row_dsc);

View File

@@ -13,7 +13,7 @@ col_dsc = [60, 60, 60, lv.GRID_TEMPLATE_LAST]
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
# Create a container with grid
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(300, 220)
cont.center()
cont.set_grid_dsc_array(col_dsc, row_dsc)

View File

@@ -11,7 +11,7 @@ void lv_example_grid_6(void)
static lv_coord_t row_dsc[] = {45, 45, 45, LV_GRID_TEMPLATE_LAST};
/*Create a container with grid*/
lv_obj_t * cont = lv_obj_create(lv_scr_act());
lv_obj_t * cont = lv_obj_create(lv_screen_active());
lv_obj_set_size(cont, 300, 220);
lv_obj_center(cont);
lv_obj_set_style_base_dir(cont, LV_BASE_DIR_RTL, 0);

View File

@@ -5,7 +5,7 @@ col_dsc = [60, 60, 60, lv.GRID_TEMPLATE_LAST]
row_dsc = [40, 40, 40, lv.GRID_TEMPLATE_LAST]
# Create a container with grid
cont = lv.obj(lv.scr_act())
cont = lv.obj(lv.screen_active())
cont.set_size(300, 220)
cont.center()
cont.set_style_base_dir(lv.BASE_DIR.RTL,0)

View File

@@ -9,7 +9,7 @@ void lv_example_barcode_1(void)
lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
lv_obj_t * barcode = lv_barcode_create(lv_scr_act());
lv_obj_t * barcode = lv_barcode_create(lv_screen_active());
lv_obj_set_height(barcode, 50);
lv_obj_center(barcode);

View File

@@ -5,7 +5,7 @@ import display_driver
bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
barcode = lv.barcode(lv.scr_act())
barcode = lv.barcode(lv.screen_active())
barcode.set_height(50)
barcode.center()

View File

@@ -6,7 +6,7 @@
*/
void lv_example_bmp_1(void)
{
lv_obj_t * img = lv_image_create(lv_scr_act());
lv_obj_t * img = lv_image_create(lv_screen_active());
/* Assuming a File system is attached to letter 'A'
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
lv_image_set_src(img, "A:lvgl/examples/libs/bmp/example_32bit.bmp");

Some files were not shown because too many files have changed in this diff Show More