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

@@ -31,7 +31,7 @@ static void file_explorer_event_handler(lv_event_t * e)
void lv_example_file_explorer_1(void)
{
lv_obj_t * file_explorer = lv_file_explorer_create(lv_scr_act());
lv_obj_t * file_explorer = lv_file_explorer_create(lv_screen_active());
lv_file_explorer_set_sort(file_explorer, LV_EXPLORER_SORT_KIND);
#if LV_USE_FS_WIN32

View File

@@ -16,7 +16,7 @@ def file_explorer_event_handler(e) :
# print("cur_path: " + str(cur_path), " sel_fn: " + str(sel_fn))
print(str(cur_path) + str(sel_fn))
file_explorer = lv.file_explorer(lv.scr_act())
file_explorer = lv.file_explorer(lv.screen_active())
file_explorer.explorer_set_sort(lv.EXPLORER_SORT.KIND)

View File

@@ -39,7 +39,7 @@ static void btn_event_handler(lv_event_t * e)
if(lv_obj_has_state(btn, LV_STATE_CHECKED))
lv_obj_add_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
else
lv_obj_clear_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
lv_obj_remove_flag(file_explorer, LV_OBJ_FLAG_HIDDEN);
}
}
@@ -63,7 +63,7 @@ static void dd_event_handler(lv_event_t * e)
void lv_example_file_explorer_2(void)
{
lv_obj_t * file_explorer = lv_file_explorer_create(lv_scr_act());
lv_obj_t * file_explorer = lv_file_explorer_create(lv_screen_active());
#if LV_USE_FS_WIN32
lv_file_explorer_open_dir(file_explorer, "D:");

View File

@@ -24,7 +24,7 @@ def button_event_handler(e,fe_quick_access_obj):
if button.has_state(lv.STATE.CHECKED) :
fe_quick_access_obj.add_flag(lv.obj.FLAG.HIDDEN)
else :
fe_quick_access_obj.clear_flag(lv.obj.FLAG.HIDDEN)
fe_quick_access_obj.remove_flag(lv.obj.FLAG.HIDDEN)
def dd_event_handler(e, file_explorer):
@@ -43,7 +43,7 @@ def dd_event_handler(e, file_explorer):
# print("set sort to KIND")
file_explorer.explorer_set_sort(lv.EXPLORER_SORT.KIND)
file_explorer = lv.file_explorer(lv.scr_act())
file_explorer = lv.file_explorer(lv.screen_active())
if LV_USE_FS_WIN32 :
file_explorer.explorer_open_dir("D:")

View File

@@ -75,7 +75,7 @@ static void file_explorer_event_handler(lv_event_t * e)
void lv_example_file_explorer_3(void)
{
lv_obj_t * file_explorer = lv_file_explorer_create(lv_scr_act());
lv_obj_t * file_explorer = lv_file_explorer_create(lv_screen_active());
/*Before custom sort, please set the default sorting to NONE. The default is NONE.*/
lv_file_explorer_set_sort(file_explorer, LV_EXPLORER_SORT_NONE);

View File

@@ -57,11 +57,11 @@ def file_explorer_event_handler(e) :
# print("sum: ",sum)
sort_by_file_kind(tb, 0, (sum - 1));
file_explorer = lv.file_explorer(lv.scr_act())
file_explorer = lv.file_explorer(lv.screen_active())
# Before custom sort, please set the default sorting to NONE. The default is NONE.
file_explorer.explorer_set_sort(lv.EXPLORER_SORT.NONE)
file_explorer = lv.file_explorer(lv.scr_act())
file_explorer = lv.file_explorer(lv.screen_active())
if LV_USE_FS_WIN32 :
file_explorer.explorer_open_dir("D:")

View File

@@ -10,7 +10,7 @@ static void sample_fragment_ctor(lv_fragment_t * self, void * args);
static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent);
static void sample_container_del(lv_event_t * e);
static void sample_container_delete(lv_event_t * e);
static lv_obj_t * root = NULL;
@@ -27,11 +27,11 @@ static const lv_fragment_class_t sample_cls = {
void lv_example_fragment_1(void)
{
root = lv_obj_create(lv_scr_act());
root = lv_obj_create(lv_screen_active());
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
/* Clean up the fragment manager before objects in containers got deleted */
lv_obj_add_event(root, sample_container_del, LV_EVENT_DELETE, manager);
lv_obj_add_event(root, sample_container_delete, LV_EVENT_DELETE, manager);
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, "Fragment");
lv_fragment_manager_replace(manager, fragment, &root);
@@ -51,10 +51,10 @@ static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * pa
return label;
}
static void sample_container_del(lv_event_t * e)
static void sample_container_delete(lv_event_t * e)
{
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
lv_fragment_manager_del(manager);
lv_fragment_manager_delete(manager);
}
#endif

View File

@@ -14,7 +14,7 @@ static void sample_push_click(lv_event_t * e);
static void sample_pop_click(lv_event_t * e);
static void sample_container_del(lv_event_t * e);
static void sample_container_delete(lv_event_t * e);
static void sample_fragment_inc_click(lv_event_t * e);
@@ -35,7 +35,7 @@ static lv_obj_t * container = NULL;
void lv_example_fragment_2(void)
{
lv_obj_t * root = lv_obj_create(lv_scr_act());
lv_obj_t * root = lv_obj_create(lv_screen_active());
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
lv_obj_set_layout(root, LV_LAYOUT_GRID);
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
@@ -57,7 +57,7 @@ void lv_example_fragment_2(void)
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
/* Clean up the fragment manager before objects in containers got deleted */
lv_obj_add_event(root, sample_container_del, LV_EVENT_DELETE, manager);
lv_obj_add_event(root, sample_container_delete, LV_EVENT_DELETE, manager);
int depth = 0;
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, &depth);
@@ -111,10 +111,10 @@ static void sample_pop_click(lv_event_t * e)
lv_fragment_manager_pop(manager);
}
static void sample_container_del(lv_event_t * e)
static void sample_container_delete(lv_event_t * e)
{
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
lv_fragment_manager_del(manager);
lv_fragment_manager_delete(manager);
}
static void sample_fragment_inc_click(lv_event_t * e)

