refactor(btn, img): rename btn to button and img to image

This commit is contained in:
Gabor Kiss-Vamosi
2023-09-14 20:12:31 +02:00
parent e91786ce49
commit 09c12d0f9c
366 changed files with 3271 additions and 3222 deletions

View File

@@ -13,11 +13,11 @@ static void event_handler(lv_event_t * e)
}
}
void lv_example_btn_1(void)
void lv_example_button_1(void)
{
lv_obj_t * label;
lv_obj_t * btn1 = lv_btn_create(lv_scr_act());
lv_obj_t * btn1 = lv_button_create(lv_scr_act());
lv_obj_add_event(btn1, event_handler, LV_EVENT_ALL, NULL);
lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -40);
lv_obj_clear_flag(btn1, LV_OBJ_FLAG_PRESS_LOCK);
@@ -26,7 +26,7 @@ void lv_example_btn_1(void)
lv_label_set_text(label, "Button");
lv_obj_center(label);
lv_obj_t * btn2 = lv_btn_create(lv_scr_act());
lv_obj_t * btn2 = lv_button_create(lv_scr_act());
lv_obj_add_event(btn2, event_handler, LV_EVENT_ALL, NULL);
lv_obj_align(btn2, LV_ALIGN_CENTER, 0, 40);
lv_obj_add_flag(btn2, LV_OBJ_FLAG_CHECKABLE);

View File

@@ -7,26 +7,26 @@ def event_handler(evt):
print("Value changed seen")
# create a simple button
btn1 = lv.btn(lv.scr_act())
button1 = lv.button(lv.scr_act())
# attach the callback
btn1.add_event(event_handler,lv.EVENT.ALL, None)
button1.add_event(event_handler,lv.EVENT.ALL, None)
btn1.align(lv.ALIGN.CENTER,0,-40)
label=lv.label(btn1)
button1.align(lv.ALIGN.CENTER,0,-40)
label=lv.label(button1)
label.set_text("Button")
# create a toggle button
btn2 = lv.btn(lv.scr_act())
button2 = lv.button(lv.scr_act())
# attach the callback
#btn2.add_event(event_handler,lv.EVENT.VALUE_CHANGED,None)
btn2.add_event(event_handler,lv.EVENT.ALL, None)
#button2.add_event(event_handler,lv.EVENT.VALUE_CHANGED,None)
button2.add_event(event_handler,lv.EVENT.ALL, None)
btn2.align(lv.ALIGN.CENTER,0,40)
btn2.add_flag(lv.obj.FLAG.CHECKABLE)
btn2.set_height(lv.SIZE_CONTENT)
button2.align(lv.ALIGN.CENTER,0,40)
button2.add_flag(lv.obj.FLAG.CHECKABLE)
button2.set_height(lv.SIZE_CONTENT)
label=lv.label(btn2)
label=lv.label(button2)
label.set_text("Toggle")
label.center()

View File

@@ -4,7 +4,7 @@
/**
* Style a button from scratch
*/
void lv_example_btn_2(void)
void lv_example_button_2(void)
{
/*Init the style for the default state*/
static lv_style_t style;
@@ -51,7 +51,7 @@ void lv_example_btn_2(void)
lv_style_set_transition(&style_pr, &trans);
lv_obj_t * btn1 = lv_btn_create(lv_scr_act());
lv_obj_t * btn1 = lv_button_create(lv_scr_act());
lv_obj_remove_style_all(btn1); /*Remove the style coming from the theme*/
lv_obj_add_style(btn1, &style, 0);
lv_obj_add_style(btn1, &style_pr, LV_STATE_PRESSED);

View File

@@ -47,14 +47,14 @@ trans.init(props, lv.anim_t.path_linear, 300, 0, None)
style_pr.set_transition(trans)
btn1 = lv.btn(lv.scr_act())
btn1.remove_style_all() # Remove the style coming from the theme
btn1.add_style(style, 0)
btn1.add_style(style_pr, lv.STATE.PRESSED)
btn1.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
btn1.center()
button1 = lv.button(lv.scr_act())
button1.remove_style_all() # Remove the style coming from the theme
button1.add_style(style, 0)
button1.add_style(style_pr, lv.STATE.PRESSED)
button1.set_size(lv.SIZE_CONTENT, lv.SIZE_CONTENT)
button1.center()
label = lv.label(btn1)
label = lv.label(button1)
label.set_text("Button")
label.center()

View File

@@ -4,7 +4,7 @@
/**
* Create a style transition on a button to act like a gum when clicked
*/
void lv_example_btn_3(void)
void lv_example_button_3(void)
{
/*Properties to transition*/
static lv_style_prop_t props[] = {
@@ -34,7 +34,7 @@ void lv_example_btn_3(void)
lv_style_set_text_letter_space(&style_pr, 10);
lv_style_set_transition(&style_pr, &transition_dsc_pr);
lv_obj_t * btn1 = lv_btn_create(lv_scr_act());
lv_obj_t * btn1 = lv_button_create(lv_scr_act());
lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -80);
lv_obj_add_style(btn1, &style_pr, LV_STATE_PRESSED);
lv_obj_add_style(btn1, &style_def, 0);

View File

@@ -28,11 +28,11 @@ style_pr.set_transform_height(-10)
style_pr.set_text_letter_space(10)
style_pr.set_transition(transition_dsc_pr)
btn1 = lv.btn(lv.scr_act())
btn1.align(lv.ALIGN.CENTER, 0, -80)
btn1.add_style(style_pr, lv.STATE.PRESSED)
btn1.add_style(style_def, 0)
button1 = lv.button(lv.scr_act())
button1.align(lv.ALIGN.CENTER, 0, -80)
button1.add_style(style_pr, lv.STATE.PRESSED)
button1.add_style(style_def, 0)
label = lv.label(btn1)
label = lv.label(button1)
label.set_text("Gum")