refactor(event): add _cb postfix to lv_obj_add_event()
This commit is contained in:
@@ -22,31 +22,31 @@ void lv_example_list_1(void)
|
||||
lv_obj_t * btn;
|
||||
lv_list_add_text(list1, "File");
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_FILE, "New");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_DIRECTORY, "Open");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_SAVE, "Save");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_CLOSE, "Delete");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_EDIT, "Edit");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
lv_list_add_text(list1, "Connectivity");
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_BLUETOOTH, "Bluetooth");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_GPS, "Navigation");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_USB, "USB");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_BATTERY_FULL, "Battery");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
lv_list_add_text(list1, "Exit");
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_OK, "Apply");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
btn = lv_list_add_button(list1, LV_SYMBOL_CLOSE, "Close");
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,29 +12,29 @@ list1.center()
|
||||
# Add buttons to the list
|
||||
list1.add_text("File")
|
||||
button_new = list1.add_button(lv.SYMBOL.FILE, "New")
|
||||
button_new.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_new.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_open = list1.add_button(lv.SYMBOL.DIRECTORY, "Open")
|
||||
button_open.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_open.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_save = list1.add_button(lv.SYMBOL.SAVE, "Save")
|
||||
button_save.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_save.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_delete = list1.add_button(lv.SYMBOL.CLOSE, "Delete")
|
||||
button_delete.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_delete.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_edit = list1.add_button(lv.SYMBOL.EDIT, "Edit")
|
||||
button_edit.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_edit.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
|
||||
list1.add_text("Connectivity")
|
||||
button_bluetooth = list1.add_button(lv.SYMBOL.BLUETOOTH, "Bluetooth")
|
||||
button_bluetooth.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_bluetooth.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_navig = list1.add_button(lv.SYMBOL.GPS, "Navigation")
|
||||
button_navig.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_navig.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_USB = list1.add_button(lv.SYMBOL.USB, "USB")
|
||||
button_USB.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_USB.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_battery = list1.add_button(lv.SYMBOL.BATTERY_FULL, "Battery")
|
||||
button_battery.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_battery.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
|
||||
list1.add_text("Exit")
|
||||
button_apply = list1.add_button(lv.SYMBOL.OK, "Apply")
|
||||
button_apply.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_apply.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_close = list1.add_button(lv.SYMBOL.CLOSE, "Close")
|
||||
button_close.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_close.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ void lv_example_list_2(void)
|
||||
for(i = 0; i < 15; i++) {
|
||||
btn = lv_button_create(list1);
|
||||
lv_obj_set_width(btn, lv_pct(50));
|
||||
lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL);
|
||||
|
||||
lv_obj_t * lab = lv_label_create(btn);
|
||||
lv_label_set_text_fmt(lab, "Item %d", i);
|
||||
@@ -141,27 +141,27 @@ void lv_example_list_2(void)
|
||||
lv_obj_set_flex_flow(list2, LV_FLEX_FLOW_COLUMN);
|
||||
|
||||
btn = lv_list_add_button(list2, NULL, "Top");
|
||||
lv_obj_add_event(btn, event_handler_top, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler_top, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_UP, "Up");
|
||||
lv_obj_add_event(btn, event_handler_up, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler_up, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_LEFT, "Center");
|
||||
lv_obj_add_event(btn, event_handler_center, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler_center, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_DOWN, "Down");
|
||||
lv_obj_add_event(btn, event_handler_dn, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler_dn, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, NULL, "Bottom");
|
||||
lv_obj_add_event(btn, event_handler_bottom, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler_bottom, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
|
||||
btn = lv_list_add_button(list2, LV_SYMBOL_SHUFFLE, "Shuffle");
|
||||
lv_obj_add_event(btn, event_handler_swap, LV_EVENT_ALL, NULL);
|
||||
lv_obj_add_event_cb(btn, event_handler_swap, LV_EVENT_ALL, NULL);
|
||||
lv_group_remove_obj(btn);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ list1.set_style_pad_row( 5, 0)
|
||||
for i in range(15):
|
||||
button = lv.button(list1)
|
||||
button.set_width(lv.pct(100))
|
||||
button.add_event( event_handler, lv.EVENT.CLICKED, None)
|
||||
button.add_event_cb( event_handler, lv.EVENT.CLICKED, None)
|
||||
lab = lv.label(button)
|
||||
lab.set_text("Item " + str(i))
|
||||
|
||||
@@ -113,25 +113,25 @@ list2.align(lv.ALIGN.TOP_RIGHT, 0, 0)
|
||||
list2.set_flex_flow(lv.FLEX_FLOW.COLUMN)
|
||||
|
||||
button = list2.add_button(None, "Top")
|
||||
button.add_event(event_handler_top, lv.EVENT.ALL, None)
|
||||
button.add_event_cb(event_handler_top, lv.EVENT.ALL, None)
|
||||
lv.group_remove_obj(button)
|
||||
|
||||
button = list2.add_button(lv.SYMBOL.UP, "Up")
|
||||
button.add_event(event_handler_up, lv.EVENT.ALL, None)
|
||||
button.add_event_cb(event_handler_up, lv.EVENT.ALL, None)
|
||||
lv.group_remove_obj(button)
|
||||
|
||||
button = list2.add_button(lv.SYMBOL.LEFT, "Center")
|
||||
button.add_event(event_handler_center, lv.EVENT.ALL, None)
|
||||
button.add_event_cb(event_handler_center, lv.EVENT.ALL, None)
|
||||
lv.group_remove_obj(button)
|
||||
|
||||
button = list2.add_button(lv.SYMBOL.DOWN, "Down")
|
||||
button.add_event(event_handler_dn, lv.EVENT.ALL, None)
|
||||
button.add_event_cb(event_handler_dn, lv.EVENT.ALL, None)
|
||||
lv.group_remove_obj(button)
|
||||
|
||||
button = list2.add_button(None, "Bottom")
|
||||
button.add_event(event_handler_bottom, lv.EVENT.ALL, None)
|
||||
button.add_event_cb(event_handler_bottom, lv.EVENT.ALL, None)
|
||||
lv.group_remove_obj(button)
|
||||
|
||||
button = list2.add_button(lv.SYMBOL.SHUFFLE, "Shuffle")
|
||||
button.add_event(event_handler_swap, lv.EVENT.ALL, None)
|
||||
button.add_event_cb(event_handler_swap, lv.EVENT.ALL, None)
|
||||
lv.group_remove_obj(button)
|
||||
|
||||
@@ -15,29 +15,29 @@ list1.center()
|
||||
# Add buttons to the list
|
||||
list1.add_text("File")
|
||||
button_new = list1.add_button(lv.SYMBOL.FILE, "New")
|
||||
button_new.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_new.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_open = list1.add_button(lv.SYMBOL.DIRECTORY, "Open")
|
||||
button_open.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_open.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_save = list1.add_button(lv.SYMBOL.SAVE, "Save")
|
||||
button_save.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_save.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_delete = list1.add_button(lv.SYMBOL.CLOSE, "Delete")
|
||||
button_delete.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_delete.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_edit = list1.add_button(lv.SYMBOL.EDIT, "Edit")
|
||||
button_edit.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_edit.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
|
||||
list1.add_text("Connectivity")
|
||||
button_bluetooth = list1.add_button(lv.SYMBOL.BLUETOOTH, "Bluetooth")
|
||||
button_bluetooth.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_bluetooth.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_navig = list1.add_button(lv.SYMBOL.GPS, "Navigation")
|
||||
button_navig.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_navig.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_USB = list1.add_button(lv.SYMBOL.USB, "USB")
|
||||
button_USB.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_USB.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_battery = list1.add_button(lv.SYMBOL.BATTERY_FULL, "Battery")
|
||||
button_battery.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_battery.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
|
||||
list1.add_text("Exit")
|
||||
button_apply = list1.add_button(lv.SYMBOL.OK, "Apply")
|
||||
button_apply.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_apply.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
button_close = list1.add_button(lv.SYMBOL.CLOSE, "Close")
|
||||
button_close.add_event(event_handler,lv.EVENT.ALL, None)
|
||||
button_close.add_event_cb(event_handler,lv.EVENT.ALL, None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user