View File

@@ -9,7 +9,7 @@ void lv_example_gridnav_1(void)
/*It's assumed that the default group is set and
*there is a keyboard indev*/
lv_obj_t * cont1 = lv_obj_create(lv_scr_act());
lv_obj_t * cont1 = lv_obj_create(lv_screen_active());
lv_gridnav_add(cont1, LV_GRIDNAV_CTRL_NONE);
/*Use flex here, but works with grid or manually placed objects as well*/
@@ -37,7 +37,7 @@ void lv_example_gridnav_1(void)
/* Create a second container with rollover grid nav mode.*/
lv_obj_t * cont2 = lv_obj_create(lv_scr_act());
lv_obj_t * cont2 = lv_obj_create(lv_screen_active());
lv_gridnav_add(cont2, LV_GRIDNAV_CTRL_ROLLOVER);
lv_obj_set_style_bg_color(cont2, lv_palette_lighten(LV_PALETTE_BLUE, 5), LV_STATE_FOCUSED);
lv_obj_set_size(cont2, lv_pct(50), lv_pct(100));

View File

@@ -4,7 +4,7 @@
# It's assumed that the default group is set and
# there is a keyboard indev
cont1 = lv.obj(lv.scr_act())
cont1 = lv.obj(lv.screen_active())
lv.gridnav_add(cont1, lv.GRIDNAV_CTRL.NONE)
# Use flex here, but works with grid or manually placed objects as well
@@ -30,7 +30,7 @@ for i in range(10):
# Create a second container with rollover grid nav mode.
cont2 = lv.obj(lv.scr_act())
cont2 = lv.obj(lv.screen_active())
lv.gridnav_add(cont2,lv.GRIDNAV_CTRL.ROLLOVER)
cont2.set_style_bg_color(lv.palette_lighten(lv.PALETTE.BLUE, 5), lv.STATE.FOCUSED)
cont2.set_size(lv.pct(50), lv.pct(100))

