refactor(event): add _cb postfix to lv_obj_add_event()

This commit is contained in:
Gabor Kiss-Vamosi
2023-11-28 15:36:51 +01:00
parent d7981cf55f
commit f0988b8cf8
179 changed files with 362 additions and 362 deletions

View File

@@ -113,7 +113,7 @@ static void create_ui(void)
lv_obj_add_style(btnmatrix, &style_big_font, LV_PART_ITEMS | LV_STATE_CHECKED);
lv_buttonmatrix_set_selected_button(btnmatrix, 1);
lv_obj_add_event(btnmatrix, buttonmatrix_event_cb, LV_EVENT_VALUE_CHANGED, label);
lv_obj_add_event_cb(btnmatrix, buttonmatrix_event_cb, LV_EVENT_VALUE_CHANGED, label);
lv_obj_send_event(btnmatrix, LV_EVENT_VALUE_CHANGED, NULL);
/*Create a base object*/

View File

@@ -134,7 +134,7 @@ void test_arc_click_area_with_adv_hittest(void)
lv_obj_set_size(arc, 100, 100);
lv_obj_set_style_arc_width(arc, 10, 0);
lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST);
lv_obj_add_event(arc, dummy_event_cb, LV_EVENT_PRESSED, NULL);
lv_obj_add_event_cb(arc, dummy_event_cb, LV_EVENT_PRESSED, NULL);
lv_obj_set_ext_click_area(arc, 5);
/*No click detected at the middle*/
@@ -171,7 +171,7 @@ void test_arc_click_sustained_from_start_to_end_does_not_set_value_to_max(void)
lv_obj_set_size(arc, 100, 100);
lv_obj_center(arc);
lv_obj_add_event(arc, dummy_event_cb, LV_EVENT_PRESSED, NULL);
lv_obj_add_event_cb(arc, dummy_event_cb, LV_EVENT_PRESSED, NULL);
event_cnt = 0;
/* Click close to start angle */

View File