View File

@@ -9,7 +9,7 @@ void lv_example_gridnav_2(void)
/*It's assumed that the default group is set and
*there is a keyboard indev*/
lv_obj_t * list1 = lv_list_create(lv_scr_act());
lv_obj_t * list1 = lv_list_create(lv_screen_active());
lv_gridnav_add(list1, LV_GRIDNAV_CTRL_NONE);
lv_obj_set_size(list1, lv_pct(45), lv_pct(80));
lv_obj_align(list1, LV_ALIGN_LEFT_MID, 5, 0);
@@ -26,7 +26,7 @@ void lv_example_gridnav_2(void)
lv_group_remove_obj(item); /*Not needed, we use the gridnav instead*/
}
lv_obj_t * list2 = lv_list_create(lv_scr_act());
lv_obj_t * list2 = lv_list_create(lv_screen_active());
lv_gridnav_add(list2, LV_GRIDNAV_CTRL_ROLLOVER);
lv_obj_set_size(list2, lv_pct(45), lv_pct(80));
lv_obj_align(list2, LV_ALIGN_RIGHT_MID, -5, 0);

View File

@@ -4,7 +4,7 @@
# It's assumed that the default group is set and
# there is a keyboard indev
list1 = lv.list(lv.scr_act())
list1 = lv.list(lv.screen_active())
lv.gridnav_add(list1, lv.GRIDNAV_CTRL.NONE)
list1.set_size(lv.pct(45), lv.pct(80))
list1.align(lv.ALIGN.LEFT_MID, 5, 0)
@@ -17,7 +17,7 @@ for i in range(15):
item.set_style_bg_opa(0, 0)
lv.group_remove_obj(item) # Not needed, we use the gridnav instead
list2 = lv.list(lv.scr_act())
list2 = lv.list(lv.screen_active())
lv.gridnav_add(list2, lv.GRIDNAV_CTRL.ROLLOVER)
list2.set_size(lv.pct(45), lv.pct(80))
list2.align(lv.ALIGN.RIGHT_MID, -5, 0)

View File

@@ -22,7 +22,7 @@ void lv_example_gridnav_3(void)
/*It's assumed that the default group is set and
*there is a keyboard indev*/
lv_obj_t * cont_main = lv_obj_create(lv_scr_act());
lv_obj_t * cont_main = lv_obj_create(lv_screen_active());
lv_gridnav_add(cont_main, LV_GRIDNAV_CTRL_ROLLOVER | LV_GRIDNAV_CTRL_SCROLL_FIRST);
/*Only the container needs to be in a group*/

View File

@@ -13,7 +13,7 @@ def cont_sub_event_cb(e):
# It's assumed that the default group is set and
# there is a keyboard indev*/
cont_main = lv.obj(lv.scr_act())
cont_main = lv.obj(lv.screen_active())
lv.gridnav_add(cont_main,lv.GRIDNAV_CTRL.ROLLOVER | lv.GRIDNAV_CTRL.SCROLL_FIRST)
# Only the container needs to be in a group

View File

@@ -17,7 +17,7 @@ void lv_example_gridnav_4(void)
/*It's assumed that the default group is set and
*there is a keyboard indev*/
lv_obj_t * list = lv_list_create(lv_scr_act());
lv_obj_t * list = lv_list_create(lv_screen_active());
lv_gridnav_add(list, LV_GRIDNAV_CTRL_ROLLOVER);
lv_obj_align(list, LV_ALIGN_LEFT_MID, 10, 0);
lv_group_add_obj(lv_group_get_default(), list);
@@ -38,7 +38,7 @@ void lv_example_gridnav_4(void)
lv_group_remove_obj(item); /*The default group adds it automatically*/
}
lv_obj_t * btn = lv_button_create(lv_scr_act());
lv_obj_t * btn = lv_button_create(lv_screen_active());
lv_obj_align(btn, LV_ALIGN_RIGHT_MID, -10, 0);
lv_obj_t * label = lv_label_create(btn);
lv_label_set_text(label, "Button");

View File

@@ -10,7 +10,7 @@ def event_handler(e):
# It's assumed that the default group is set and
# there is a keyboard indev
list = lv.list(lv.scr_act())
list = lv.list(lv.screen_active())
lv.gridnav_add(list, lv.GRIDNAV_CTRL.ROLLOVER)
list.align(lv.ALIGN.LEFT_MID, 0, 10)
lv.group_get_default().add_obj(list)
@@ -29,7 +29,7 @@ for i in range(20):
item.add_event(event_handler, lv.EVENT.CLICKED, None)
lv.group_remove_obj(item) # The default group adds it automatically
button = lv.button(lv.scr_act())
button = lv.button(lv.screen_active())
button.align(lv.ALIGN.RIGHT_MID, 0, -10)
label = lv.label(button)
label.set_text("Button")

View File

@@ -10,30 +10,30 @@ static void ta_event_cb(lv_event_t * e)
if(code == LV_EVENT_FOCUSED) {
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
lv_keyboard_set_textarea(kb, ta);
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
}
}
else if(code == LV_EVENT_CANCEL) {
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_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*/
}
}
void lv_example_ime_pinyin_1(void)
{
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_scr_act());
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_screen_active());
lv_obj_set_style_text_font(pinyin_ime, &lv_font_simsun_16_cjk, 0);
//lv_ime_pinyin_set_dict(pinyin_ime, your_dict); // Use a custom dictionary. If it is not set, the built-in dictionary will be used.
/* ta1 */
lv_obj_t * ta1 = lv_textarea_create(lv_scr_act());
lv_obj_t * ta1 = lv_textarea_create(lv_screen_active());
lv_textarea_set_one_line(ta1, true);
lv_obj_set_style_text_font(ta1, &lv_font_simsun_16_cjk, 0);
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 0, 0);
/*Create a keyboard and add it to ime_pinyin*/
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
lv_ime_pinyin_set_keyboard(pinyin_ime, kb);
lv_keyboard_set_textarea(kb, ta1);
@@ -45,7 +45,7 @@ void lv_example_ime_pinyin_1(void)
lv_obj_align_to(cand_panel, kb, LV_ALIGN_OUT_TOP_MID, 0, 0);
/*Try using ime_pinyin to output the Chinese below in the ta1 above*/
lv_obj_t * cz_label = lv_label_create(lv_scr_act());
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
lv_label_set_text(cz_label,
"嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);

View File

@@ -7,10 +7,10 @@ def ta_event_cb(e,kb):
if code == lv.EVENT.FOCUSED:
if lv.indev_get_act() != None and lv.indev_get_act().get_type() != lv.INDEV_TYPE.KEYPAD :
kb.set_textarea(ta)
kb.clear_flag(lv.obj.FLAG.HIDDEN)
kb.remove_flag(lv.obj.FLAG.HIDDEN)
elif code == lv.EVENT.CANCEL:
kb.add_flag(lv.obj.FLAG.HIDDEN)
ta.clear_state(ta, LV_STATE_FOCUSED);
ta.remove_state(ta, LV_STATE_FOCUSED);
lv.indev_reset(None, ta) # To forget the last clicked object to make it focusable again
fs_drv = lv.fs_drv_t()
@@ -19,18 +19,18 @@ font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt
if font_simsun_16_cjk == None:
print("Error when loading chinese font")
pinyin_ime = lv.ime_pinyin(lv.scr_act())
pinyin_ime = lv.ime_pinyin(lv.screen_active())
pinyin_ime.set_style_text_font(font_simsun_16_cjk, 0)
# pinyin_ime.pinyin_set_dict(your_dict) # Use a custom dictionary. If it is not set, the built-in dictionary will be used.
# ta1
ta1 = lv.textarea(lv.scr_act())
ta1 = lv.textarea(lv.screen_active())
ta1.set_one_line(True)
ta1.set_style_text_font(font_simsun_16_cjk, 0)
ta1.align(lv.ALIGN.TOP_LEFT, 0, 0)
# Create a keyboard and add it to ime_pinyin
kb = lv.keyboard(lv.scr_act())
kb = lv.keyboard(lv.screen_active())
pinyin_ime.pinyin_set_keyboard(kb)
kb.set_textarea(ta1)
@@ -42,7 +42,7 @@ cand_panel.set_size(lv.pct(100), lv.pct(10))
cand_panel.align_to(kb, lv.ALIGN.OUT_TOP_MID, 0, 0)
# Try using ime_pinyin to output the Chinese below in the ta1 above
cz_label = lv.label(lv.scr_act())
cz_label = lv.label(lv.screen_active())
cz_label.set_text("嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
cz_label.set_width(310)

View File

@@ -10,30 +10,30 @@ static void ta_event_cb(lv_event_t * e)
if(code == LV_EVENT_FOCUSED) {
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
lv_keyboard_set_textarea(kb, ta);
lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
}
}
else if(code == LV_EVENT_READY) {
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_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*/
}
}
void lv_example_ime_pinyin_2(void)
{
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_scr_act());
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_screen_active());
lv_obj_set_style_text_font(pinyin_ime, &lv_font_simsun_16_cjk, 0);
//lv_ime_pinyin_set_dict(pinyin_ime, your_dict); // Use a custom dictionary. If it is not set, the built-in dictionary will be used.
/* ta1 */
lv_obj_t * ta1 = lv_textarea_create(lv_scr_act());
lv_obj_t * ta1 = lv_textarea_create(lv_screen_active());
lv_textarea_set_one_line(ta1, true);
lv_obj_set_style_text_font(ta1, &lv_font_simsun_16_cjk, 0);
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 0, 0);
/*Create a keyboard and add it to ime_pinyin*/
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
lv_keyboard_set_textarea(kb, ta1);
lv_ime_pinyin_set_keyboard(pinyin_ime, kb);
@@ -47,7 +47,7 @@ void lv_example_ime_pinyin_2(void)
lv_obj_align_to(cand_panel, kb, LV_ALIGN_OUT_TOP_MID, 0, 0);
/*Try using ime_pinyin to output the Chinese below in the ta1 above*/
lv_obj_t * cz_label = lv_label_create(lv_scr_act());
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
lv_label_set_text(cz_label,
"嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);

View File

@@ -7,10 +7,10 @@ def ta_event_cb(e,kb):
if code == lv.EVENT.FOCUSED:
if lv.indev_get_act() != None and lv.indev_get_act().get_type() != lv.INDEV_TYPE.KEYPAD :
kb.set_textarea(ta)
kb.clear_flag(lv.obj.FLAG.HIDDEN)
kb.remove_flag(lv.obj.FLAG.HIDDEN)
elif code == lv.EVENT.READY:
kb.add_flag(lv.obj.FLAG.HIDDEN)
ta.clear_state(ta, LV_STATE_FOCUSED);
ta.remove_state(ta, LV_STATE_FOCUSED);
lv.indev_reset(None, ta) # To forget the last clicked object to make it focusable again
fs_drv = lv.fs_drv_t()
@@ -19,18 +19,18 @@ font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt
if font_simsun_16_cjk == None:
print("Error when loading chinese font")
pinyin_ime = lv.ime_pinyin(lv.scr_act())
pinyin_ime = lv.ime_pinyin(lv.screen_active())
pinyin_ime.set_style_text_font(font_simsun_16_cjk, 0)
# pinyin_ime.pinyin_set_dict(your_dict) # Use a custom dictionary. If it is not set, the built-in dictionary will be used.
# ta1
ta1 = lv.textarea(lv.scr_act())
ta1 = lv.textarea(lv.screen_active())
ta1.set_one_line(True)
ta1.set_style_text_font(font_simsun_16_cjk, 0)
ta1.align(lv.ALIGN.TOP_LEFT, 0, 0)
# Create a keyboard and add it to ime_pinyin
kb = lv.keyboard(lv.scr_act())
kb = lv.keyboard(lv.screen_active())
kb.set_textarea(ta1)
pinyin_ime.pinyin_set_keyboard(kb)
@@ -44,7 +44,7 @@ cand_panel.set_size(lv.pct(100), lv.pct(10))
cand_panel.align_to(kb, lv.ALIGN.OUT_TOP_MID, 0, 0)
# Try using ime_pinyin to output the Chinese below in the ta1 above
cz_label = lv.label(lv.scr_act())
cz_label = lv.label(lv.screen_active())
cz_label.set_text("嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
cz_label.set_width(310)

View File

@@ -43,7 +43,7 @@ void lv_example_imgfont_1(void)
imgfont->fallback = LV_FONT_DEFAULT;
lv_obj_t * label1 = lv_label_create(lv_scr_act());
lv_obj_t * label1 = lv_label_create(lv_screen_active());
lv_label_set_text(label1, "12\uF600\uF617AB");
lv_obj_set_style_text_font(label1, imgfont, LV_PART_MAIN);
lv_obj_center(label1);
@@ -52,7 +52,7 @@ void lv_example_imgfont_1(void)
void lv_example_imgfont_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, "imgfont is not installed");
lv_obj_center(label);
}