@@ -300,7 +300,7 @@ void test_button_matrix_pressed_event_works(void)
{
static const char * btn_map[] = {"A", "B", "\n", "C", "D", ""};
lv_buttonmatrix_set_map(btnm, btn_map);
lv_obj_add_event(btnm, event_handler, LV_EVENT_PRESSED, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_PRESSED, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_PRESSED;
/* Click button index 0. */
@@ -313,7 +313,7 @@ void test_button_matrix_release_event_works(void)
static const char * btn_map[] = {"A", "B", "\n", "C", "D", ""};
lv_buttonmatrix_set_map(btnm, btn_map);
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
lv_obj_add_event(btnm, event_handler, LV_EVENT_RELEASED, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_RELEASED, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_RELEASED;
@@ -336,7 +336,7 @@ void test_button_matrix_key_event_works(void)
lv_buttonmatrix_set_map(btnm, btn_map);
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
lv_obj_update_layout(btnm); /*The force calculating the button areas*/
lv_obj_add_event(btnm, event_handler, LV_EVENT_KEY, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_KEY, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_KEY;
@@ -385,7 +385,7 @@ void test_button_matrix_pressing_event_works(void)
static const char * btn_map[] = {"A", "B", "\n", "C", "D", ""};
lv_buttonmatrix_set_map(btnm, btn_map);
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
lv_obj_add_event(btnm, event_handler, LV_EVENT_PRESSING, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_PRESSING, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_PRESSING;
/* Select a button before raising a simulated event.
@@ -403,7 +403,7 @@ void test_button_matrix_long_press_repeat_event_works(void)
lv_buttonmatrix_set_map(btnm, btn_map);
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
lv_obj_add_event(btnm, event_handler, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_LONG_PRESSED_REPEAT;
/* Select a button before raising a simulated event.
@@ -419,7 +419,7 @@ void test_button_matrix_press_lost_event_works(void)
lv_buttonmatrix_set_map(btnm, btn_map);
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
lv_obj_add_event(btnm, event_handler, LV_EVENT_PRESS_LOST, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_PRESS_LOST, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_PRESS_LOST;
lv_obj_send_event(btnm, LV_EVENT_PRESS_LOST, NULL);
@@ -433,7 +433,7 @@ void test_button_matrix_defocused_event_works(void)
lv_buttonmatrix_set_map(btnm, btn_map);
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
lv_obj_add_event(btnm, event_handler, LV_EVENT_DEFOCUSED, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_DEFOCUSED, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_DEFOCUSED;
/* Select a button before raising a simulated event.
@@ -449,7 +449,7 @@ void test_button_matrix_focused_event_works(void)
lv_buttonmatrix_set_map(btnm, btn_map);
lv_buttonmatrix_set_button_ctrl_all(btnm, LV_BUTTONMATRIX_CTRL_CHECKABLE);
lv_obj_add_event(btnm, event_handler, LV_EVENT_FOCUSED, NULL);
lv_obj_add_event_cb(btnm, event_handler, LV_EVENT_FOCUSED, NULL);
/* Set expected event code before the event is raised. */
exp_evt_code = LV_EVENT_FOCUSED;
lv_obj_send_event(btnm, LV_EVENT_FOCUSED, NULL);

View File

@@ -40,7 +40,7 @@ void test_checkbox_should_call_event_handler_on_click_when_enabled(void)
checkbox = lv_checkbox_create(active_screen);
lv_obj_add_state(checkbox, LV_STATE_CHECKED);
lv_obj_add_event(checkbox, event_handler, LV_EVENT_ALL, NULL);
lv_obj_add_event_cb(checkbox, event_handler, LV_EVENT_ALL, NULL);
lv_test_mouse_click_at(checkbox->coords.x1, checkbox->coords.y1);

View File

@@ -169,7 +169,7 @@ void test_dropdown_keypad(void)
lv_obj_set_pos(dd1, 20, 20);
lv_dropdown_set_options(dd1, "1\n2\n3\n4\n5\n6\n7\n8");
lv_group_add_obj(g, dd1);
lv_obj_add_event(dd1, dd_event, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(dd1, dd_event, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_t * dd2 = lv_dropdown_create(lv_screen_active());
lv_obj_set_pos(dd2, 300, 20);
@@ -271,7 +271,7 @@ void test_dropdown_encoder(void)
lv_obj_set_pos(dd1, 20, 20);
lv_dropdown_set_options(dd1, "1\n2\n3\n4\n5\n6\n7\n8");
lv_group_add_obj(g, dd1);
lv_obj_add_event(dd1, dd_event, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_add_event_cb(dd1, dd_event, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_t * dd2 = lv_dropdown_create(lv_screen_active());
lv_obj_set_pos(dd2, 300, 20);

View File

@@ -72,7 +72,7 @@ static void line_event_cb(lv_event_t * e)
void test_line_should_update_extra_draw_size_based_on_style(void)
{
/* Setup an event handler for line extra draw size event */
lv_obj_add_event(line, line_event_cb, LV_EVENT_ALL, NULL);
lv_obj_add_event_cb(line, line_event_cb, LV_EVENT_ALL, NULL);
/* Trigger the extra draw size event */
lv_obj_refresh_ext_draw_size(line);

View File

@@ -33,7 +33,7 @@ void test_obj_flag_overflow_visible_1(void)
lv_obj_set_style_bg_color(obj_main, lv_palette_main(LV_PALETTE_RED), 0);
lv_obj_add_flag(obj_main, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
lv_obj_center(obj_main);
lv_obj_add_event(obj_main, ext_draw_size_event_cb, LV_EVENT_REFR_EXT_DRAW_SIZE, NULL);
lv_obj_add_event_cb(obj_main, ext_draw_size_event_cb, LV_EVENT_REFR_EXT_DRAW_SIZE, NULL);
lv_obj_t * obj_child_1 = lv_obj_create(obj_main);
lv_obj_set_size(obj_child_1, 200, 200);
@@ -45,7 +45,7 @@ void test_obj_flag_overflow_visible_1(void)
lv_obj_align(btn_1, LV_ALIGN_LEFT_MID, -75, 0);
lv_obj_remove_flag(btn_1, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
uint32_t cnt_1;
lv_obj_add_event(btn_1, btn_clicked_event_cb, LV_EVENT_CLICKED, &cnt_1);
lv_obj_add_event_cb(btn_1, btn_clicked_event_cb, LV_EVENT_CLICKED, &cnt_1);
lv_obj_t * label_1 = lv_label_create(btn_1);
lv_label_set_text(label_1, "Button 1");
@@ -56,14 +56,14 @@ void test_obj_flag_overflow_visible_1(void)
lv_obj_set_style_bg_color(obj_child_2, lv_palette_main(LV_PALETTE_ORANGE), 0);
lv_obj_add_flag(obj_child_2, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
lv_obj_align(obj_child_2, LV_ALIGN_RIGHT_MID, 100, 0);
lv_obj_add_event(obj_child_2, ext_draw_size_event_cb, LV_EVENT_REFR_EXT_DRAW_SIZE, NULL);
lv_obj_add_event_cb(obj_child_2, ext_draw_size_event_cb, LV_EVENT_REFR_EXT_DRAW_SIZE, NULL);
lv_obj_t * btn_2 = lv_button_create(obj_child_2);
lv_obj_set_size(btn_2, 100, 100);
lv_obj_align(btn_2, LV_ALIGN_RIGHT_MID, 75, 0);
lv_obj_remove_flag(btn_2, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
uint32_t cnt_2;
lv_obj_add_event(btn_2, btn_clicked_event_cb, LV_EVENT_CLICKED, &cnt_2);
lv_obj_add_event_cb(btn_2, btn_clicked_event_cb, LV_EVENT_CLICKED, &cnt_2);
lv_obj_t * label_2 = lv_label_create(btn_2);
lv_label_set_text(label_2, "Button 2");

View File

@@ -122,7 +122,7 @@ void test_switch_should_update_extra_draw_size_after_editing_padding(void)
/* See #2330 for context */
void test_switch_should_trigger_value_changed_event_only_once(void)
{
lv_obj_add_event(sw, event_handler, LV_EVENT_ALL, NULL);
lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL);
mouse_click_on_switch();
TEST_ASSERT_EQUAL(1, value_changed_event_cnt);

View File

@@ -164,7 +164,7 @@ static void draw_part_event_cb(lv_event_t * e)
void test_table_rendering(void)
{
lv_obj_center(table);
lv_obj_add_event(table, draw_part_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
lv_obj_add_event_cb(table, draw_part_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL);
lv_obj_add_flag(table, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS);
lv_obj_set_style_border_side(table, LV_BORDER_SIDE_FULL, LV_PART_ITEMS);
lv_obj_set_style_pad_all(table, 10, LV_PART_ITEMS);