View File

@@ -11,12 +11,12 @@ void lv_example_observer_1(void)
lv_subject_init_int(&temperature_subject, 28);
/*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_center(slider);
lv_slider_bind_value(slider, &temperature_subject);
/*Create a label below the slider*/
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_obj_align(label, LV_ALIGN_CENTER, 0, 30);
lv_label_bind_text(label, &temperature_subject, "%d °C");
}

View File

@@ -94,7 +94,7 @@ static void ui_init(void)
lv_subject_init_int(&auth_state_subject, LOGGED_OUT);
/*Create a slider in the center of the display*/
lv_obj_t * ta = lv_textarea_create(lv_scr_act());
lv_obj_t * ta = lv_textarea_create(lv_screen_active());
lv_obj_set_pos(ta, 10, 10);
lv_obj_set_width(ta, 200);
lv_textarea_set_one_line(ta, true);
@@ -103,14 +103,14 @@ static void ui_init(void)
lv_obj_add_event(ta, textarea_event_cb, LV_EVENT_READY, NULL);
lv_obj_bind_state_if_eq(ta, &auth_state_subject, LV_STATE_DISABLED, LOGGED_IN);
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
lv_obj_t * kb = lv_keyboard_create(lv_screen_active());
lv_keyboard_set_textarea(kb, ta);
lv_obj_t * btn;
lv_obj_t * label;
/*Create a log out button which will be active only when logged in*/
btn = lv_button_create(lv_scr_act());
btn = lv_button_create(lv_screen_active());
lv_obj_set_pos(btn, 220, 10);
lv_obj_add_event(btn, log_out_click_event_cb, LV_EVENT_CLICKED, NULL);
lv_obj_bind_state_if_not_eq(btn, &auth_state_subject, LV_STATE_DISABLED, LOGGED_IN);
@@ -119,12 +119,12 @@ static void ui_init(void)
lv_label_set_text(label, "LOG OUT");
/*Create a label to show info*/
label = lv_label_create(lv_scr_act());
label = lv_label_create(lv_screen_active());
lv_obj_set_pos(label, 10, 60);
lv_subject_add_observer_obj(&auth_state_subject, info_label_observer_cb, label, NULL);
/*Create button which will be active only when logged in*/
btn = lv_button_create(lv_scr_act());
btn = lv_button_create(lv_screen_active());
lv_obj_set_pos(btn, 10, 80);
lv_obj_add_flag(btn, LV_OBJ_FLAG_CHECKABLE);
lv_obj_bind_state_if_not_eq(btn, &auth_state_subject, LV_STATE_DISABLED, LOGGED_IN);

View File

@@ -48,12 +48,12 @@ void lv_example_observer_3(void)
lv_subject_init_group(&time_subject, time_group_array_subject, 4);
/*Create the UI*/
lv_obj_t * time_label = lv_label_create(lv_scr_act());
lv_obj_t * time_label = lv_label_create(lv_screen_active());
lv_obj_set_style_text_font(time_label, &lv_font_montserrat_30, 0);
lv_subject_add_observer_obj(&time_subject, time_observer_cb, time_label, NULL);
lv_obj_set_pos(time_label, 24, 24);
lv_obj_t * set_btn = lv_button_create(lv_scr_act());
lv_obj_t * set_btn = lv_button_create(lv_screen_active());
lv_obj_set_pos(set_btn, 180, 24);
lv_obj_add_event(set_btn, set_btn_clicked_event_cb, LV_EVENT_CLICKED, NULL);
@@ -73,7 +73,7 @@ static void set_btn_clicked_event_cb(lv_event_t * e)
lv_obj_t * set_btn = lv_event_get_target(e);
lv_obj_add_state(set_btn, LV_STATE_DISABLED);
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, lv_pct(100), LV_SIZE_CONTENT);
lv_obj_align(cont, LV_ALIGN_BOTTOM_MID, 0, 0);
@@ -115,8 +115,8 @@ static void close_clicked_event_cb(lv_event_t * e)
lv_obj_t * set_btn = lv_event_get_user_data(e);
lv_obj_t * close_btn = lv_event_get_target(e);
lv_obj_t * cont = lv_obj_get_parent(close_btn);
lv_obj_clear_state(set_btn, LV_STATE_DISABLED);
lv_obj_del(cont);
lv_obj_remove_state(set_btn, LV_STATE_DISABLED);
lv_obj_delete(cont);
}
/*Watch all related subject to display the current time correctly*/

View File

@@ -25,7 +25,7 @@ void lv_example_observer_4(void)
lv_subject_init_int(&roller_subject[0], 0);
lv_subject_init_int(&roller_subject[1], 0);
lv_obj_t * main_cont = lv_obj_create(lv_scr_act());
lv_obj_t * main_cont = lv_obj_create(lv_screen_active());
lv_obj_remove_style_all(main_cont);
lv_obj_set_size(main_cont, lv_pct(100), lv_pct(100));
lv_obj_set_style_pad_all(main_cont, 0, 0);
@@ -87,7 +87,7 @@ static void cont_observer_cb(lv_subject_t * subject, lv_observer_t * observer)
lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out);
lv_anim_set_exec_cb(&a, anim_set_x_cb);
lv_anim_set_get_value_cb(&a, anim_get_x_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);
uint32_t i;
uint32_t delay = 0;
@@ -179,7 +179,7 @@ static void btn_observer_cb(lv_subject_t * subject, lv_observer_t * observer)
lv_obj_t * btn = lv_observer_get_target(observer);
int32_t idx = (int32_t)lv_obj_get_index(btn);
if(idx == prev_v) lv_obj_clear_state(btn, LV_STATE_CHECKED);
if(idx == prev_v) lv_obj_remove_state(btn, LV_STATE_CHECKED);
if(idx == cur_v) lv_obj_add_state(btn, LV_STATE_CHECKED);
}

View File

@@ -33,7 +33,7 @@ void lv_example_observer_5(void)
lv_subject_add_observer(&fw_update_status_subject, fw_upload_manager_observer_cb, NULL);
/*Create start FW update button*/
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, fw_update_btn_clicked_event_cb, LV_EVENT_CLICKED, NULL);
lv_obj_center(btn);
lv_obj_t * label = lv_label_create(btn);
@@ -43,7 +43,7 @@ void lv_example_observer_5(void)
static void fw_update_btn_clicked_event_cb(lv_event_t * e)
{
LV_UNUSED(e);
lv_obj_t * win = lv_win_create(lv_scr_act());
lv_obj_t * win = lv_win_create(lv_screen_active());
lv_obj_set_size(win, lv_pct(90), lv_pct(90));
lv_obj_set_height(lv_win_get_header(win), 40);
lv_obj_set_style_radius(win, 8, 0);
@@ -69,7 +69,7 @@ static void fw_update_close_event_cb(lv_event_t * e)
static void restart_btn_click_event_cb(lv_event_t * e)
{
lv_obj_t * win = lv_event_get_user_data(e);
lv_obj_del(win);
lv_obj_delete(win);
lv_subject_set_int(&fw_update_status_subject, FW_UPDATE_STATE_IDLE);
}
@@ -96,7 +96,7 @@ static void fw_update_win_observer_cb(lv_subject_t * subject, lv_observer_t * ob
lv_arc_bind_value(arc, &fw_download_percent_subject);
lv_obj_center(arc);
lv_obj_set_size(arc, 130, 130);
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE);
lv_obj_t * label = lv_label_create(cont);
lv_label_bind_text(label, &fw_download_percent_subject, "%d %%");
@@ -116,7 +116,7 @@ static void fw_update_win_observer_cb(lv_subject_t * subject, lv_observer_t * ob
lv_label_set_text(label, "Restart");
}
else if(status == FW_UPDATE_STATE_CANCEL) {
lv_obj_del(win);
lv_obj_delete(win);
}
}
@@ -125,13 +125,13 @@ static void connect_timer_cb(lv_timer_t * t)
if(lv_subject_get_int(&fw_update_status_subject) != FW_UPDATE_STATE_CANCEL) {
lv_subject_set_int(&fw_update_status_subject, FW_UPDATE_STATE_CONNECTED);
}
lv_timer_del(t);
lv_timer_delete(t);
}
static void download_timer_cb(lv_timer_t * t)
{
if(lv_subject_get_int(&fw_update_status_subject) == FW_UPDATE_STATE_CANCEL) {
lv_timer_del(t);
lv_timer_delete(t);
return;
}
@@ -141,7 +141,7 @@ static void download_timer_cb(lv_timer_t * t)
}
else {
lv_subject_set_int(&fw_update_status_subject, FW_UPDATE_STATE_READY);
lv_timer_del(t);
lv_timer_delete(t);
}
}

View File

@@ -20,7 +20,7 @@ void lv_example_observer_6(void)
{
lv_subject_init_int(&theme_subject, THEME_MODE_DARK);
lv_obj_t * panel1 = my_panel_create(lv_scr_act());
lv_obj_t * panel1 = my_panel_create(lv_screen_active());
lv_obj_set_flex_flow(panel1, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(panel1, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_set_size(panel1, lv_pct(90), lv_pct(90));

View File

@@ -23,7 +23,7 @@ static void event_cb(lv_event_t * e)
void lv_example_snapshot_1(void)
{
LV_IMAGE_DECLARE(img_star);
lv_obj_t * root = lv_scr_act();
lv_obj_t * root = lv_screen_active();
lv_obj_set_style_bg_color(root, lv_palette_main(LV_PALETTE_LIGHT_BLUE), 0);
/*Create an image object to show snapshot*/

View File

@@ -6,7 +6,7 @@ gc.enable()
gc.collect()
mem_free = gc.mem_free()
label = lv.label(lv.scr_act())
label = lv.label(lv.screen_active())
label.align(lv.ALIGN.BOTTOM_MID, 0, -10)
label.set_text(" memory free:" + str(mem_free/1024) + " kB")
@@ -37,7 +37,7 @@ def event_cb(e, snapshot_obj):
mem_used = mem_free - gc.mem_free()
label.set_text("memory used:" + str(mem_used/1024) + " kB")
root = lv.scr_act()
root = lv.screen_active()
root.set_style_bg_color(lv.palette_main(lv.PALETTE.LIGHT_BLUE), 0)
# Create an image object to show snapshot