diff --git a/demos/flex_layout/lv_demo_flex_layout_ctrl_pad.c b/demos/flex_layout/lv_demo_flex_layout_ctrl_pad.c index 06d6a4549..4a836cb34 100644 --- a/demos/flex_layout/lv_demo_flex_layout_ctrl_pad.c +++ b/demos/flex_layout/lv_demo_flex_layout_ctrl_pad.c @@ -23,7 +23,7 @@ } while(0) #define SPINBOX_EVENT_ATTACH(item) \ - lv_obj_add_event(ui->ctrl_pad.tab.layout.spinbox_##item, ctrl_pad_spinbox_event_handler, LV_EVENT_VALUE_CHANGED, ui); + lv_obj_add_event_cb(ui->ctrl_pad.tab.layout.spinbox_##item, ctrl_pad_spinbox_event_handler, LV_EVENT_VALUE_CHANGED, ui); /********************** * TYPEDEFS @@ -64,7 +64,7 @@ void ctrl_pad_attach(view_t * ui) SPINBOX_EVENT_ATTACH(pad_row); SPINBOX_EVENT_ATTACH(flex_grow); - lv_obj_add_event( + lv_obj_add_event_cb( ui->ctrl_pad.tab.flex.checkbox_scrl, ctrl_pad_checkbox_event_handler, LV_EVENT_VALUE_CHANGED, @@ -150,14 +150,14 @@ static void ctrl_pad_checkbox_event_handler(lv_event_t * e) static void ctrl_pad_btn_event_attach(view_t * ui) { - lv_obj_add_event( + lv_obj_add_event_cb( ui->ctrl_pad.btn.add, ctrl_pad_btn_add_event_handler, LV_EVENT_CLICKED, ui ); - lv_obj_add_event( + lv_obj_add_event_cb( ui->ctrl_pad.btn.remove, ctrl_pad_btn_remove_event_handler, LV_EVENT_CLICKED, diff --git a/demos/flex_layout/lv_demo_flex_layout_flex_loader.c b/demos/flex_layout/lv_demo_flex_layout_flex_loader.c index 6292e3ce4..9493b250b 100644 --- a/demos/flex_layout/lv_demo_flex_layout_flex_loader.c +++ b/demos/flex_layout/lv_demo_flex_layout_flex_loader.c @@ -41,11 +41,11 @@ #define FLEX_ALIGN_EVENT_ATTACH(item) \ do { \ - lv_obj_add_event(ui->ctrl_pad.tab.align.ddlist_align_##item, \ - flex_align_##item##_event_handler, \ - LV_EVENT_VALUE_CHANGED, \ - ui \ - ); \ + lv_obj_add_event_cb(ui->ctrl_pad.tab.align.ddlist_align_##item, \ + flex_align_##item##_event_handler, \ + LV_EVENT_VALUE_CHANGED, \ + ui \ + ); \ } while(0) /********************** @@ -96,7 +96,7 @@ FLEX_ALIGN_EVENT_DEF(track) void flex_loader_attach(view_t * ui) { - lv_obj_add_event( + lv_obj_add_event_cb( ui->ctrl_pad.tab.flex.ddlist_flow, flex_flow_event_handler, LV_EVENT_VALUE_CHANGED, diff --git a/demos/flex_layout/lv_demo_flex_layout_view_child_node.c b/demos/flex_layout/lv_demo_flex_layout_view_child_node.c index b4dee3d11..3f3db9d9f 100644 --- a/demos/flex_layout/lv_demo_flex_layout_view_child_node.c +++ b/demos/flex_layout/lv_demo_flex_layout_view_child_node.c @@ -54,7 +54,7 @@ lv_obj_t * obj_child_node_create(lv_obj_t * par, view_t * ui) lv_obj_add_flag(label, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_FLOATING); lv_obj_center(label); - lv_obj_add_event(obj, obj_child_node_event_handler, LV_EVENT_CLICKED, ui); + lv_obj_add_event_cb(obj, obj_child_node_event_handler, LV_EVENT_CLICKED, ui); return obj; } diff --git a/demos/flex_layout/lv_demo_flex_layout_view_ctrl_pad.c b/demos/flex_layout/lv_demo_flex_layout_view_ctrl_pad.c index b8d7ea5e3..836986a2d 100644 --- a/demos/flex_layout/lv_demo_flex_layout_view_ctrl_pad.c +++ b/demos/flex_layout/lv_demo_flex_layout_view_ctrl_pad.c @@ -216,8 +216,8 @@ static lv_obj_t * spinbox_ctrl_create(lv_obj_t * par, lv_style_prop_t prop, lv_o lv_label_set_text(label, "+"); lv_obj_center(label); - lv_obj_add_event(btn_inc, btn_inc_event_handler, LV_EVENT_ALL, spinbox); - lv_obj_add_event(btn_dec, btn_dec_event_handler, LV_EVENT_ALL, spinbox); + lv_obj_add_event_cb(btn_inc, btn_inc_event_handler, LV_EVENT_ALL, spinbox); + lv_obj_add_event_cb(btn_dec, btn_dec_event_handler, LV_EVENT_ALL, spinbox); return spinbox; } diff --git a/demos/keypad_encoder/lv_demo_keypad_encoder.c b/demos/keypad_encoder/lv_demo_keypad_encoder.c index 48ad3f400..96ee43561 100644 --- a/demos/keypad_encoder/lv_demo_keypad_encoder.c +++ b/demos/keypad_encoder/lv_demo_keypad_encoder.c @@ -156,15 +156,15 @@ static void text_input_create(lv_obj_t * parent) 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); - lv_obj_add_event(ta2, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(ta2, ta_event_cb, LV_EVENT_ALL, kb); } static void msgbox_create(void) { static const char * buttons[] = {"Ok", "Cancel", ""}; lv_obj_t * mbox = lv_msgbox_create(NULL, "Hi", "Welcome to the keyboard and encoder demo", buttons, false); - lv_obj_add_event(mbox, msgbox_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(mbox, msgbox_event_cb, LV_EVENT_ALL, NULL); lv_group_focus_obj(lv_msgbox_get_buttons(mbox)); lv_obj_add_state(lv_msgbox_get_buttons(mbox), LV_STATE_FOCUS_KEY); lv_group_focus_freeze(g, true); diff --git a/demos/keypad_encoder/lv_demo_keypad_encoder.py b/demos/keypad_encoder/lv_demo_keypad_encoder.py index fec99d422..594176587 100644 --- a/demos/keypad_encoder/lv_demo_keypad_encoder.py +++ b/demos/keypad_encoder/lv_demo_keypad_encoder.py @@ -96,15 +96,15 @@ class KeyboardEncoder: 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) - ta2.add_event(self.ta_event_cb, lv.EVENT.ALL, None) + ta1.add_event_cb(self.ta_event_cb, lv.EVENT.ALL, None) + ta2.add_event_cb(self.ta_event_cb, lv.EVENT.ALL, None) def msgbox_create(self): buttons = ["Ok", "Cancel", ""] mbox = lv.msgbox(None, "Hi", "Welcome to the keyboard and encoder demo", buttons, False) - mbox.add_event(self.msgbox_event_cb, lv.EVENT.ALL, None) + mbox.add_event_cb(self.msgbox_event_cb, lv.EVENT.ALL, None) lv.group_focus_obj(mbox.get_buttons()) mbox.get_buttons().add_state(lv.STATE.FOCUS_KEY) self.g.focus_freeze(True) diff --git a/demos/multilang/lv_demo_multilang.c b/demos/multilang/lv_demo_multilang.c index 88b5bc614..5abc40cd0 100644 --- a/demos/multilang/lv_demo_multilang.c +++ b/demos/multilang/lv_demo_multilang.c @@ -295,7 +295,7 @@ static void card_create(lv_obj_t * parent, card_info_t * info) lv_obj_t * cont = lv_obj_create(parent); 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_add_event_cb(cont, scroll_event_cb, LV_EVENT_RELEASED, NULL); lv_obj_remove_flag(cont, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF); diff --git a/demos/music/lv_demo_music_list.c b/demos/music/lv_demo_music_list.c index 4034aba08..79c370c40 100644 --- a/demos/music/lv_demo_music_list.c +++ b/demos/music/lv_demo_music_list.c @@ -130,7 +130,7 @@ lv_obj_t * _lv_demo_music_list_create(lv_obj_t * parent) /*Create an empty transparent container*/ list = lv_obj_create(parent); - lv_obj_add_event(list, list_delete_event_cb, LV_EVENT_DELETE, NULL); + lv_obj_add_event_cb(list, list_delete_event_cb, LV_EVENT_DELETE, NULL); lv_obj_remove_style_all(list); lv_obj_set_size(list, LV_HOR_RES, LV_VER_RES - LV_DEMO_MUSIC_HANDLE_SIZE); lv_obj_set_y(list, LV_DEMO_MUSIC_HANDLE_SIZE); @@ -191,7 +191,7 @@ static lv_obj_t * add_list_button(lv_obj_t * parent, uint32_t track_id) lv_obj_add_style(btn, &style_button_pr, LV_STATE_PRESSED); lv_obj_add_style(btn, &style_button_chk, LV_STATE_CHECKED); lv_obj_add_style(btn, &style_button_dis, LV_STATE_DISABLED); - lv_obj_add_event(btn, btn_click_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(btn, btn_click_event_cb, LV_EVENT_CLICKED, NULL); if(track_id >= 3) { lv_obj_add_state(btn, LV_STATE_DISABLED); diff --git a/demos/music/lv_demo_music_main.c b/demos/music/lv_demo_music_main.c index ec0c614a8..0e1b498aa 100644 --- a/demos/music/lv_demo_music_main.c +++ b/demos/music/lv_demo_music_main.c @@ -545,7 +545,7 @@ static lv_obj_t * create_spectrum_obj(lv_obj_t * parent) lv_obj_set_height(obj, 250); #endif 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_add_event_cb(obj, spectrum_draw_event_cb, LV_EVENT_ALL, NULL); lv_obj_refresh_ext_draw_size(obj); album_image_obj = album_image_create(obj); return obj; @@ -585,7 +585,7 @@ static lv_obj_t * create_ctrl_box(lv_obj_t * parent) icon = lv_image_create(cont); lv_image_set_src(icon, &img_lv_demo_music_btn_prev); lv_obj_set_grid_cell(icon, LV_GRID_ALIGN_CENTER, 2, 1, LV_GRID_ALIGN_CENTER, 0, 1); - lv_obj_add_event(icon, prev_click_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(icon, prev_click_event_cb, LV_EVENT_CLICKED, NULL); play_obj = lv_imgbtn_create(cont); lv_imgbtn_set_src(play_obj, LV_IMGBTN_STATE_RELEASED, NULL, &img_lv_demo_music_btn_play, NULL); @@ -593,14 +593,14 @@ static lv_obj_t * create_ctrl_box(lv_obj_t * parent) lv_obj_add_flag(play_obj, LV_OBJ_FLAG_CHECKABLE); lv_obj_set_grid_cell(play_obj, LV_GRID_ALIGN_CENTER, 3, 1, LV_GRID_ALIGN_CENTER, 0, 1); - lv_obj_add_event(play_obj, play_event_click_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(play_obj, play_event_click_cb, LV_EVENT_CLICKED, NULL); lv_obj_add_flag(play_obj, LV_OBJ_FLAG_CLICKABLE); lv_obj_set_width(play_obj, img_lv_demo_music_btn_play.header.w); icon = lv_image_create(cont); lv_image_set_src(icon, &img_lv_demo_music_btn_next); lv_obj_set_grid_cell(icon, LV_GRID_ALIGN_CENTER, 4, 1, LV_GRID_ALIGN_CENTER, 0, 1); - lv_obj_add_event(icon, next_click_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(icon, next_click_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_add_flag(icon, LV_OBJ_FLAG_CLICKABLE); LV_IMAGE_DECLARE(img_lv_demo_music_slider_knob); @@ -622,14 +622,14 @@ static lv_obj_t * create_ctrl_box(lv_obj_t * parent) lv_obj_set_style_bg_color(slider_obj, lv_color_hex(0x569af8), LV_PART_INDICATOR); lv_obj_set_style_bg_grad_color(slider_obj, lv_color_hex(0xa666f1), LV_PART_INDICATOR); lv_obj_set_style_outline_width(slider_obj, 0, 0); - lv_obj_add_event(slider_obj, del_counter_timer_cb, LV_EVENT_DELETE, NULL); + lv_obj_add_event_cb(slider_obj, del_counter_timer_cb, LV_EVENT_DELETE, NULL); time_obj = lv_label_create(cont); lv_obj_set_style_text_font(time_obj, font_small, 0); lv_obj_set_style_text_color(time_obj, lv_color_hex(0x8a86b8), 0); lv_label_set_text(time_obj, "0:00"); lv_obj_set_grid_cell(time_obj, LV_GRID_ALIGN_END, 5, 1, LV_GRID_ALIGN_CENTER, 1, 1); - lv_obj_add_event(time_obj, del_counter_timer_cb, LV_EVENT_DELETE, NULL); + lv_obj_add_event_cb(time_obj, del_counter_timer_cb, LV_EVENT_DELETE, NULL); return cont; } @@ -959,7 +959,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_add_event_cb(img, album_gesture_event_cb, LV_EVENT_GESTURE, NULL); lv_obj_remove_flag(img, LV_OBJ_FLAG_GESTURE_BUBBLE); lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE); diff --git a/demos/render/lv_demo_render.c b/demos/render/lv_demo_render.c index abd465e8a..0da7c3f0d 100644 --- a/demos/render/lv_demo_render.c +++ b/demos/render/lv_demo_render.c @@ -539,7 +539,7 @@ static lv_obj_t * triangle_obj_create(lv_obj_t * parent, int32_t col, int32_t ro lv_obj_set_size(obj, DEF_WIDTH, DEF_HEIGHT); lv_obj_set_style_bg_color(obj, lv_color_hex3(0xff0), 0); lv_obj_set_style_opa(obj, opa_saved, 0); - lv_obj_add_event(obj, triangle_draw_event_cb, LV_EVENT_DRAW_MAIN, p); + lv_obj_add_event_cb(obj, triangle_draw_event_cb, LV_EVENT_DRAW_MAIN, p); add_to_cell(obj, col, row); return obj; diff --git a/demos/scroll/lv_demo_scroll.c b/demos/scroll/lv_demo_scroll.c index ccd5ba48c..170b0c1e0 100644 --- a/demos/scroll/lv_demo_scroll.c +++ b/demos/scroll/lv_demo_scroll.c @@ -87,7 +87,7 @@ static lv_obj_t * switch_create(lv_obj_t * parent, const char * title, lv_obj_fl lv_obj_set_flex_grow(label, 1); lv_obj_t * sw = lv_switch_create(cont); - lv_obj_add_event(sw, generic_switch_event_cb, LV_EVENT_VALUE_CHANGED, (void *)((lv_uintptr_t) flag)); + lv_obj_add_event_cb(sw, generic_switch_event_cb, LV_EVENT_VALUE_CHANGED, (void *)((lv_uintptr_t) flag)); if(en) { lv_obj_add_state(sw, LV_STATE_CHECKED); lv_obj_add_flag(list, flag); diff --git a/demos/transform/lv_demo_transform.c b/demos/transform/lv_demo_transform.c index 8b4d7e834..fddc0dfdd 100644 --- a/demos/transform/lv_demo_transform.c +++ b/demos/transform/lv_demo_transform.c @@ -96,14 +96,14 @@ void lv_demo_transform(void) lv_obj_set_size(arc, disp_w - 20, disp_w - 20); lv_arc_set_range(arc, 0, 270); lv_arc_set_value(arc, 225); - lv_obj_add_event(arc, arc_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(arc, arc_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_flag(arc, LV_OBJ_FLAG_ADV_HITTEST); lv_obj_center(arc); 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); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_slider_set_range(slider, 128, 300); lv_slider_set_value(slider, 256, LV_ANIM_OFF); } diff --git a/demos/widgets/lv_demo_widgets.c b/demos/widgets/lv_demo_widgets.c index e45feb506..d1190f84e 100644 --- a/demos/widgets/lv_demo_widgets.c +++ b/demos/widgets/lv_demo_widgets.c @@ -179,7 +179,7 @@ void lv_demo_widgets(void) tv = lv_tabview_create(lv_screen_active()); lv_tabview_set_tab_bar_size(tv, tab_h); - lv_obj_add_event(tv, tabview_delete_event_cb, LV_EVENT_DELETE, NULL); + lv_obj_add_event_cb(tv, tabview_delete_event_cb, LV_EVENT_DELETE, NULL); lv_obj_set_style_text_font(lv_screen_active(), font_normal, 0); @@ -308,7 +308,7 @@ static void profile_create(lv_obj_t * parent) lv_obj_t * user_name = lv_textarea_create(panel2); lv_textarea_set_one_line(user_name, true); lv_textarea_set_placeholder_text(user_name, "Your name"); - lv_obj_add_event(user_name, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(user_name, ta_event_cb, LV_EVENT_ALL, kb); lv_obj_t * password_label = lv_label_create(panel2); lv_label_set_text(password_label, "Password"); @@ -318,7 +318,7 @@ static void profile_create(lv_obj_t * parent) lv_textarea_set_one_line(password, true); lv_textarea_set_password_mode(password, true); lv_textarea_set_placeholder_text(password, "Min. 8 chars."); - lv_obj_add_event(password, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(password, ta_event_cb, LV_EVENT_ALL, kb); lv_obj_t * gender_label = lv_label_create(panel2); lv_label_set_text(gender_label, "Gender"); @@ -333,7 +333,7 @@ static void profile_create(lv_obj_t * parent) lv_obj_t * birthdate = lv_textarea_create(panel2); lv_textarea_set_one_line(birthdate, true); - lv_obj_add_event(birthdate, birthday_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(birthdate, birthday_event_cb, LV_EVENT_ALL, NULL); /*Create the third panel*/ lv_obj_t * panel3 = lv_obj_create(parent); @@ -347,7 +347,7 @@ static void profile_create(lv_obj_t * parent) lv_obj_t * slider1 = lv_slider_create(panel3); lv_obj_set_width(slider1, LV_PCT(95)); - lv_obj_add_event(slider1, slider_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(slider1, slider_event_cb, LV_EVENT_ALL, NULL); lv_obj_add_flag(slider1, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); lv_obj_refresh_ext_draw_size(slider1); @@ -597,7 +597,7 @@ static lv_obj_t * create_chart_with_scales(lv_obj_t * parent, const char * title lv_chart_set_point_count(chart, 12); lv_obj_set_grid_cell(chart, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_STRETCH, 0, 1); lv_obj_set_style_border_width(chart, 0, 0); - lv_obj_add_event(chart, chart_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(chart, chart_event_cb, LV_EVENT_ALL, NULL); lv_obj_set_width(chart, lv_pct(200)); lv_obj_set_style_radius(chart, 0, 0); @@ -774,7 +774,7 @@ static void analytics_create(lv_obj_t * parent) lv_obj_center(arc); lv_timer_t * scale2_timer = lv_timer_create(scale2_timer_cb, 100, scale2); - lv_obj_add_event(scale2, delete_timer_event_cb, LV_EVENT_DELETE, scale2_timer); + lv_obj_add_event_cb(scale2, delete_timer_event_cb, LV_EVENT_DELETE, scale2_timer); /*Scale 3*/ lv_scale_set_range(scale3, 10, 60); @@ -820,7 +820,7 @@ static void analytics_create(lv_obj_t * parent) lv_style_set_line_width(&scale3_section3_tick_style, 4); lv_style_set_line_color(&scale3_section3_tick_style, lv_palette_darken(LV_PALETTE_GREEN, 2)); - lv_obj_add_event(scale3, scale3_delete_event_cb, LV_EVENT_DELETE, NULL); + lv_obj_add_event_cb(scale3, scale3_delete_event_cb, LV_EVENT_DELETE, NULL); lv_scale_section_t * section; section = lv_scale_add_section(scale3); @@ -896,7 +896,7 @@ void shop_create(lv_obj_t * parent) lv_chart_set_type(chart3, LV_CHART_TYPE_BAR); lv_chart_set_div_line_count(chart3, 6, 0); lv_chart_set_point_count(chart3, 7); - lv_obj_add_event(chart3, shop_chart_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(chart3, shop_chart_event_cb, LV_EVENT_ALL, NULL); ser4 = lv_chart_add_series(chart3, lv_theme_get_color_primary(chart3), LV_CHART_AXIS_PRIMARY_Y); lv_chart_set_next_value(chart3, ser4, lv_rand(60, 90)); @@ -1068,7 +1068,7 @@ static void color_changer_create(lv_obj_t * parent) lv_obj_set_style_radius(c, LV_RADIUS_CIRCLE, 0); 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_add_event_cb(c, color_event_cb, LV_EVENT_ALL, &palette[i]); lv_obj_remove_flag(c, LV_OBJ_FLAG_SCROLL_ON_FOCUS); } @@ -1077,7 +1077,7 @@ static void color_changer_create(lv_obj_t * parent) lv_obj_set_style_bg_color(btn, lv_color_white(), LV_STATE_CHECKED); lv_obj_set_style_pad_all(btn, 10, 0); lv_obj_set_style_radius(btn, LV_RADIUS_CIRCLE, 0); - lv_obj_add_event(btn, color_changer_event_cb, LV_EVENT_ALL, color_cont); + lv_obj_add_event_cb(btn, color_changer_event_cb, LV_EVENT_ALL, color_cont); lv_obj_set_style_shadow_width(btn, 0, 0); lv_obj_set_style_bg_image_src(btn, LV_SYMBOL_TINT, 0); @@ -1322,7 +1322,7 @@ static void birthday_event_cb(lv_event_t * e) else lv_obj_set_size(calendar, 300, 330); lv_calendar_set_showed_date(calendar, 1990, 01); lv_obj_align(calendar, LV_ALIGN_CENTER, 0, 30); - lv_obj_add_event(calendar, calendar_event_cb, LV_EVENT_ALL, ta); + lv_obj_add_event_cb(calendar, calendar_event_cb, LV_EVENT_ALL, ta); lv_calendar_header_dropdown_create(calendar); } diff --git a/docs/get-started/quick-overview.rst b/docs/get-started/quick-overview.rst index 8f80b2103..b84515467 100644 --- a/docs/get-started/quick-overview.rst +++ b/docs/get-started/quick-overview.rst @@ -171,7 +171,7 @@ A callback is assigned like this: .. code:: c - lv_obj_add_event(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/ + lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/ ... diff --git a/docs/integration/bindings/pikascript.rst b/docs/integration/bindings/pikascript.rst index 26c73b751..09b0ce4e4 100644 --- a/docs/integration/bindings/pikascript.rst +++ b/docs/integration/bindings/pikascript.rst @@ -101,8 +101,8 @@ LV_BTN btn1.align(lv.ALIGN.TOP_MID, 0, 10) 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) + btn1.add_event_cb(event_cb_1, lv.EVENT.CLICKED, 0) + btn2.add_event_cb(event_cb_2, lv.EVENT.CLICKED, 0) print('mem used max: %0.2f kB' % (mem.getMax())) print('mem used now: %0.2f kB' % (mem.getNow())) diff --git a/docs/integration/driver/X11.rst b/docs/integration/driver/X11.rst index 0ceb40aef..c913e1079 100644 --- a/docs/integration/driver/X11.rst +++ b/docs/integration/driver/X11.rst @@ -104,7 +104,7 @@ Usage /* initialize X11 display driver */ lv_disp_t * disp = lv_x11_window_create("LVGL X11 Simulation", monitor_hor_res, monitor_ver_res); - lv_display_add_event(disp, on_close_cb, LV_EVENT_DELETE, disp); + lv_display_add_event_cb(disp, on_close_cb, LV_EVENT_DELETE, disp); /* initialize X11 input drivers (for keyboard, mouse & mousewheel) */ LV_IMG_DECLARE(my_mouse_cursor_icon); diff --git a/docs/overview/event.rst b/docs/overview/event.rst index c210c27b0..00e9c3eec 100644 --- a/docs/overview/event.rst +++ b/docs/overview/event.rst @@ -21,7 +21,7 @@ In practice, it looks like this: .. code:: c 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*/ + lv_obj_add_event_cb(btn, my_event_cb, LV_EVENT_CLICKED, NULL); /*Assign an event callback*/ ... @@ -42,17 +42,17 @@ More events can be added to an object, like this: .. code:: c - lv_obj_add_event(obj, my_event_cb_1, LV_EVENT_CLICKED, NULL); - lv_obj_add_event(obj, my_event_cb_2, LV_EVENT_PRESSED, NULL); - lv_obj_add_event(obj, my_event_cb_3, LV_EVENT_ALL, NULL); /*No filtering, receive all events*/ + lv_obj_add_event_cb(obj, my_event_cb_1, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(obj, my_event_cb_2, LV_EVENT_PRESSED, NULL); + lv_obj_add_event_cb(obj, my_event_cb_3, LV_EVENT_ALL, NULL); /*No filtering, receive all events*/ Even the same event callback can be used on an object with different ``user_data``. For example: .. code:: c - lv_obj_add_event(obj, increment_on_click, LV_EVENT_CLICKED, &num1); - lv_obj_add_event(obj, increment_on_click, LV_EVENT_CLICKED, &num2); + lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num1); + lv_obj_add_event_cb(obj, increment_on_click, LV_EVENT_CLICKED, &num2); The events will be called in the order as they were added. diff --git a/docs/overview/indev.rst b/docs/overview/indev.rst index d439a4d43..3257dcf6d 100644 --- a/docs/overview/indev.rst +++ b/docs/overview/indev.rst @@ -65,7 +65,7 @@ event. For example: ... - lv_obj_add_event(screen1, my_event, LV_EVENT_GESTURE, NULL); + lv_obj_add_event_cb(screen1, my_event, LV_EVENT_GESTURE, NULL); To prevent passing the gesture event to the parent from an object use :cpp:expr:`lv_obj_remove_flag(obj, LV_OBJ_FLAG_GESTURE_BUBBLE)`. diff --git a/docs/overview/scroll.rst b/docs/overview/scroll.rst index d3460ba48..862ce4fc4 100644 --- a/docs/overview/scroll.rst +++ b/docs/overview/scroll.rst @@ -225,7 +225,7 @@ to combine scroll event and store the scroll top position. } lv_obj_t* container = lv_obj_create(NULL); - lv_obj_add_event(container, store_scroll_value_event_cb, LV_EVENT_SCROLL, NULL); + lv_obj_add_event_cb(container, store_scroll_value_event_cb, LV_EVENT_SCROLL, NULL); Scroll coordinates can be retrieved from different axes with these functions: diff --git a/docs/porting/disp.rst b/docs/porting/disp.rst index 0a57d730c..d93a61188 100644 --- a/docs/porting/disp.rst +++ b/docs/porting/disp.rst @@ -198,7 +198,7 @@ be stored in display object. Events ****** -:cpp:expr:`lv_disp_add_event(disp, event_cb, LV_DISP_EVENT_..., user_data)` adds +:cpp:expr:`lv_disp_add_event_cb(disp, event_cb, LV_DISP_EVENT_..., user_data)` adds an event handler to a display. The following events are sent: - :cpp:enumerator:`LV_DISP_EVENT_INVALIDATE_AREA` An area is invalidated (marked for redraw). diff --git a/docs/widgets/obj.rst b/docs/widgets/obj.rst index e499ff049..9bc0bf10c 100644 --- a/docs/widgets/obj.rst +++ b/docs/widgets/obj.rst @@ -128,7 +128,7 @@ Events ------ To set an event callback for an object, use -:cpp:expr:`lv_obj_add_event(obj, event_cb, LV_EVENT_..., user_data)`, +:cpp:expr:`lv_obj_add_event_cb(obj, event_cb, LV_EVENT_..., user_data)`, To manually send an event to an object, use :cpp:expr:`lv_event_send(obj, LV_EVENT_..., param)` diff --git a/env_support/pikascript/pika_lvgl_lv_obj.c b/env_support/pikascript/pika_lvgl_lv_obj.c index 12ecd8150..915403bb0 100644 --- a/env_support/pikascript/pika_lvgl_lv_obj.c +++ b/env_support/pikascript/pika_lvgl_lv_obj.c @@ -81,12 +81,12 @@ void eventLicener_registerEvent(PikaObj* self, strsDeinit(&buffs); } -void pika_lvgl_lv_obj_add_event(PikaObj* self, +void pika_lvgl_lv_obj_add_event_cb(PikaObj* self, Arg* event_cb, int filter, void* user_data) { lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj"); - lv_obj_add_event(lv_obj, __pika_event_cb, filter, NULL); + lv_obj_add_event_cb(lv_obj, __pika_event_cb, filter, NULL); obj_setArg(self, "_event_cb", event_cb); obj_setPtr(self, "_event_user_data", user_data); obj_newDirectObj(self, "_event_evt", New_pika_lvgl_lv_event); diff --git a/examples/anim/lv_example_anim_1.c b/examples/anim/lv_example_anim_1.c index b9f630cbe..40ebfc07b 100644 --- a/examples/anim/lv_example_anim_1.c +++ b/examples/anim/lv_example_anim_1.c @@ -46,7 +46,7 @@ void lv_example_anim_1(void) 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); + lv_obj_add_event_cb(sw, sw_event_cb, LV_EVENT_VALUE_CHANGED, label); } #endif diff --git a/examples/anim/lv_example_anim_1.py b/examples/anim/lv_example_anim_1.py index 0cf6232eb..df0314459 100644 --- a/examples/anim/lv_example_anim_1.py +++ b/examples/anim/lv_example_anim_1.py @@ -35,7 +35,7 @@ label.set_pos(100, 10) 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) +sw.add_event_cb(lambda e: sw_event_cb(e,label), lv.EVENT.VALUE_CHANGED, None) diff --git a/examples/anim/lv_example_anim_3.c b/examples/anim/lv_example_anim_3.c index fb033a055..39c388a32 100644 --- a/examples/anim/lv_example_anim_3.c +++ b/examples/anim/lv_example_anim_3.c @@ -139,13 +139,13 @@ static void page_obj_init(lv_obj_t * par) lv_slider_set_range(ginfo.p2_slider, 0, 1024); lv_obj_set_style_pad_all(ginfo.p1_slider, 2, LV_PART_KNOB); lv_obj_set_style_pad_all(ginfo.p2_slider, 2, LV_PART_KNOB); - lv_obj_add_event(ginfo.p1_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); - lv_obj_add_event(ginfo.p2_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(ginfo.p1_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(ginfo.p2_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_grid_cell(ginfo.p1_slider, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_START, 1, 1); lv_obj_set_grid_cell(ginfo.p2_slider, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_START, 2, 1); ginfo.run_btn = lv_button_create(par); - lv_obj_add_event(ginfo.run_btn, run_button_event_handler, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(ginfo.run_btn, run_button_event_handler, LV_EVENT_CLICKED, NULL); lv_obj_t * btn_label = lv_label_create(ginfo.run_btn); lv_label_set_text(btn_label, LV_SYMBOL_PLAY); lv_obj_center(btn_label); diff --git a/examples/anim/lv_example_anim_3.py b/examples/anim/lv_example_anim_3.py index 5decd0a41..f111d4438 100644 --- a/examples/anim/lv_example_anim_3.py +++ b/examples/anim/lv_example_anim_3.py @@ -59,13 +59,13 @@ class LvExampleAnim_3(): self.p2_slider.set_range(0, 1024) self.p1_slider.set_style_pad_all(2, lv.PART.KNOB) self.p2_slider.set_style_pad_all(2, lv.PART.KNOB) - self.p1_slider.add_event(self.slider_event_cb, lv.EVENT.VALUE_CHANGED, None) - self.p2_slider.add_event(self.slider_event_cb, lv.EVENT.VALUE_CHANGED, None) + self.p1_slider.add_event_cb(self.slider_event_cb, lv.EVENT.VALUE_CHANGED, None) + self.p2_slider.add_event_cb(self.slider_event_cb, lv.EVENT.VALUE_CHANGED, None) self.p1_slider.set_grid_cell(lv.GRID_ALIGN.STRETCH, 1, 1,lv.GRID_ALIGN.START, 1, 1) self.p2_slider.set_grid_cell(lv.GRID_ALIGN.STRETCH, 1, 1,lv.GRID_ALIGN.START, 2, 1) self.run_button = lv.button(par) - self.run_button.add_event(self.run_button_event_handler, lv.EVENT.CLICKED, None) + self.run_button.add_event_cb(self.run_button_event_handler, lv.EVENT.CLICKED, None) button_label = lv.label(self.run_button) button_label.set_text(lv.SYMBOL.PLAY) button_label.center() diff --git a/examples/anim/lv_example_anim_timeline_1.c b/examples/anim/lv_example_anim_timeline_1.c index fa70d66b8..148ab17f2 100644 --- a/examples/anim/lv_example_anim_timeline_1.c +++ b/examples/anim/lv_example_anim_timeline_1.c @@ -142,7 +142,7 @@ void lv_example_anim_timeline_1(void) /* create btn_start */ lv_obj_t * btn_start = lv_button_create(par); - lv_obj_add_event(btn_start, btn_start_event_handler, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(btn_start, btn_start_event_handler, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_flag(btn_start, LV_OBJ_FLAG_IGNORE_LAYOUT); lv_obj_add_flag(btn_start, LV_OBJ_FLAG_CHECKABLE); lv_obj_align(btn_start, LV_ALIGN_TOP_MID, -100, 20); @@ -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_delete_event_handler, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(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); @@ -163,7 +163,7 @@ void lv_example_anim_timeline_1(void) /* create btn_stop */ lv_obj_t * btn_stop = lv_button_create(par); - lv_obj_add_event(btn_stop, btn_stop_event_handler, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(btn_stop, btn_stop_event_handler, LV_EVENT_CLICKED, NULL); lv_obj_add_flag(btn_stop, LV_OBJ_FLAG_IGNORE_LAYOUT); lv_obj_align(btn_stop, LV_ALIGN_TOP_MID, 100, 20); @@ -173,7 +173,7 @@ void lv_example_anim_timeline_1(void) /* create slider_prg */ lv_obj_t * slider_prg = lv_slider_create(par); - lv_obj_add_event(slider_prg, slider_prg_event_handler, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(slider_prg, slider_prg_event_handler, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_flag(slider_prg, LV_OBJ_FLAG_IGNORE_LAYOUT); lv_obj_align(slider_prg, LV_ALIGN_BOTTOM_MID, 0, -20); lv_slider_set_range(slider_prg, 0, 65535); diff --git a/examples/anim/lv_example_anim_timeline_1.py b/examples/anim/lv_example_anim_timeline_1.py index 0e578b7eb..135a760e4 100644 --- a/examples/anim/lv_example_anim_timeline_1.py +++ b/examples/anim/lv_example_anim_timeline_1.py @@ -12,7 +12,7 @@ class LV_ExampleAnimTimeline_1(object): self.par.set_flex_align(lv.FLEX_ALIGN.SPACE_AROUND, lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.CENTER) self.button_run = lv.button(self.par) - self.button_run.add_event(self.button_run_event_handler, lv.EVENT.VALUE_CHANGED, None) + self.button_run.add_event_cb(self.button_run_event_handler, lv.EVENT.VALUE_CHANGED, None) self.button_run.add_flag(lv.obj.FLAG.IGNORE_LAYOUT) self.button_run.add_flag(lv.obj.FLAG.CHECKABLE) self.button_run.align(lv.ALIGN.TOP_MID, -50, 20) @@ -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_delete_event_handler, lv.EVENT.CLICKED, None) + self.button_del.add_event_cb(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) @@ -31,7 +31,7 @@ class LV_ExampleAnimTimeline_1(object): self.label_del.center() self.slider = lv.slider(self.par) - self.slider.add_event(self.slider_prg_event_handler, lv.EVENT.VALUE_CHANGED, None) + self.slider.add_event_cb(self.slider_prg_event_handler, lv.EVENT.VALUE_CHANGED, None) self.slider.add_flag(lv.obj.FLAG.IGNORE_LAYOUT) self.slider.align(lv.ALIGN.BOTTOM_RIGHT, -20, -20) self.slider.set_range(0, 65535) diff --git a/examples/event/lv_example_event_1.c b/examples/event/lv_example_event_1.c index eb0f8eb3a..a6162859f 100644 --- a/examples/event/lv_example_event_1.c +++ b/examples/event/lv_example_event_1.c @@ -20,7 +20,7 @@ void lv_example_event_1(void) 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); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, NULL); lv_obj_t * label = lv_label_create(btn); lv_label_set_text(label, "Click me!"); diff --git a/examples/event/lv_example_event_1.py b/examples/event/lv_example_event_1.py index c14c4ceb8..8b1d52e22 100644 --- a/examples/event/lv_example_event_1.py +++ b/examples/event/lv_example_event_1.py @@ -8,7 +8,7 @@ class Event_1(): button = lv.button(lv.screen_active()) button.set_size(100, 50) button.center() - button.add_event(self.event_cb, lv.EVENT.CLICKED, None) + button.add_event_cb(self.event_cb, lv.EVENT.CLICKED, None) label = lv.label(button) label.set_text("Click me!") diff --git a/examples/event/lv_example_event_2.c b/examples/event/lv_example_event_2.c index c883e2a2f..35d2f757c 100644 --- a/examples/event/lv_example_event_2.c +++ b/examples/event/lv_example_event_2.c @@ -40,7 +40,7 @@ void lv_example_event_2(void) 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); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_ALL, info_label); } #endif diff --git a/examples/event/lv_example_event_2.py b/examples/event/lv_example_event_2.py index e0a419da2..c6c914d04 100644 --- a/examples/event/lv_example_event_2.py +++ b/examples/event/lv_example_event_2.py @@ -19,4 +19,4 @@ button_label.center() 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) +button.add_event_cb(lambda e: event_cb(e,info_label), lv.EVENT.ALL, None) diff --git a/examples/event/lv_example_event_3.c b/examples/event/lv_example_event_3.c index 783bb74fb..6a8f3cb21 100644 --- a/examples/event/lv_example_event_3.c +++ b/examples/event/lv_example_event_3.c @@ -38,7 +38,7 @@ void lv_example_event_3(void) lv_obj_center(label); } - lv_obj_add_event(cont, event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(cont, event_cb, LV_EVENT_CLICKED, NULL); } #endif diff --git a/examples/event/lv_example_event_3.py b/examples/event/lv_example_event_3.py index 14b8f2fb3..9df6e2b66 100644 --- a/examples/event/lv_example_event_3.py +++ b/examples/event/lv_example_event_3.py @@ -31,4 +31,4 @@ for i in range(30): label.set_text("{:d}".format(i)) label.center() -cont.add_event(event_cb, lv.EVENT.CLICKED, None) +cont.add_event_cb(event_cb, lv.EVENT.CLICKED, None) diff --git a/examples/event/lv_example_event_4.c b/examples/event/lv_example_event_4.c index 3262441eb..fac535a89 100644 --- a/examples/event/lv_example_event_4.c +++ b/examples/event/lv_example_event_4.c @@ -50,7 +50,7 @@ void lv_example_event_4(void) 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); + lv_obj_add_event_cb(cont, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_add_flag(cont, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); lv_timer_create(timer_cb, 30, cont); } diff --git a/examples/event/lv_example_event_4.py b/examples/event/lv_example_event_4.py index 0a052bd6e..663b4d84d 100644 --- a/examples/event/lv_example_event_4.py +++ b/examples/event/lv_example_event_4.py @@ -9,7 +9,7 @@ class LV_Example_Event_4: 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) + self.cont.add_event_cb(self.event_cb, lv.EVENT.DRAW_TASK_ADDED, None) self.cont.add_flag(lv.obj.FLAG.SEND_DRAW_TASK_EVENTS) lv.timer_create(self.timer_cb, 30, None) diff --git a/examples/get_started/lv_example_get_started_2.c b/examples/get_started/lv_example_get_started_2.c index e92a5ccb9..a81b974b1 100644 --- a/examples/get_started/lv_example_get_started_2.c +++ b/examples/get_started/lv_example_get_started_2.c @@ -23,7 +23,7 @@ void lv_example_get_started_2(void) 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*/ + lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/ lv_obj_t * label = lv_label_create(btn); /*Add a label to the button*/ lv_label_set_text(label, "Button"); /*Set the labels text*/ diff --git a/examples/get_started/lv_example_get_started_2.py b/examples/get_started/lv_example_get_started_2.py index 7c467dd4e..afef21e7d 100644 --- a/examples/get_started/lv_example_get_started_2.py +++ b/examples/get_started/lv_example_get_started_2.py @@ -9,7 +9,7 @@ class CounterBtn(): button.set_pos(10, 10) # Set its position button.set_size(120, 50) # Set its size button.align(lv.ALIGN.CENTER,0,0) - button.add_event(self.button_event_cb, lv.EVENT.ALL, None) # Assign a callback to the button + button.add_event_cb(self.button_event_cb, lv.EVENT.ALL, None) # Assign a callback to the button label = lv.label(button) # Add a label to the button label.set_text("Button") # Set the labels text label.center() diff --git a/examples/get_started/lv_example_get_started_4.c b/examples/get_started/lv_example_get_started_4.c index 92a2bb9b9..4995ad1d5 100644 --- a/examples/get_started/lv_example_get_started_4.c +++ b/examples/get_started/lv_example_get_started_4.c @@ -21,7 +21,7 @@ void lv_example_get_started_4(void) 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*/ + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Assign an event function*/ /*Create a label above the slider*/ label = lv_label_create(lv_screen_active()); diff --git a/examples/get_started/lv_example_get_started_4.py b/examples/get_started/lv_example_get_started_4.py index dfaacd70d..8ae128952 100644 --- a/examples/get_started/lv_example_get_started_4.py +++ b/examples/get_started/lv_example_get_started_4.py @@ -12,7 +12,7 @@ def slider_event_cb(e): 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 +slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) # Assign an event function # Create a label above the slider label = lv.label(lv.screen_active()) diff --git a/examples/others/file_explorer/lv_example_file_explorer_1.c b/examples/others/file_explorer/lv_example_file_explorer_1.c index 8689401d4..ea92b030f 100644 --- a/examples/others/file_explorer/lv_example_file_explorer_1.c +++ b/examples/others/file_explorer/lv_example_file_explorer_1.c @@ -78,7 +78,7 @@ void lv_example_file_explorer_1(void) #endif #endif - lv_obj_add_event(file_explorer, file_explorer_event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(file_explorer, file_explorer_event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/others/file_explorer/lv_example_file_explorer_1.py b/examples/others/file_explorer/lv_example_file_explorer_1.py index f859e590a..d2da8204f 100644 --- a/examples/others/file_explorer/lv_example_file_explorer_1.py +++ b/examples/others/file_explorer/lv_example_file_explorer_1.py @@ -43,5 +43,5 @@ if LV_FILE_EXPLORER_QUICK_ACCESS : file_explorer.explorer_set_quick_access_path(lv.EXPLORER.DOCS_DIR, home_dir + "/Documents") file_explorer.explorer_set_quick_access_path(lv.EXPLORER.FS_DIR, "A:/") -file_explorer.add_event(file_explorer_event_handler, lv.EVENT.ALL, None) +file_explorer.add_event_cb(file_explorer_event_handler, lv.EVENT.ALL, None) diff --git a/examples/others/file_explorer/lv_example_file_explorer_2.c b/examples/others/file_explorer/lv_example_file_explorer_2.c index 19a599925..49aa38316 100644 --- a/examples/others/file_explorer/lv_example_file_explorer_2.c +++ b/examples/others/file_explorer/lv_example_file_explorer_2.c @@ -108,7 +108,7 @@ void lv_example_file_explorer_2(void) #endif #endif - lv_obj_add_event(file_explorer, file_explorer_event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(file_explorer, file_explorer_event_handler, LV_EVENT_ALL, NULL); /*Quick access status control button*/ lv_obj_t * fe_quick_access_obj = lv_file_explorer_get_quick_access_area(file_explorer); @@ -123,7 +123,7 @@ void lv_example_file_explorer_2(void) lv_label_set_text(label, LV_SYMBOL_LIST); lv_obj_center(label); - lv_obj_add_event(btn, btn_event_handler, LV_EVENT_VALUE_CHANGED, fe_quick_access_obj); + lv_obj_add_event_cb(btn, btn_event_handler, LV_EVENT_VALUE_CHANGED, fe_quick_access_obj); /*Sort control*/ static const char * opts = "NONE\n" @@ -136,7 +136,7 @@ void lv_example_file_explorer_2(void) lv_dropdown_set_options_static(dd, opts); lv_obj_align(dd, LV_ALIGN_RIGHT_MID, 0, 0); - lv_obj_add_event(dd, dd_event_handler, LV_EVENT_VALUE_CHANGED, file_explorer); + lv_obj_add_event_cb(dd, dd_event_handler, LV_EVENT_VALUE_CHANGED, file_explorer); } #endif diff --git a/examples/others/file_explorer/lv_example_file_explorer_2.py b/examples/others/file_explorer/lv_example_file_explorer_2.py index a9a32f2aa..8a6737928 100644 --- a/examples/others/file_explorer/lv_example_file_explorer_2.py +++ b/examples/others/file_explorer/lv_example_file_explorer_2.py @@ -68,7 +68,7 @@ if LV_FILE_EXPLORER_QUICK_ACCESS : file_explorer.explorer_set_quick_access_path(lv.EXPLORER.DOCS_DIR, home_dir + "/Documents") file_explorer.explorer_set_quick_access_path(lv.EXPLORER.FS_DIR, "A:/") -file_explorer.add_event(file_explorer_event_handler, lv.EVENT.ALL, None) +file_explorer.add_event_cb(file_explorer_event_handler, lv.EVENT.ALL, None) # Quick access status control button fe_quick_access_obj = file_explorer.explorer_get_quick_access_area() @@ -83,8 +83,8 @@ label = lv.label(button) label.set_text(lv.SYMBOL.LIST) label.center() -button.add_event(lambda evt: button_event_handler(evt,fe_quick_access_obj), lv.EVENT.VALUE_CHANGED, None) -#button.add_event(lambda evt: button_event_handler(evt,file_explorer), lv.EVENT.VALUE_CHANGED, None) +button.add_event_cb(lambda evt: button_event_handler(evt,fe_quick_access_obj), lv.EVENT.VALUE_CHANGED, None) +#button.add_event_cb(lambda evt: button_event_handler(evt,file_explorer), lv.EVENT.VALUE_CHANGED, None) # Sort control opts = "NONE\nKIND" @@ -97,6 +97,6 @@ dd.set_options_static(opts) dd.align(lv.ALIGN.RIGHT_MID, 0, 0) # lv_obj_align_to(dd, button, LV_ALIGN_OUT_RIGHT_MID, 0, 0); -dd.add_event(lambda evt: dd_event_handler(evt,file_explorer), lv.EVENT.VALUE_CHANGED, None) -#dd.add_event(lambda evt: dd_event_handler(evt,fe_quick_access_obj), lv.EVENT.VALUE_CHANGED, None) +dd.add_event_cb(lambda evt: dd_event_handler(evt,file_explorer), lv.EVENT.VALUE_CHANGED, None) +#dd.add_event_cb(lambda evt: dd_event_handler(evt,fe_quick_access_obj), lv.EVENT.VALUE_CHANGED, None) diff --git a/examples/others/file_explorer/lv_example_file_explorer_3.c b/examples/others/file_explorer/lv_example_file_explorer_3.c index dbb5763de..b475d8a74 100644 --- a/examples/others/file_explorer/lv_example_file_explorer_3.c +++ b/examples/others/file_explorer/lv_example_file_explorer_3.c @@ -120,7 +120,7 @@ void lv_example_file_explorer_3(void) #endif #endif - lv_obj_add_event(file_explorer, file_explorer_event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(file_explorer, file_explorer_event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/others/file_explorer/lv_example_file_explorer_3.py b/examples/others/file_explorer/lv_example_file_explorer_3.py index 0f00a1939..a14e4a213 100644 --- a/examples/others/file_explorer/lv_example_file_explorer_3.py +++ b/examples/others/file_explorer/lv_example_file_explorer_3.py @@ -86,4 +86,4 @@ if LV_FILE_EXPLORER_QUICK_ACCESS : file_explorer.explorer_set_quick_access_path(lv.EXPLORER.DOCS_DIR, home_dir + "/Documents") file_explorer.explorer_set_quick_access_path(lv.EXPLORER.FS_DIR, "A:/") - file_explorer.add_event(file_explorer_event_handler, lv.EVENT.ALL, None) + file_explorer.add_event_cb(file_explorer_event_handler, lv.EVENT.ALL, None) diff --git a/examples/others/fragment/lv_example_fragment_1.c b/examples/others/fragment/lv_example_fragment_1.c index e7c2afcfe..6de981ae8 100644 --- a/examples/others/fragment/lv_example_fragment_1.c +++ b/examples/others/fragment/lv_example_fragment_1.c @@ -31,7 +31,7 @@ void lv_example_fragment_1(void) 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_delete, LV_EVENT_DELETE, manager); + lv_obj_add_event_cb(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); diff --git a/examples/others/fragment/lv_example_fragment_2.c b/examples/others/fragment/lv_example_fragment_2.c index 8b84967b0..5ec5f44a6 100644 --- a/examples/others/fragment/lv_example_fragment_2.c +++ b/examples/others/fragment/lv_example_fragment_2.c @@ -57,13 +57,13 @@ 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_delete, LV_EVENT_DELETE, manager); + lv_obj_add_event_cb(root, sample_container_delete, LV_EVENT_DELETE, manager); int depth = 0; lv_fragment_t * fragment = lv_fragment_create(&sample_cls, &depth); lv_fragment_manager_push(manager, fragment, &container); - lv_obj_add_event(push_btn, sample_push_click, LV_EVENT_CLICKED, manager); - lv_obj_add_event(pop_btn, sample_pop_click, LV_EVENT_CLICKED, manager); + lv_obj_add_event_cb(push_btn, sample_push_click, LV_EVENT_CLICKED, manager); + lv_obj_add_event_cb(pop_btn, sample_pop_click, LV_EVENT_CLICKED, manager); } static void sample_fragment_ctor(lv_fragment_t * self, void * args) @@ -91,7 +91,7 @@ static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * pa lv_obj_t * inc_btn = lv_button_create(content); lv_obj_t * inc_label = lv_label_create(inc_btn); lv_label_set_text(inc_label, "+1"); - lv_obj_add_event(inc_btn, sample_fragment_inc_click, LV_EVENT_CLICKED, fragment); + lv_obj_add_event_cb(inc_btn, sample_fragment_inc_click, LV_EVENT_CLICKED, fragment); return content; } diff --git a/examples/others/gridnav/lv_example_gridnav_3.c b/examples/others/gridnav/lv_example_gridnav_3.c index 2c0cbecfb..320c8418d 100644 --- a/examples/others/gridnav/lv_example_gridnav_3.c +++ b/examples/others/gridnav/lv_example_gridnav_3.c @@ -71,7 +71,7 @@ void lv_example_gridnav_3(void) /*Only the container needs to be in a group*/ lv_group_add_obj(lv_group_get_default(), cont_sub2); - lv_obj_add_event(cont_sub2, cont_sub_event_cb, LV_EVENT_KEY, NULL); + lv_obj_add_event_cb(cont_sub2, cont_sub_event_cb, LV_EVENT_KEY, NULL); /*Use flex here, but works with grid or manually placed objects as well*/ lv_obj_set_flex_flow(cont_sub2, LV_FLEX_FLOW_ROW_WRAP); diff --git a/examples/others/gridnav/lv_example_gridnav_3.py b/examples/others/gridnav/lv_example_gridnav_3.py index cbd561d82..2418542e4 100644 --- a/examples/others/gridnav/lv_example_gridnav_3.py +++ b/examples/others/gridnav/lv_example_gridnav_3.py @@ -61,7 +61,7 @@ lv.gridnav_add(cont_sub2, lv.GRIDNAV_CTRL.ROLLOVER) #Only the container needs to be in a group lv.group_get_default().add_obj(cont_sub2) -cont_sub2.add_event(cont_sub_event_cb, lv.EVENT.KEY, None) +cont_sub2.add_event_cb(cont_sub_event_cb, lv.EVENT.KEY, None) # Use flex here, but works with grid or manually placed objects as well cont_sub2.set_flex_flow(lv.FLEX_FLOW.ROW_WRAP) diff --git a/examples/others/gridnav/lv_example_gridnav_4.c b/examples/others/gridnav/lv_example_gridnav_4.c index 3668ee322..366a6f7e2 100644 --- a/examples/others/gridnav/lv_example_gridnav_4.c +++ b/examples/others/gridnav/lv_example_gridnav_4.c @@ -33,7 +33,7 @@ void lv_example_gridnav_4(void) lv_snprintf(buf, sizeof(buf), "File %d", i + 1); lv_obj_t * item = lv_list_add_button(list, LV_SYMBOL_FILE, buf); - lv_obj_add_event(item, event_handler, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(item, event_handler, LV_EVENT_CLICKED, NULL); lv_group_remove_obj(item); /*The default group adds it automatically*/ } diff --git a/examples/others/gridnav/lv_example_gridnav_4.py b/examples/others/gridnav/lv_example_gridnav_4.py index 7281d8202..a5c6d92c0 100644 --- a/examples/others/gridnav/lv_example_gridnav_4.py +++ b/examples/others/gridnav/lv_example_gridnav_4.py @@ -26,7 +26,7 @@ for i in range(20): txt = "File {:d}".format(i + 1) #lv_snprintf(buf, sizeof(buf), "File %d", i + 1); item = list.add_button(lv.SYMBOL.FILE, txt) - item.add_event(event_handler, lv.EVENT.CLICKED, None) + item.add_event_cb(event_handler, lv.EVENT.CLICKED, None) lv.group_remove_obj(item) # The default group adds it automatically button = lv.button(lv.screen_active()) diff --git a/examples/others/ime/lv_example_ime_pinyin_1.c b/examples/others/ime/lv_example_ime_pinyin_1.c index 2f7cd55af..c706ab599 100644 --- a/examples/others/ime/lv_example_ime_pinyin_1.c +++ b/examples/others/ime/lv_example_ime_pinyin_1.c @@ -37,7 +37,7 @@ void lv_example_ime_pinyin_1(void) lv_ime_pinyin_set_keyboard(pinyin_ime, kb); lv_keyboard_set_textarea(kb, ta1); - lv_obj_add_event(ta1, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb); /*Get the cand_panel, and adjust its size and position*/ lv_obj_t * cand_panel = lv_ime_pinyin_get_cand_panel(pinyin_ime); diff --git a/examples/others/ime/lv_example_ime_pinyin_1.py b/examples/others/ime/lv_example_ime_pinyin_1.py index 9c4c7ecce..da3d496bf 100644 --- a/examples/others/ime/lv_example_ime_pinyin_1.py +++ b/examples/others/ime/lv_example_ime_pinyin_1.py @@ -36,7 +36,7 @@ kb = lv.keyboard(lv.screen_active()) pinyin_ime.pinyin_set_keyboard(kb) kb.set_textarea(ta1) -ta1.add_event(lambda evt: ta_event_cb(evt,kb), lv.EVENT.ALL, None) +ta1.add_event_cb(lambda evt: ta_event_cb(evt,kb), lv.EVENT.ALL, None) # Get the cand_panel, and adjust its size and position cand_panel = pinyin_ime.pinyin_get_cand_panel() diff --git a/examples/others/ime/lv_example_ime_pinyin_2.c b/examples/others/ime/lv_example_ime_pinyin_2.c index d5b7ac593..1227bfe55 100644 --- a/examples/others/ime/lv_example_ime_pinyin_2.c +++ b/examples/others/ime/lv_example_ime_pinyin_2.c @@ -39,7 +39,7 @@ void lv_example_ime_pinyin_2(void) lv_ime_pinyin_set_keyboard(pinyin_ime, kb); lv_ime_pinyin_set_mode(pinyin_ime, LV_IME_PINYIN_MODE_K9); // Set to 9-key input mode. Default: 26-key input(k26) mode. - lv_obj_add_event(ta1, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb); /*Get the cand_panel, and adjust its size and position*/ lv_obj_t * cand_panel = lv_ime_pinyin_get_cand_panel(pinyin_ime); diff --git a/examples/others/ime/lv_example_ime_pinyin_2.py b/examples/others/ime/lv_example_ime_pinyin_2.py index 8a6f1d4ed..4bc38e9cd 100644 --- a/examples/others/ime/lv_example_ime_pinyin_2.py +++ b/examples/others/ime/lv_example_ime_pinyin_2.py @@ -38,7 +38,7 @@ kb.set_textarea(ta1) pinyin_ime.pinyin_set_keyboard(kb) pinyin_ime.pinyin_set_mode(lv.ime_pinyin.PINYIN_MODE.K9) # Set to 9-key input mode. Default: 26-key input(k26) mode. -ta1.add_event(lambda evt: ta_event_cb(evt,kb), lv.EVENT.ALL, None) +ta1.add_event_cb(lambda evt: ta_event_cb(evt,kb), lv.EVENT.ALL, None) # Get the cand_panel, and adjust its size and position cand_panel = pinyin_ime.pinyin_get_cand_panel() diff --git a/examples/others/observer/lv_example_observer_2.c b/examples/others/observer/lv_example_observer_2.c index 858891c0e..1260e0d8a 100644 --- a/examples/others/observer/lv_example_observer_2.c +++ b/examples/others/observer/lv_example_observer_2.c @@ -99,7 +99,7 @@ static void ui_init(void) lv_textarea_set_one_line(ta, true); lv_textarea_set_password_mode(ta, true); lv_textarea_set_placeholder_text(ta, "The password is: hello"); - lv_obj_add_event(ta, textarea_event_cb, LV_EVENT_READY, NULL); + lv_obj_add_event_cb(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_screen_active()); @@ -111,7 +111,7 @@ static void ui_init(void) /*Create a log out button which will be active only when logged in*/ 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_add_event_cb(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); label = lv_label_create(btn); diff --git a/examples/others/observer/lv_example_observer_3.c b/examples/others/observer/lv_example_observer_3.c index b2fa5cf6a..b517001e2 100644 --- a/examples/others/observer/lv_example_observer_3.c +++ b/examples/others/observer/lv_example_observer_3.c @@ -55,7 +55,7 @@ void lv_example_observer_3(void) 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); + lv_obj_add_event_cb(set_btn, set_btn_clicked_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_t * set_label = lv_label_create(set_btn); lv_label_set_text(set_label, "Set"); @@ -102,7 +102,7 @@ static void set_btn_clicked_event_cb(lv_event_t * e) lv_obj_t * close_btn = lv_button_create(cont); lv_obj_align(close_btn, LV_ALIGN_TOP_RIGHT, 0, 0); /*Pass the set_btn as user_data to make it non-disabled on close*/ - lv_obj_add_event(close_btn, close_clicked_event_cb, LV_EVENT_CLICKED, set_btn); + lv_obj_add_event_cb(close_btn, close_clicked_event_cb, LV_EVENT_CLICKED, set_btn); lv_obj_t * close_label = lv_label_create(close_btn); lv_label_set_text(close_label, LV_SYMBOL_CLOSE); diff --git a/examples/others/observer/lv_example_observer_4.c b/examples/others/observer/lv_example_observer_4.c index 44ac1483e..60d40b2cf 100644 --- a/examples/others/observer/lv_example_observer_4.c +++ b/examples/others/observer/lv_example_observer_4.c @@ -156,7 +156,7 @@ static void btn_create(lv_obj_t * parent, const char * text) lv_obj_set_height(btn, lv_pct(100)); lv_obj_set_style_radius(btn, 0, 0); lv_subject_add_observer_obj(¤t_tab_subject, btn_observer_cb, btn, NULL); - lv_obj_add_event(btn, btn_click_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(btn, btn_click_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_t * label = lv_label_create(btn); lv_label_set_text(label, text); diff --git a/examples/others/observer/lv_example_observer_5.c b/examples/others/observer/lv_example_observer_5.c index 68e829d7e..4334f9a42 100644 --- a/examples/others/observer/lv_example_observer_5.c +++ b/examples/others/observer/lv_example_observer_5.c @@ -34,7 +34,7 @@ void lv_example_observer_5(void) /*Create start FW update button*/ 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_add_event_cb(btn, fw_update_btn_clicked_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_center(btn); lv_obj_t * label = lv_label_create(btn); lv_label_set_text(label, "Firmware update"); @@ -53,7 +53,7 @@ static void fw_update_btn_clicked_event_cb(lv_event_t * e) lv_obj_set_style_shadow_color(win, lv_color_hex3(0x888), 0); lv_win_add_title(win, "Firmware update"); lv_obj_t * btn = lv_win_add_button(win, LV_SYMBOL_CLOSE, 40); - lv_obj_add_event(btn, fw_update_close_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(btn, fw_update_close_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_center(win); lv_subject_set_int(&fw_update_status_subject, FW_UPDATE_STATE_IDLE); @@ -110,7 +110,7 @@ static void fw_update_win_observer_cb(lv_subject_t * subject, lv_observer_t * ob lv_obj_t * btn = lv_button_create(cont); lv_obj_align(btn, LV_ALIGN_CENTER, 0, 20); - lv_obj_add_event(btn, restart_btn_click_event_cb, LV_EVENT_CLICKED, win); + lv_obj_add_event_cb(btn, restart_btn_click_event_cb, LV_EVENT_CLICKED, win); label = lv_label_create(btn); lv_label_set_text(label, "Restart"); diff --git a/examples/others/observer/lv_example_observer_6.c b/examples/others/observer/lv_example_observer_6.c index 7df722c14..813c574fb 100644 --- a/examples/others/observer/lv_example_observer_6.c +++ b/examples/others/observer/lv_example_observer_6.c @@ -179,7 +179,7 @@ static lv_obj_t * my_button_create(lv_obj_t * parent, const char * text, lv_even lv_obj_remove_style_all(btn); lv_obj_add_style(btn, &styles.style_main, 0); lv_obj_add_style(btn, &styles.style_pressed, LV_STATE_PRESSED); - lv_obj_add_event(btn, event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, NULL); lv_obj_t * label = lv_label_create(btn); lv_label_set_text(label, text); diff --git a/examples/others/snapshot/lv_example_snapshot_1.c b/examples/others/snapshot/lv_example_snapshot_1.c index a90415edb..89e3ab4d1 100644 --- a/examples/others/snapshot/lv_example_snapshot_1.c +++ b/examples/others/snapshot/lv_example_snapshot_1.c @@ -50,8 +50,8 @@ void lv_example_snapshot_1(void) lv_obj_set_style_bg_opa(img, LV_OPA_COVER, 0); // lv_obj_set_style_transform_scale(img, 400, LV_STATE_PRESSED); lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE); - lv_obj_add_event(img, event_cb, LV_EVENT_PRESSED, snapshot_obj); - lv_obj_add_event(img, event_cb, LV_EVENT_RELEASED, snapshot_obj); + lv_obj_add_event_cb(img, event_cb, LV_EVENT_PRESSED, snapshot_obj); + lv_obj_add_event_cb(img, event_cb, LV_EVENT_RELEASED, snapshot_obj); } } diff --git a/examples/others/snapshot/lv_example_snapshot_1.py b/examples/others/snapshot/lv_example_snapshot_1.py index a6de5c5a9..79c32fcb5 100644 --- a/examples/others/snapshot/lv_example_snapshot_1.py +++ b/examples/others/snapshot/lv_example_snapshot_1.py @@ -61,5 +61,5 @@ for i in range(4): image.set_style_bg_opa(lv.OPA.COVER, 0) image.set_style_transform_scale(400, lv.STATE.PRESSED) image.add_flag(image.FLAG.CLICKABLE) - image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.PRESSED, None) - image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.RELEASED, None) + image.add_event_cb(lambda e: event_cb(e, snapshot_obj), lv.EVENT.PRESSED, None) + image.add_event_cb(lambda e: event_cb(e, snapshot_obj), lv.EVENT.RELEASED, None) diff --git a/examples/scroll/lv_example_scroll_2.c b/examples/scroll/lv_example_scroll_2.c index 6448ce65a..13385c235 100644 --- a/examples/scroll/lv_example_scroll_2.c +++ b/examples/scroll/lv_example_scroll_2.c @@ -47,7 +47,7 @@ void lv_example_scroll_2(void) /*Switch between "One scroll" and "Normal scroll" mode*/ lv_obj_t * sw = lv_switch_create(lv_screen_active()); lv_obj_align(sw, LV_ALIGN_TOP_RIGHT, -20, 10); - lv_obj_add_event(sw, sw_event_cb, LV_EVENT_ALL, panel); + lv_obj_add_event_cb(sw, sw_event_cb, LV_EVENT_ALL, panel); lv_obj_t * label = lv_label_create(lv_screen_active()); lv_label_set_text(label, "One scroll"); lv_obj_align_to(label, sw, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); diff --git a/examples/scroll/lv_example_scroll_2.py b/examples/scroll/lv_example_scroll_2.py index 97ffe0beb..7b16f2501 100644 --- a/examples/scroll/lv_example_scroll_2.py +++ b/examples/scroll/lv_example_scroll_2.py @@ -39,7 +39,7 @@ panel.update_snap(lv.ANIM.ON) # Switch between "One scroll" and "Normal scroll" mode sw = lv.switch(lv.screen_active()) sw.align(lv.ALIGN.TOP_RIGHT, -20, 10) -sw.add_event(lambda evt: sw_event_cb(evt,panel), lv.EVENT.ALL, None) +sw.add_event_cb(lambda evt: sw_event_cb(evt,panel), lv.EVENT.ALL, None) label = lv.label(lv.screen_active()) label.set_text("One scroll") label.align_to(sw, lv.ALIGN.OUT_BOTTOM_MID, 0, 5) diff --git a/examples/scroll/lv_example_scroll_3.c b/examples/scroll/lv_example_scroll_3.c index 520d384a6..8181c4349 100644 --- a/examples/scroll/lv_example_scroll_3.c +++ b/examples/scroll/lv_example_scroll_3.c @@ -40,7 +40,7 @@ void lv_example_scroll_3(void) lv_obj_set_size(float_btn, 50, 50); lv_obj_add_flag(float_btn, LV_OBJ_FLAG_FLOATING); lv_obj_align(float_btn, LV_ALIGN_BOTTOM_RIGHT, 0, -lv_obj_get_style_pad_right(list, LV_PART_MAIN)); - lv_obj_add_event(float_btn, float_button_event_cb, LV_EVENT_ALL, list); + lv_obj_add_event_cb(float_btn, float_button_event_cb, LV_EVENT_ALL, list); lv_obj_set_style_radius(float_btn, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_bg_image_src(float_btn, LV_SYMBOL_PLUS, 0); lv_obj_set_style_text_font(float_btn, lv_theme_get_font_large(float_btn), 0); diff --git a/examples/scroll/lv_example_scroll_3.py b/examples/scroll/lv_example_scroll_3.py index 4e9281a15..bf4d83801 100644 --- a/examples/scroll/lv_example_scroll_3.py +++ b/examples/scroll/lv_example_scroll_3.py @@ -16,7 +16,7 @@ class ScrollExample_3(): float_button.set_size(50, 50) float_button.add_flag(lv.obj.FLAG.FLOATING) float_button.align(lv.ALIGN.BOTTOM_RIGHT, 0, -list.get_style_pad_right(lv.PART.MAIN)) - float_button.add_event(lambda evt: self.float_button_event_cb(evt,list), lv.EVENT.ALL, None) + float_button.add_event_cb(lambda evt: self.float_button_event_cb(evt,list), lv.EVENT.ALL, None) float_button.set_style_radius(lv.RADIUS_CIRCLE, 0) float_button.set_style_bg_image_src(lv.SYMBOL.PLUS, 0) float_button.set_style_text_font(lv.theme_get_font_large(float_button), 0) diff --git a/examples/scroll/lv_example_scroll_6.c b/examples/scroll/lv_example_scroll_6.c index 01db4be0e..66dc60da7 100644 --- a/examples/scroll/lv_example_scroll_6.c +++ b/examples/scroll/lv_example_scroll_6.c @@ -54,7 +54,7 @@ void lv_example_scroll_6(void) lv_obj_set_size(cont, 200, 200); lv_obj_center(cont); lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN); - lv_obj_add_event(cont, scroll_event_cb, LV_EVENT_SCROLL, NULL); + lv_obj_add_event_cb(cont, scroll_event_cb, LV_EVENT_SCROLL, NULL); lv_obj_set_style_radius(cont, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_clip_corner(cont, true, 0); lv_obj_set_scroll_dir(cont, LV_DIR_VER); diff --git a/examples/scroll/lv_example_scroll_6.py b/examples/scroll/lv_example_scroll_6.py index 4f5aa5b96..e7926a6b2 100644 --- a/examples/scroll/lv_example_scroll_6.py +++ b/examples/scroll/lv_example_scroll_6.py @@ -46,7 +46,7 @@ cont = lv.obj(lv.screen_active()) cont.set_size(200, 200) cont.center() cont.set_flex_flow(lv.FLEX_FLOW.COLUMN) -cont.add_event(scroll_event_cb, lv.EVENT.SCROLL, None) +cont.add_event_cb(scroll_event_cb, lv.EVENT.SCROLL, None) cont.set_style_radius(lv.RADIUS_CIRCLE, 0) cont.set_style_clip_corner(True, 0) cont.set_scroll_dir(lv.DIR.VER) diff --git a/examples/widgets/arc/lv_example_arc_1.c b/examples/widgets/arc/lv_example_arc_1.c index 052eda8e4..045c23f69 100644 --- a/examples/widgets/arc/lv_example_arc_1.c +++ b/examples/widgets/arc/lv_example_arc_1.c @@ -15,7 +15,7 @@ void lv_example_arc_1(void) lv_arc_set_bg_angles(arc, 0, 270); lv_arc_set_value(arc, 10); lv_obj_center(arc); - lv_obj_add_event(arc, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, label); + lv_obj_add_event_cb(arc, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, label); /*Manually update the label for the first time*/ lv_obj_send_event(arc, LV_EVENT_VALUE_CHANGED, NULL); diff --git a/examples/widgets/arc/lv_example_arc_1.py b/examples/widgets/arc/lv_example_arc_1.py index c976d26c4..a702b1f14 100644 --- a/examples/widgets/arc/lv_example_arc_1.py +++ b/examples/widgets/arc/lv_example_arc_1.py @@ -16,7 +16,7 @@ arc.set_rotation(135) arc.set_bg_angles(0, 270) arc.set_value(10) arc.center() -arc.add_event(lambda e: value_changed_event_cb(e,label),lv.EVENT.VALUE_CHANGED, None) +arc.add_event_cb(lambda e: value_changed_event_cb(e,label),lv.EVENT.VALUE_CHANGED, None) # Manually update the label for the first time arc.send_event(lv.EVENT.VALUE_CHANGED, None) diff --git a/examples/widgets/bar/lv_example_bar_6.c b/examples/widgets/bar/lv_example_bar_6.c index 303f01eda..a716db878 100644 --- a/examples/widgets/bar/lv_example_bar_6.c +++ b/examples/widgets/bar/lv_example_bar_6.c @@ -54,7 +54,7 @@ void lv_example_bar_6(void) lv_obj_t * bar = lv_bar_create(lv_screen_active()); lv_obj_set_size(bar, 200, 20); lv_obj_center(bar); - lv_obj_add_event(bar, event_cb, LV_EVENT_DRAW_MAIN_END, NULL); + lv_obj_add_event_cb(bar, event_cb, LV_EVENT_DRAW_MAIN_END, NULL); lv_anim_t a; lv_anim_init(&a); diff --git a/examples/widgets/btn/lv_example_btn_1.c b/examples/widgets/btn/lv_example_btn_1.c index 23c0fc515..2a5c11a17 100644 --- a/examples/widgets/btn/lv_example_btn_1.c +++ b/examples/widgets/btn/lv_example_btn_1.c @@ -18,7 +18,7 @@ void lv_example_button_1(void) lv_obj_t * label; lv_obj_t * btn1 = lv_button_create(lv_screen_active()); - lv_obj_add_event(btn1, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(btn1, event_handler, LV_EVENT_ALL, NULL); lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -40); lv_obj_remove_flag(btn1, LV_OBJ_FLAG_PRESS_LOCK); @@ -27,7 +27,7 @@ void lv_example_button_1(void) lv_obj_center(label); lv_obj_t * btn2 = lv_button_create(lv_screen_active()); - lv_obj_add_event(btn2, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(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); lv_obj_set_height(btn2, LV_SIZE_CONTENT); diff --git a/examples/widgets/btn/lv_example_btn_1.py b/examples/widgets/btn/lv_example_btn_1.py index 45f2a82d3..99b22af8e 100644 --- a/examples/widgets/btn/lv_example_btn_1.py +++ b/examples/widgets/btn/lv_example_btn_1.py @@ -10,7 +10,7 @@ def event_handler(evt): button1 = lv.button(lv.screen_active()) # attach the callback -button1.add_event(event_handler,lv.EVENT.ALL, None) +button1.add_event_cb(event_handler,lv.EVENT.ALL, None) button1.align(lv.ALIGN.CENTER,0,-40) label=lv.label(button1) @@ -20,8 +20,8 @@ label.set_text("Button") button2 = lv.button(lv.screen_active()) # attach the callback -#button2.add_event(event_handler,lv.EVENT.VALUE_CHANGED,None) -button2.add_event(event_handler,lv.EVENT.ALL, None) +#button2.add_event_cb(event_handler,lv.EVENT.VALUE_CHANGED,None) +button2.add_event_cb(event_handler,lv.EVENT.ALL, None) button2.align(lv.ALIGN.CENTER,0,40) button2.add_flag(lv.obj.FLAG.CHECKABLE) diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c index 428ef91ef..1a436ef83 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.c @@ -26,7 +26,7 @@ void lv_example_buttonmatrix_1(void) lv_buttonmatrix_set_button_ctrl(btnm1, 10, LV_BUTTONMATRIX_CTRL_CHECKABLE); lv_buttonmatrix_set_button_ctrl(btnm1, 11, LV_BUTTONMATRIX_CTRL_CHECKED); lv_obj_align(btnm1, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event(btnm1, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(btnm1, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.py b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.py index 3461e4e09..558b69d7a 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_1.py +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_1.py @@ -18,7 +18,7 @@ buttonm1.set_button_width(10, 2) # Make "Action1" twice as wide as "Actio buttonm1.set_button_ctrl(10, lv.buttonmatrix.CTRL.CHECKABLE) buttonm1.set_button_ctrl(11, lv.buttonmatrix.CTRL.CHECKED) buttonm1.align(lv.ALIGN.CENTER, 0, 0) -buttonm1.add_event(event_handler, lv.EVENT.ALL, None) +buttonm1.add_event_cb(event_handler, lv.EVENT.ALL, None) #endif diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c index c63d01d5f..eedc2f3ab 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_2.c @@ -76,7 +76,7 @@ static void event_cb(lv_event_t * e) void lv_example_buttonmatrix_2(void) { lv_obj_t * btnm = lv_buttonmatrix_create(lv_screen_active()); - lv_obj_add_event(btnm, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); + lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_add_flag(btnm, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); lv_obj_center(btnm); } diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c index 9c5491e08..c836b0141 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.c @@ -49,7 +49,7 @@ void lv_example_buttonmatrix_3(void) lv_buttonmatrix_set_map(btnm, map); lv_obj_add_style(btnm, &style_bg, 0); lv_obj_add_style(btnm, &style_btn, LV_PART_ITEMS); - lv_obj_add_event(btnm, event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(btnm, event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_size(btnm, 225, 35); /*Allow selecting on one number at time*/ diff --git a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.py b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.py index 0cf87335b..4d1032426 100644 --- a/examples/widgets/btnmatrix/lv_example_btnmatrix_3.py +++ b/examples/widgets/btnmatrix/lv_example_btnmatrix_3.py @@ -49,7 +49,7 @@ buttonm = lv.buttonmatrix(lv.screen_active()) buttonm.set_map(map) buttonm.add_style(style_bg, 0) buttonm.add_style(style_button, lv.PART.ITEMS) -buttonm.add_event(event_cb, lv.EVENT.VALUE_CHANGED, None) +buttonm.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None) buttonm.set_size(225, 35) # Allow selecting on one number at time diff --git a/examples/widgets/calendar/lv_example_calendar_1.c b/examples/widgets/calendar/lv_example_calendar_1.c index 341ca803a..271464a4e 100644 --- a/examples/widgets/calendar/lv_example_calendar_1.c +++ b/examples/widgets/calendar/lv_example_calendar_1.c @@ -19,7 +19,7 @@ void lv_example_calendar_1(void) lv_obj_t * calendar = lv_calendar_create(lv_screen_active()); lv_obj_set_size(calendar, 185, 185); lv_obj_align(calendar, LV_ALIGN_CENTER, 0, 27); - lv_obj_add_event(calendar, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(calendar, event_handler, LV_EVENT_ALL, NULL); lv_calendar_set_today_date(calendar, 2021, 02, 23); lv_calendar_set_showed_date(calendar, 2021, 02); diff --git a/examples/widgets/calendar/lv_example_calendar_1.py b/examples/widgets/calendar/lv_example_calendar_1.py index e854c2b29..b03da07a2 100644 --- a/examples/widgets/calendar/lv_example_calendar_1.py +++ b/examples/widgets/calendar/lv_example_calendar_1.py @@ -13,7 +13,7 @@ def event_handler(e): calendar = lv.calendar(lv.screen_active()) calendar.set_size(200, 200) calendar.align(lv.ALIGN.CENTER, 0, 20) -calendar.add_event(event_handler, lv.EVENT.ALL, None) +calendar.add_event_cb(event_handler, lv.EVENT.ALL, None) calendar.set_today_date(2021, 02, 23) calendar.set_showed_date(2021, 02) diff --git a/examples/widgets/chart/lv_example_chart_3.c b/examples/widgets/chart/lv_example_chart_3.c index 81a0217a0..9dfcd9df9 100644 --- a/examples/widgets/chart/lv_example_chart_3.c +++ b/examples/widgets/chart/lv_example_chart_3.c @@ -66,7 +66,7 @@ void lv_example_chart_3(void) lv_obj_set_size(chart, 200, 150); lv_obj_center(chart); - lv_obj_add_event(chart, event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(chart, event_cb, LV_EVENT_ALL, NULL); lv_obj_refresh_ext_draw_size(chart); /*Zoom in a little in X*/ diff --git a/examples/widgets/chart/lv_example_chart_4.c b/examples/widgets/chart/lv_example_chart_4.c index 93bdb5738..e8aebd613 100644 --- a/examples/widgets/chart/lv_example_chart_4.c +++ b/examples/widgets/chart/lv_example_chart_4.c @@ -33,7 +33,7 @@ void lv_example_chart_4(void) lv_obj_center(chart); lv_chart_series_t * ser = lv_chart_add_series(chart, lv_color_hex(0xff0000), LV_CHART_AXIS_PRIMARY_Y); - lv_obj_add_event(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); + lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); uint32_t i; diff --git a/examples/widgets/chart/lv_example_chart_4.py b/examples/widgets/chart/lv_example_chart_4.py index 278589061..17ce0d3f9 100755 --- a/examples/widgets/chart/lv_example_chart_4.py +++ b/examples/widgets/chart/lv_example_chart_4.py @@ -65,7 +65,7 @@ chart = lv.chart(lv.screen_active()) chart.set_size(200, 150) chart.center() -chart.add_event(event_cb, lv.EVENT.ALL, None) +chart.add_event_cb(event_cb, lv.EVENT.ALL, None) chart.refresh_ext_draw_size() diff --git a/examples/widgets/chart/lv_example_chart_5.c b/examples/widgets/chart/lv_example_chart_5.c index c8c596ba5..a652e48e6 100644 --- a/examples/widgets/chart/lv_example_chart_5.c +++ b/examples/widgets/chart/lv_example_chart_5.c @@ -21,7 +21,7 @@ void lv_example_chart_5(void) lv_chart_set_div_line_count(chart, 5, 7); - lv_obj_add_event(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); + lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); diff --git a/examples/widgets/chart/lv_example_chart_6.c b/examples/widgets/chart/lv_example_chart_6.c index 090cb8177..58d58cd1d 100644 --- a/examples/widgets/chart/lv_example_chart_6.c +++ b/examples/widgets/chart/lv_example_chart_6.c @@ -28,7 +28,7 @@ void lv_example_chart_6(void) // lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 5, 6, 5, true, 40); // lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_X, 10, 5, 10, 1, true, 30); - lv_obj_add_event(chart, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(chart, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_refresh_ext_draw_size(chart); cursor = lv_chart_add_cursor(chart, lv_palette_main(LV_PALETTE_BLUE), LV_DIR_LEFT | LV_DIR_BOTTOM); diff --git a/examples/widgets/chart/lv_example_chart_7.c b/examples/widgets/chart/lv_example_chart_7.c index b81b50398..8b4efa2d7 100644 --- a/examples/widgets/chart/lv_example_chart_7.c +++ b/examples/widgets/chart/lv_example_chart_7.c @@ -44,7 +44,7 @@ void lv_example_chart_7(void) lv_obj_t * chart = lv_chart_create(lv_screen_active()); lv_obj_set_size(chart, 200, 150); lv_obj_align(chart, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); + lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_add_flag(chart, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); lv_obj_set_style_line_width(chart, 0, LV_PART_ITEMS); /*Remove the lines*/ diff --git a/examples/widgets/checkbox/lv_example_checkbox_1.c b/examples/widgets/checkbox/lv_example_checkbox_1.c index 3d85f2e7b..9fe71f94b 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_1.c +++ b/examples/widgets/checkbox/lv_example_checkbox_1.c @@ -23,22 +23,22 @@ void lv_example_checkbox_1(void) lv_obj_t * cb; cb = lv_checkbox_create(lv_screen_active()); lv_checkbox_set_text(cb, "Apple"); - lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_screen_active()); lv_checkbox_set_text(cb, "Banana"); lv_obj_add_state(cb, LV_STATE_CHECKED); - lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_screen_active()); lv_checkbox_set_text(cb, "Lemon"); lv_obj_add_state(cb, LV_STATE_DISABLED); - lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); cb = lv_checkbox_create(lv_screen_active()); lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED); lv_checkbox_set_text(cb, "Melon\nand a new line"); - lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(cb, event_handler, LV_EVENT_ALL, NULL); lv_obj_update_layout(cb); } diff --git a/examples/widgets/checkbox/lv_example_checkbox_1.py b/examples/widgets/checkbox/lv_example_checkbox_1.py index e18a63e52..5db9fd18c 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_1.py +++ b/examples/widgets/checkbox/lv_example_checkbox_1.py @@ -15,22 +15,22 @@ lv.screen_active().set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.START, lv. cb = lv.checkbox(lv.screen_active()) cb.set_text("Apple") -cb.add_event(event_handler, lv.EVENT.ALL, None) +cb.add_event_cb(event_handler, lv.EVENT.ALL, None) cb = lv.checkbox(lv.screen_active()) cb.set_text("Banana") cb.add_state(lv.STATE.CHECKED) -cb.add_event(event_handler, lv.EVENT.ALL, None) +cb.add_event_cb(event_handler, lv.EVENT.ALL, None) cb = lv.checkbox(lv.screen_active()) cb.set_text("Lemon") cb.add_state(lv.STATE.DISABLED) -cb.add_event(event_handler, lv.EVENT.ALL, None) +cb.add_event_cb(event_handler, lv.EVENT.ALL, None) cb = lv.checkbox(lv.screen_active()) cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED) cb.set_text("Melon") -cb.add_event(event_handler, lv.EVENT.ALL, None) +cb.add_event_cb(event_handler, lv.EVENT.ALL, None) cb.update_layout() diff --git a/examples/widgets/checkbox/lv_example_checkbox_2.c b/examples/widgets/checkbox/lv_example_checkbox_2.c index 79aa557ce..b10d9d2c5 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_2.c +++ b/examples/widgets/checkbox/lv_example_checkbox_2.c @@ -55,7 +55,7 @@ void lv_example_checkbox_2(void) lv_obj_t * cont1 = lv_obj_create(lv_screen_active()); lv_obj_set_flex_flow(cont1, LV_FLEX_FLOW_COLUMN); lv_obj_set_size(cont1, lv_pct(40), lv_pct(80)); - lv_obj_add_event(cont1, radio_event_handler, LV_EVENT_CLICKED, &active_index_1); + lv_obj_add_event_cb(cont1, radio_event_handler, LV_EVENT_CLICKED, &active_index_1); for(i = 0; i < 5; i++) { lv_snprintf(buf, sizeof(buf), "A %d", (int)i + 1); @@ -69,7 +69,7 @@ void lv_example_checkbox_2(void) lv_obj_set_flex_flow(cont2, LV_FLEX_FLOW_COLUMN); lv_obj_set_size(cont2, lv_pct(40), lv_pct(80)); lv_obj_set_x(cont2, lv_pct(50)); - lv_obj_add_event(cont2, radio_event_handler, LV_EVENT_CLICKED, &active_index_2); + lv_obj_add_event_cb(cont2, radio_event_handler, LV_EVENT_CLICKED, &active_index_2); for(i = 0; i < 3; i++) { lv_snprintf(buf, sizeof(buf), "B %d", (int)i + 1); diff --git a/examples/widgets/checkbox/lv_example_checkbox_2.py b/examples/widgets/checkbox/lv_example_checkbox_2.py index 0ada41778..2196cb460 100644 --- a/examples/widgets/checkbox/lv_example_checkbox_2.py +++ b/examples/widgets/checkbox/lv_example_checkbox_2.py @@ -24,7 +24,7 @@ class LV_Example_Checkbox_2: self.cont1 = lv.obj(lv.screen_active()) self.cont1.set_flex_flow(lv.FLEX_FLOW.COLUMN) self.cont1.set_size(lv.pct(40), lv.pct(80)) - self.cont1.add_event(self.radio_event_handler, lv.EVENT.CLICKED, None) + self.cont1.add_event_cb(self.radio_event_handler, lv.EVENT.CLICKED, None) for i in range(5): txt = "A {:d}".format(i+1) @@ -38,7 +38,7 @@ class LV_Example_Checkbox_2: self.cont2.set_flex_flow(lv.FLEX_FLOW.COLUMN) self.cont2.set_size(lv.pct(40), lv.pct(80)) self.cont2.set_x(lv.pct(50)) - self.cont2.add_event(self.radio_event_handler, lv.EVENT.CLICKED, None) + self.cont2.add_event_cb(self.radio_event_handler, lv.EVENT.CLICKED, None) for i in range(3): txt = "B {:d}".format(i+1) diff --git a/examples/widgets/dropdown/lv_example_dropdown_1.c b/examples/widgets/dropdown/lv_example_dropdown_1.c index b3793f401..856c97dbd 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_1.c +++ b/examples/widgets/dropdown/lv_example_dropdown_1.c @@ -29,7 +29,7 @@ void lv_example_dropdown_1(void) "Nuts"); lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20); - lv_obj_add_event(dd, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/dropdown/lv_example_dropdown_1.py b/examples/widgets/dropdown/lv_example_dropdown_1.py index e3276c3d6..52fcc21b1 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_1.py +++ b/examples/widgets/dropdown/lv_example_dropdown_1.py @@ -22,5 +22,5 @@ dd.set_options("\n".join([ "Nuts"])) dd.align(lv.ALIGN.TOP_MID, 0, 20) -dd.add_event(event_handler, lv.EVENT.ALL, None) +dd.add_event_cb(event_handler, lv.EVENT.ALL, None) diff --git a/examples/widgets/dropdown/lv_example_dropdown_3.c b/examples/widgets/dropdown/lv_example_dropdown_3.c index 54465b4a8..f92ccb8fc 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_3.c +++ b/examples/widgets/dropdown/lv_example_dropdown_3.c @@ -37,7 +37,7 @@ void lv_example_dropdown_3(void) /*In a menu we don't need to show the last clicked item*/ lv_dropdown_set_selected_highlight(dropdown, false); - lv_obj_add_event(dropdown, event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(dropdown, event_cb, LV_EVENT_VALUE_CHANGED, NULL); } #endif diff --git a/examples/widgets/dropdown/lv_example_dropdown_3.py b/examples/widgets/dropdown/lv_example_dropdown_3.py index a5b45b250..388e5ace5 100644 --- a/examples/widgets/dropdown/lv_example_dropdown_3.py +++ b/examples/widgets/dropdown/lv_example_dropdown_3.py @@ -42,5 +42,5 @@ dropdown.set_style_transform_rotation(1800, lv.PART.INDICATOR | lv.STATE.CHECKED # In a menu we don't need to show the last clicked item dropdown.set_selected_highlight(False) -dropdown.add_event(event_cb, lv.EVENT.VALUE_CHANGED, None) +dropdown.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None) diff --git a/examples/widgets/img/lv_example_img_2.c b/examples/widgets/img/lv_example_img_2.c index 0cd6cea49..acd2891ec 100644 --- a/examples/widgets/img/lv_example_img_2.c +++ b/examples/widgets/img/lv_example_img_2.c @@ -56,7 +56,7 @@ static lv_obj_t * create_slider(lv_color_t color) lv_obj_set_size(slider, 10, 200); lv_obj_set_style_bg_color(slider, color, LV_PART_KNOB); lv_obj_set_style_bg_color(slider, lv_color_darken(color, LV_OPA_40), LV_PART_INDICATOR); - lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); return slider; } diff --git a/examples/widgets/img/lv_example_img_2.py b/examples/widgets/img/lv_example_img_2.py index 99ebedd97..7f072475d 100755 --- a/examples/widgets/img/lv_example_img_2.py +++ b/examples/widgets/img/lv_example_img_2.py @@ -22,7 +22,7 @@ def create_slider(color): slider.set_size(10, 200) slider.set_style_bg_color(color, lv.PART.KNOB) slider.set_style_bg_color(color.darken(lv.OPA._40), lv.PART.INDICATOR) - slider.add_event(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) + slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) return slider def slider_event_cb(e): diff --git a/examples/widgets/keyboard/lv_example_keyboard_1.c b/examples/widgets/keyboard/lv_example_keyboard_1.c index ca511f580..91c0eae4b 100644 --- a/examples/widgets/keyboard/lv_example_keyboard_1.c +++ b/examples/widgets/keyboard/lv_example_keyboard_1.c @@ -26,13 +26,13 @@ void lv_example_keyboard_1(void) lv_obj_t * ta; ta = lv_textarea_create(lv_screen_active()); lv_obj_align(ta, LV_ALIGN_TOP_LEFT, 10, 10); - lv_obj_add_event(ta, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb); lv_textarea_set_placeholder_text(ta, "Hello"); lv_obj_set_size(ta, 140, 80); ta = lv_textarea_create(lv_screen_active()); lv_obj_align(ta, LV_ALIGN_TOP_RIGHT, -10, 10); - lv_obj_add_event(ta, ta_event_cb, LV_EVENT_ALL, kb); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_ALL, kb); lv_obj_set_size(ta, 140, 80); lv_keyboard_set_textarea(kb, ta); diff --git a/examples/widgets/keyboard/lv_example_keyboard_1.py b/examples/widgets/keyboard/lv_example_keyboard_1.py index 064875143..d4ef1c067 100644 --- a/examples/widgets/keyboard/lv_example_keyboard_1.py +++ b/examples/widgets/keyboard/lv_example_keyboard_1.py @@ -16,13 +16,13 @@ kb = lv.keyboard(lv.screen_active()) ta = lv.textarea(lv.screen_active()) ta.set_width(200) ta.align(lv.ALIGN.TOP_LEFT, 10, 10) -ta.add_event(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None) +ta.add_event_cb(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None) ta.set_placeholder_text("Hello") ta = lv.textarea(lv.screen_active()) ta.set_width(200) ta.align(lv.ALIGN.TOP_RIGHT, -10, 10) -ta.add_event(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None) +ta.add_event_cb(lambda e: ta_event_cb(e,kb), lv.EVENT.ALL, None) kb.set_textarea(ta) diff --git a/examples/widgets/label/lv_example_label_4.c b/examples/widgets/label/lv_example_label_4.c index 31ea94773..634dec64d 100644 --- a/examples/widgets/label/lv_example_label_4.c +++ b/examples/widgets/label/lv_example_label_4.c @@ -67,7 +67,7 @@ void lv_example_label_4(void) lv_obj_set_style_bg_color(grad, lv_color_hex(0xff0000), 0); lv_obj_set_style_bg_grad_color(grad, lv_color_hex(0x0000ff), 0); lv_obj_set_style_bg_grad_dir(grad, LV_GRAD_DIR_HOR, 0); - lv_obj_add_event(grad, add_mask_event_cb, LV_EVENT_ALL, mask_map); + lv_obj_add_event_cb(grad, add_mask_event_cb, LV_EVENT_ALL, mask_map); } #endif diff --git a/examples/widgets/list/lv_example_list_1.c b/examples/widgets/list/lv_example_list_1.c index 1d0c406ab..7ee7eb5f6 100644 --- a/examples/widgets/list/lv_example_list_1.c +++ b/examples/widgets/list/lv_example_list_1.c @@ -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 diff --git a/examples/widgets/list/lv_example_list_1.py b/examples/widgets/list/lv_example_list_1.py index c1826bf30..402352c54 100644 --- a/examples/widgets/list/lv_example_list_1.py +++ b/examples/widgets/list/lv_example_list_1.py @@ -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) diff --git a/examples/widgets/list/lv_example_list_2.c b/examples/widgets/list/lv_example_list_2.c index 45a5adb47..96b8548dc 100644 --- a/examples/widgets/list/lv_example_list_2.c +++ b/examples/widgets/list/lv_example_list_2.c @@ -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); } diff --git a/examples/widgets/list/lv_example_list_2.py b/examples/widgets/list/lv_example_list_2.py index df83ea417..836471c9c 100644 --- a/examples/widgets/list/lv_example_list_2.py +++ b/examples/widgets/list/lv_example_list_2.py @@ -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) diff --git a/examples/widgets/list/test.py b/examples/widgets/list/test.py index f69e1012b..943f6f2d5 100755 --- a/examples/widgets/list/test.py +++ b/examples/widgets/list/test.py @@ -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) diff --git a/examples/widgets/menu/lv_example_menu_2.c b/examples/widgets/menu/lv_example_menu_2.c index 94edc286c..975b15995 100644 --- a/examples/widgets/menu/lv_example_menu_2.c +++ b/examples/widgets/menu/lv_example_menu_2.c @@ -16,7 +16,7 @@ void lv_example_menu_2(void) { lv_obj_t * menu = lv_menu_create(lv_screen_active()); lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED); - lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu); + lv_obj_add_event_cb(menu, back_event_handler, LV_EVENT_CLICKED, menu); lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL)); lv_obj_center(menu); diff --git a/examples/widgets/menu/lv_example_menu_2.py b/examples/widgets/menu/lv_example_menu_2.py index ade711db5..8f01f2144 100644 --- a/examples/widgets/menu/lv_example_menu_2.py +++ b/examples/widgets/menu/lv_example_menu_2.py @@ -7,7 +7,7 @@ def back_event_handler(e): # Create a menu object menu = lv.menu(lv.screen_active()) menu.set_mode_root_back_button(lv.menu.ROOT_BACK_BUTTON.ENABLED) -menu.add_event(back_event_handler, lv.EVENT.CLICKED, None) +menu.add_event_cb(back_event_handler, lv.EVENT.CLICKED, None) menu.set_size(320, 240) menu.center() diff --git a/examples/widgets/menu/lv_example_menu_4.c b/examples/widgets/menu/lv_example_menu_4.c index 904a243e4..2cd1d932c 100644 --- a/examples/widgets/menu/lv_example_menu_4.c +++ b/examples/widgets/menu/lv_example_menu_4.c @@ -60,7 +60,7 @@ void lv_example_menu_4(void) lv_obj_set_size(float_btn, 50, 50); lv_obj_add_flag(float_btn, LV_OBJ_FLAG_FLOATING); lv_obj_align(float_btn, LV_ALIGN_BOTTOM_RIGHT, -10, -10); - lv_obj_add_event(float_btn, float_button_event_cb, LV_EVENT_CLICKED, menu); + lv_obj_add_event_cb(float_btn, float_button_event_cb, LV_EVENT_CLICKED, menu); lv_obj_set_style_radius(float_btn, LV_RADIUS_CIRCLE, 0); lv_obj_set_style_bg_image_src(float_btn, LV_SYMBOL_PLUS, 0); lv_obj_set_style_text_font(float_btn, lv_theme_get_font_large(float_btn), 0); diff --git a/examples/widgets/menu/lv_example_menu_4.py b/examples/widgets/menu/lv_example_menu_4.py index ee48427de..9a9a266e3 100644 --- a/examples/widgets/menu/lv_example_menu_4.py +++ b/examples/widgets/menu/lv_example_menu_4.py @@ -41,7 +41,7 @@ float_button = lv.button(lv.screen_active()) float_button.set_size(50, 50) float_button.add_flag(lv.obj.FLAG.FLOATING) float_button.align(lv.ALIGN.BOTTOM_RIGHT, -10, -10) -float_button.add_event(float_button_event_cb, lv.EVENT.CLICKED, None) +float_button.add_event_cb(float_button_event_cb, lv.EVENT.CLICKED, None) float_button.set_style_radius(lv.RADIUS_CIRCLE, 0) float_button.set_style_bg_image_src(lv.SYMBOL.PLUS, 0) float_button.set_style_text_font(lv.theme_get_font_large(float_button), 0) \ No newline at end of file diff --git a/examples/widgets/menu/lv_example_menu_5.c b/examples/widgets/menu/lv_example_menu_5.c index 050df27eb..6630917e2 100644 --- a/examples/widgets/menu/lv_example_menu_5.c +++ b/examples/widgets/menu/lv_example_menu_5.c @@ -29,7 +29,7 @@ void lv_example_menu_5(void) lv_obj_set_style_bg_color(menu, lv_color_darken(lv_obj_get_style_bg_color(menu, 0), 50), 0); } lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED); - lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu); + lv_obj_add_event_cb(menu, back_event_handler, LV_EVENT_CLICKED, menu); lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL)); lv_obj_center(menu); @@ -85,7 +85,7 @@ void lv_example_menu_5(void) lv_menu_separator_create(sub_menu_mode_page); section = lv_menu_section_create(sub_menu_mode_page); cont = create_switch(section, LV_SYMBOL_AUDIO, "Sidebar enable", true); - lv_obj_add_event(lv_obj_get_child(cont, 2), switch_handler, LV_EVENT_VALUE_CHANGED, menu); + lv_obj_add_event_cb(lv_obj_get_child(cont, 2), switch_handler, LV_EVENT_VALUE_CHANGED, menu); /*Create a root page*/ root_page = lv_menu_page_create(menu, "Settings"); diff --git a/examples/widgets/menu/lv_example_menu_5.py b/examples/widgets/menu/lv_example_menu_5.py index 72ea66d34..33197c05f 100644 --- a/examples/widgets/menu/lv_example_menu_5.py +++ b/examples/widgets/menu/lv_example_menu_5.py @@ -87,7 +87,7 @@ else : menu.set_mode_root_back_button(lv.menu.ROOT_BACK_BUTTON.ENABLED) -menu.add_event(lambda evt: back_event_handler(evt,menu), lv.EVENT.CLICKED, None) +menu.add_event_cb(lambda evt: back_event_handler(evt,menu), lv.EVENT.CLICKED, None) menu.set_size(lv.pct(100), lv.pct(100)) menu.center() @@ -142,7 +142,7 @@ sub_menu_mode_page.set_style_pad_hor(menu.get_main_header().get_style_pad_left(0 lv.menu_separator(sub_menu_mode_page) section = lv.menu_section(sub_menu_mode_page) cont = create_switch(section, lv.SYMBOL.AUDIO, "Sidebar enable",True) -cont.get_child(2).add_event(lambda evt: switch_handler(evt,menu), lv.EVENT.VALUE_CHANGED, None) +cont.get_child(2).add_event_cb(lambda evt: switch_handler(evt,menu), lv.EVENT.VALUE_CHANGED, None) # Create a root page root_page = lv.menu_page(menu, "Settings") diff --git a/examples/widgets/msgbox/lv_example_msgbox_1.c b/examples/widgets/msgbox/lv_example_msgbox_1.c index 260d895c1..c41fb84db 100644 --- a/examples/widgets/msgbox/lv_example_msgbox_1.c +++ b/examples/widgets/msgbox/lv_example_msgbox_1.c @@ -13,7 +13,7 @@ void lv_example_msgbox_1(void) static const char * buttons[] = {"Apply", "Close", ""}; lv_obj_t * mbox1 = lv_msgbox_create(NULL, "Hello", "This is a message box with two buttons.", buttons, true); - lv_obj_add_event(mbox1, event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(mbox1, event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_center(mbox1); } diff --git a/examples/widgets/msgbox/lv_example_msgbox_1.py b/examples/widgets/msgbox/lv_example_msgbox_1.py index 9157ed72e..4b4adb0fa 100644 --- a/examples/widgets/msgbox/lv_example_msgbox_1.py +++ b/examples/widgets/msgbox/lv_example_msgbox_1.py @@ -5,6 +5,6 @@ def event_cb(e): buttons = ["Apply", "Close", ""] mbox1 = lv.msgbox(lv.screen_active(), "Hello", "This is a message box with two buttons.", buttons, True) -mbox1.add_event(event_cb, lv.EVENT.VALUE_CHANGED, None) +mbox1.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None) mbox1.center() diff --git a/examples/widgets/obj/lv_example_obj_2.c b/examples/widgets/obj/lv_example_obj_2.c index 688e520fd..097e6155b 100644 --- a/examples/widgets/obj/lv_example_obj_2.c +++ b/examples/widgets/obj/lv_example_obj_2.c @@ -24,7 +24,7 @@ void lv_example_obj_2(void) lv_obj_t * obj; obj = lv_obj_create(lv_screen_active()); lv_obj_set_size(obj, 150, 100); - lv_obj_add_event(obj, drag_event_handler, LV_EVENT_PRESSING, NULL); + lv_obj_add_event_cb(obj, drag_event_handler, LV_EVENT_PRESSING, NULL); lv_obj_t * label = lv_label_create(obj); lv_label_set_text(label, "Drag me"); diff --git a/examples/widgets/obj/lv_example_obj_2.py b/examples/widgets/obj/lv_example_obj_2.py index eef4338cf..295d68e95 100644 --- a/examples/widgets/obj/lv_example_obj_2.py +++ b/examples/widgets/obj/lv_example_obj_2.py @@ -17,7 +17,7 @@ def drag_event_handler(e): obj = lv.obj(lv.screen_active()) obj.set_size(150, 100) -obj.add_event(drag_event_handler, lv.EVENT.PRESSING, None) +obj.add_event_cb(drag_event_handler, lv.EVENT.PRESSING, None) label = lv.label(obj) label.set_text("Drag me") diff --git a/examples/widgets/roller/lv_example_roller_1.c b/examples/widgets/roller/lv_example_roller_1.c index 112c04724..7a9d8407d 100644 --- a/examples/widgets/roller/lv_example_roller_1.c +++ b/examples/widgets/roller/lv_example_roller_1.c @@ -35,7 +35,7 @@ void lv_example_roller_1(void) lv_roller_set_visible_row_count(roller1, 4); lv_obj_center(roller1); - lv_obj_add_event(roller1, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(roller1, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/roller/lv_example_roller_1.py b/examples/widgets/roller/lv_example_roller_1.py index 36e2c9b2b..e7feec81e 100644 --- a/examples/widgets/roller/lv_example_roller_1.py +++ b/examples/widgets/roller/lv_example_roller_1.py @@ -27,5 +27,5 @@ roller1.set_options("\n".join([ roller1.set_visible_row_count(4) roller1.center() -roller1.add_event(event_handler, lv.EVENT.ALL, None) +roller1.add_event_cb(event_handler, lv.EVENT.ALL, None) diff --git a/examples/widgets/roller/lv_example_roller_2.c b/examples/widgets/roller/lv_example_roller_2.c index 0409494b7..a4b02378b 100644 --- a/examples/widgets/roller/lv_example_roller_2.c +++ b/examples/widgets/roller/lv_example_roller_2.c @@ -39,7 +39,7 @@ void lv_example_roller_2(void) lv_obj_set_style_bg_grad_color(roller, lv_color_hex3(0xafa), 0); lv_obj_set_style_bg_grad_dir(roller, LV_GRAD_DIR_VER, 0); lv_obj_align(roller, LV_ALIGN_LEFT_MID, 10, 0); - lv_obj_add_event(roller, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 2, LV_ANIM_OFF); /*A roller on the middle with center aligned text, and auto (default) width*/ @@ -48,7 +48,7 @@ void lv_example_roller_2(void) lv_roller_set_visible_row_count(roller, 3); lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_align(roller, LV_ALIGN_CENTER, 0, 0); - lv_obj_add_event(roller, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 5, LV_ANIM_OFF); /*A roller on the right with right aligned text, and custom width*/ @@ -59,7 +59,7 @@ void lv_example_roller_2(void) lv_obj_add_style(roller, &style_sel, LV_PART_SELECTED); lv_obj_set_style_text_align(roller, LV_TEXT_ALIGN_RIGHT, 0); lv_obj_align(roller, LV_ALIGN_RIGHT_MID, -10, 0); - lv_obj_add_event(roller, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(roller, event_handler, LV_EVENT_ALL, NULL); lv_roller_set_selected(roller, 8, LV_ANIM_OFF); } diff --git a/examples/widgets/roller/lv_example_roller_2.py b/examples/widgets/roller/lv_example_roller_2.py index 02d202cbd..2099ca297 100644 --- a/examples/widgets/roller/lv_example_roller_2.py +++ b/examples/widgets/roller/lv_example_roller_2.py @@ -52,7 +52,7 @@ roller.set_style_text_align(lv.TEXT_ALIGN.LEFT, 0) roller.set_style_bg_color(lv.color_hex3(0x0f0), 0) roller.set_style_bg_grad_color(lv.color_hex3(0xafa), 0); roller.align(lv.ALIGN.LEFT_MID, 10, 0) -roller.add_event(event_handler, lv.EVENT.ALL, None) +roller.add_event_cb(event_handler, lv.EVENT.ALL, None) roller.set_selected(2, lv.ANIM.OFF) # A roller in the middle with center aligned text, and auto (default) width @@ -61,7 +61,7 @@ roller.set_options(opts, lv.roller.MODE.NORMAL) roller.set_visible_row_count(3) roller.add_style(style_sel, lv.PART.SELECTED) roller.align(lv.ALIGN.CENTER, 0, 0) -roller.add_event(event_handler, lv.EVENT.ALL, None) +roller.add_event_cb(event_handler, lv.EVENT.ALL, None) roller.set_selected(5, lv.ANIM.OFF) # A roller on the right with right aligned text, and custom width @@ -72,5 +72,5 @@ roller.set_width(80) roller.add_style(style_sel, lv.PART.SELECTED) roller.set_style_text_align(lv.TEXT_ALIGN.RIGHT, 0) roller.align(lv.ALIGN.RIGHT_MID, -10, 0) -roller.add_event(event_handler, lv.EVENT.ALL, None) +roller.add_event_cb(event_handler, lv.EVENT.ALL, None) roller.set_selected(8, lv.ANIM.OFF) diff --git a/examples/widgets/roller/lv_example_roller_3.c b/examples/widgets/roller/lv_example_roller_3.c index 5d5fffa5f..4561c1526 100644 --- a/examples/widgets/roller/lv_example_roller_3.c +++ b/examples/widgets/roller/lv_example_roller_3.c @@ -91,6 +91,6 @@ void lv_example_roller_3(void) lv_obj_center(roller1); lv_roller_set_visible_row_count(roller1, 3); - lv_obj_add_event(roller1, mask_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(roller1, mask_event_cb, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/slider/lv_example_slider_1.c b/examples/widgets/slider/lv_example_slider_1.c index bad320f0b..8d170c5b6 100644 --- a/examples/widgets/slider/lv_example_slider_1.c +++ b/examples/widgets/slider/lv_example_slider_1.c @@ -12,7 +12,7 @@ void lv_example_slider_1(void) /*Create a slider in the center of the display*/ lv_obj_t * slider = lv_slider_create(lv_screen_active()); lv_obj_center(slider); - lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_style_anim_time(slider, 2000, 0); /*Create a label below the slider*/ diff --git a/examples/widgets/slider/lv_example_slider_1.py b/examples/widgets/slider/lv_example_slider_1.py index 23c58c8a2..c7781d473 100644 --- a/examples/widgets/slider/lv_example_slider_1.py +++ b/examples/widgets/slider/lv_example_slider_1.py @@ -10,7 +10,7 @@ def slider_event_cb(e): # Create a slider in the center of the display slider = lv.slider(lv.screen_active()) slider.center() -slider.add_event(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) +slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) # Create a label below the slider slider_label = lv.label(lv.screen_active()) diff --git a/examples/widgets/slider/lv_example_slider_3.c b/examples/widgets/slider/lv_example_slider_3.c index 9f7251ce0..fcfd65c2d 100644 --- a/examples/widgets/slider/lv_example_slider_3.c +++ b/examples/widgets/slider/lv_example_slider_3.c @@ -18,7 +18,7 @@ void lv_example_slider_3(void) lv_slider_set_value(slider, 70, LV_ANIM_OFF); lv_slider_set_left_value(slider, 20, LV_ANIM_OFF); - lv_obj_add_event(slider, slider_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_ALL, NULL); lv_obj_refresh_ext_draw_size(slider); } diff --git a/examples/widgets/slider/lv_example_slider_3.py b/examples/widgets/slider/lv_example_slider_3.py index ec9cad177..948d18c3e 100644 --- a/examples/widgets/slider/lv_example_slider_3.py +++ b/examples/widgets/slider/lv_example_slider_3.py @@ -39,7 +39,7 @@ slider.set_mode(lv.slider.MODE.RANGE) slider.set_value(70, lv.ANIM.OFF) slider.set_left_value(20, lv.ANIM.OFF) -slider.add_event(slider_event_cb, lv.EVENT.ALL, None) +slider.add_event_cb(slider_event_cb, lv.EVENT.ALL, None) slider.add_flag(lv.obj.FLAG.SEND_DRAW_TASK_EVENTS) slider.refresh_ext_draw_size() diff --git a/examples/widgets/slider/lv_example_slider_4.c b/examples/widgets/slider/lv_example_slider_4.c index c0ffa91d4..12792a887 100644 --- a/examples/widgets/slider/lv_example_slider_4.c +++ b/examples/widgets/slider/lv_example_slider_4.c @@ -12,7 +12,7 @@ void lv_example_slider_4(void) /*Create a slider in the center of the display*/ lv_obj_t * slider = lv_slider_create(lv_screen_active()); lv_obj_center(slider); - lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Reverse the direction of the slider*/ lv_slider_set_range(slider, 100, 0); /*Create a label below the slider*/ diff --git a/examples/widgets/slider/lv_example_slider_4.py b/examples/widgets/slider/lv_example_slider_4.py index 1dfd76ddd..04ad76860 100644 --- a/examples/widgets/slider/lv_example_slider_4.py +++ b/examples/widgets/slider/lv_example_slider_4.py @@ -10,7 +10,7 @@ def slider_event_cb(e): # Create a slider in the center of the display slider = lv.slider(lv.screen_active()) slider.center() -slider.add_event(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) +slider.add_event_cb(slider_event_cb, lv.EVENT.VALUE_CHANGED, None) slider.set_range(100, 0) # Create a label below the slider diff --git a/examples/widgets/spinbox/lv_example_spinbox_1.c b/examples/widgets/spinbox/lv_example_spinbox_1.c index 15cb49ef8..774c8f276 100644 --- a/examples/widgets/spinbox/lv_example_spinbox_1.c +++ b/examples/widgets/spinbox/lv_example_spinbox_1.c @@ -34,13 +34,13 @@ void lv_example_spinbox_1(void) lv_obj_set_size(btn, h, h); lv_obj_align_to(btn, spinbox, LV_ALIGN_OUT_RIGHT_MID, 5, 0); lv_obj_set_style_bg_image_src(btn, LV_SYMBOL_PLUS, 0); - lv_obj_add_event(btn, lv_spinbox_increment_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(btn, lv_spinbox_increment_event_cb, LV_EVENT_ALL, NULL); btn = lv_button_create(lv_screen_active()); lv_obj_set_size(btn, h, h); lv_obj_align_to(btn, spinbox, LV_ALIGN_OUT_LEFT_MID, -5, 0); lv_obj_set_style_bg_image_src(btn, LV_SYMBOL_MINUS, 0); - lv_obj_add_event(btn, lv_spinbox_decrement_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(btn, lv_spinbox_decrement_event_cb, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/spinbox/lv_example_spinbox_1.py b/examples/widgets/spinbox/lv_example_spinbox_1.py index bd88c6c1a..2f53999d2 100644 --- a/examples/widgets/spinbox/lv_example_spinbox_1.py +++ b/examples/widgets/spinbox/lv_example_spinbox_1.py @@ -21,10 +21,10 @@ button = lv.button(lv.screen_active()) button.set_size(h, h) button.align_to(spinbox, lv.ALIGN.OUT_RIGHT_MID, 5, 0) button.set_style_bg_image_src(lv.SYMBOL.PLUS, 0) -button.add_event(increment_event_cb, lv.EVENT.ALL, None) +button.add_event_cb(increment_event_cb, lv.EVENT.ALL, None) button = lv.button(lv.screen_active()) button.set_size(h, h) button.align_to(spinbox, lv.ALIGN.OUT_LEFT_MID, -5, 0) button.set_style_bg_image_src(lv.SYMBOL.MINUS, 0) -button.add_event(decrement_event_cb, lv.EVENT.ALL, None) +button.add_event_cb(decrement_event_cb, lv.EVENT.ALL, None) diff --git a/examples/widgets/switch/lv_example_switch_1.c b/examples/widgets/switch/lv_example_switch_1.c index 4363b6af0..7b6a53138 100644 --- a/examples/widgets/switch/lv_example_switch_1.c +++ b/examples/widgets/switch/lv_example_switch_1.c @@ -19,20 +19,20 @@ void lv_example_switch_1(void) lv_obj_t * sw; sw = lv_switch_create(lv_screen_active()); - lv_obj_add_event(sw, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); lv_obj_add_flag(sw, LV_OBJ_FLAG_EVENT_BUBBLE); sw = lv_switch_create(lv_screen_active()); lv_obj_add_state(sw, LV_STATE_CHECKED); - lv_obj_add_event(sw, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_screen_active()); lv_obj_add_state(sw, LV_STATE_DISABLED); - lv_obj_add_event(sw, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); sw = lv_switch_create(lv_screen_active()); lv_obj_add_state(sw, LV_STATE_CHECKED | LV_STATE_DISABLED); - lv_obj_add_event(sw, event_handler, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(sw, event_handler, LV_EVENT_ALL, NULL); } #endif diff --git a/examples/widgets/switch/lv_example_switch_1.py b/examples/widgets/switch/lv_example_switch_1.py index f9a8a0c2f..997f3631e 100644 --- a/examples/widgets/switch/lv_example_switch_1.py +++ b/examples/widgets/switch/lv_example_switch_1.py @@ -9,18 +9,18 @@ lv.screen_active().set_flex_flow(lv.FLEX_FLOW.COLUMN) lv.screen_active().set_flex_align(lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.CENTER, lv.FLEX_ALIGN.CENTER) sw = lv.switch(lv.screen_active()) -sw.add_event(event_handler, lv.EVENT.ALL, None) +sw.add_event_cb(event_handler, lv.EVENT.ALL, None) sw.add_flag(lv.obj.FLAG.EVENT_BUBBLE) sw = lv.switch(lv.screen_active()) sw.add_state(lv.STATE.CHECKED) -sw.add_event(event_handler, lv.EVENT.ALL, None) +sw.add_event_cb(event_handler, lv.EVENT.ALL, None) sw = lv.switch(lv.screen_active()) sw.add_state(lv.STATE.DISABLED) -sw.add_event(event_handler, lv.EVENT.ALL, None) +sw.add_event_cb(event_handler, lv.EVENT.ALL, None) sw = lv.switch(lv.screen_active()) sw.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED) -sw.add_event(event_handler, lv.EVENT.ALL, None) +sw.add_event_cb(event_handler, lv.EVENT.ALL, None) diff --git a/examples/widgets/table/lv_example_table_1.c b/examples/widgets/table/lv_example_table_1.c index 9553c009c..4f26c3ac8 100644 --- a/examples/widgets/table/lv_example_table_1.c +++ b/examples/widgets/table/lv_example_table_1.c @@ -70,7 +70,7 @@ void lv_example_table_1(void) lv_obj_center(table); /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event(table, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); + lv_obj_add_event_cb(table, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_add_flag(table, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); } diff --git a/examples/widgets/table/lv_example_table_2.c b/examples/widgets/table/lv_example_table_2.c index d586e4b31..c3f498bd1 100644 --- a/examples/widgets/table/lv_example_table_2.c +++ b/examples/widgets/table/lv_example_table_2.c @@ -85,8 +85,8 @@ void lv_example_table_2(void) lv_obj_align(table, LV_ALIGN_CENTER, 0, -20); /*Add an event callback to to apply some custom drawing*/ - lv_obj_add_event(table, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); - lv_obj_add_event(table, change_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(table, draw_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); + lv_obj_add_event_cb(table, change_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_flag(table, LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS); lv_mem_monitor_t mon2; diff --git a/examples/widgets/textarea/lv_example_textarea_1.c b/examples/widgets/textarea/lv_example_textarea_1.c index 544e08616..ba82e52cc 100644 --- a/examples/widgets/textarea/lv_example_textarea_1.c +++ b/examples/widgets/textarea/lv_example_textarea_1.c @@ -25,7 +25,7 @@ void lv_example_textarea_1(void) lv_obj_t * ta = lv_textarea_create(lv_screen_active()); lv_textarea_set_one_line(ta, true); lv_obj_align(ta, LV_ALIGN_TOP_MID, 0, 10); - lv_obj_add_event(ta, textarea_event_handler, LV_EVENT_READY, ta); + lv_obj_add_event_cb(ta, textarea_event_handler, LV_EVENT_READY, ta); lv_obj_add_state(ta, LV_STATE_FOCUSED); /*To be sure the cursor is visible*/ static const char * btnm_map[] = {"1", "2", "3", "\n", @@ -37,7 +37,7 @@ void lv_example_textarea_1(void) lv_obj_t * btnm = lv_buttonmatrix_create(lv_screen_active()); lv_obj_set_size(btnm, 200, 150); lv_obj_align(btnm, LV_ALIGN_BOTTOM_MID, 0, -10); - lv_obj_add_event(btnm, btnm_event_handler, LV_EVENT_VALUE_CHANGED, ta); + lv_obj_add_event_cb(btnm, btnm_event_handler, LV_EVENT_VALUE_CHANGED, ta); lv_obj_remove_flag(btnm, LV_OBJ_FLAG_CLICK_FOCUSABLE); /*To keep the text area focused on button clicks*/ lv_buttonmatrix_set_map(btnm, btnm_map); } diff --git a/examples/widgets/textarea/lv_example_textarea_1.py b/examples/widgets/textarea/lv_example_textarea_1.py index c3cc36f78..32097d1fc 100644 --- a/examples/widgets/textarea/lv_example_textarea_1.py +++ b/examples/widgets/textarea/lv_example_textarea_1.py @@ -16,7 +16,7 @@ def buttonm_event_handler(e, ta): ta = lv.textarea(lv.screen_active()) ta.set_one_line(True) ta.align(lv.ALIGN.TOP_MID, 0, 10) -ta.add_event(lambda e: textarea_event_handler(e, ta), lv.EVENT.READY, None) +ta.add_event_cb(lambda e: textarea_event_handler(e, ta), lv.EVENT.READY, None) ta.add_state(lv.STATE.FOCUSED) # To be sure the cursor is visible buttonm_map = ["1", "2", "3", "\n", @@ -27,6 +27,6 @@ buttonm_map = ["1", "2", "3", "\n", buttonm = lv.buttonmatrix(lv.screen_active()) buttonm.set_size(200, 150) buttonm.align(lv.ALIGN.BOTTOM_MID, 0, -10) -buttonm.add_event(lambda e: buttonm_event_handler(e, ta), lv.EVENT.VALUE_CHANGED, None) +buttonm.add_event_cb(lambda e: buttonm_event_handler(e, ta), lv.EVENT.VALUE_CHANGED, None) buttonm.remove_flag(lv.obj.FLAG.CLICK_FOCUSABLE) # To keep the text area focused on button clicks buttonm.set_map(buttonm_map) diff --git a/examples/widgets/textarea/lv_example_textarea_2.c b/examples/widgets/textarea/lv_example_textarea_2.c index a56208db5..53f1e3b8d 100644 --- a/examples/widgets/textarea/lv_example_textarea_2.c +++ b/examples/widgets/textarea/lv_example_textarea_2.c @@ -14,7 +14,7 @@ void lv_example_textarea_2(void) lv_textarea_set_one_line(pwd_ta, true); lv_obj_set_width(pwd_ta, lv_pct(40)); lv_obj_set_pos(pwd_ta, 5, 20); - lv_obj_add_event(pwd_ta, ta_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(pwd_ta, ta_event_cb, LV_EVENT_ALL, NULL); /*Create a label and position it above the text box*/ lv_obj_t * pwd_label = lv_label_create(lv_screen_active()); @@ -26,7 +26,7 @@ void lv_example_textarea_2(void) lv_textarea_set_one_line(text_ta, true); lv_textarea_set_password_mode(text_ta, false); lv_obj_set_width(text_ta, lv_pct(40)); - lv_obj_add_event(text_ta, ta_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(text_ta, ta_event_cb, LV_EVENT_ALL, NULL); lv_obj_align(text_ta, LV_ALIGN_TOP_RIGHT, -5, 20); /*Create a label and position it above the text box*/ diff --git a/examples/widgets/textarea/lv_example_textarea_2.py b/examples/widgets/textarea/lv_example_textarea_2.py index 34eeece9f..ee80abf78 100644 --- a/examples/widgets/textarea/lv_example_textarea_2.py +++ b/examples/widgets/textarea/lv_example_textarea_2.py @@ -18,7 +18,7 @@ pwd_ta.set_password_mode(True) pwd_ta.set_one_line(True) pwd_ta.set_width(lv.pct(45)) pwd_ta.set_pos(5, 20) -pwd_ta.add_event(ta_event_cb, lv.EVENT.ALL, None) +pwd_ta.add_event_cb(ta_event_cb, lv.EVENT.ALL, None) # Create a label and position it above the text box pwd_label = lv.label(lv.screen_active()) @@ -29,7 +29,7 @@ pwd_label.align_to(pwd_ta, lv.ALIGN.OUT_TOP_LEFT, 0, 0) text_ta = lv.textarea(lv.screen_active()) text_ta.set_width(lv.pct(45)) text_ta.set_one_line(True) -text_ta.add_event(ta_event_cb, lv.EVENT.ALL, None) +text_ta.add_event_cb(ta_event_cb, lv.EVENT.ALL, None) text_ta.set_password_mode(False) text_ta.align(lv.ALIGN.TOP_RIGHT, -5, 20) diff --git a/examples/widgets/textarea/lv_example_textarea_3.c b/examples/widgets/textarea/lv_example_textarea_3.c index 825701d08..6fccb3f92 100644 --- a/examples/widgets/textarea/lv_example_textarea_3.c +++ b/examples/widgets/textarea/lv_example_textarea_3.c @@ -13,7 +13,7 @@ void lv_example_textarea_3(void) { /*Create the text area*/ lv_obj_t * ta = lv_textarea_create(lv_screen_active()); - lv_obj_add_event(ta, ta_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(ta, ta_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_textarea_set_accepted_chars(ta, "0123456789:"); lv_textarea_set_max_length(ta, 5); lv_textarea_set_one_line(ta, true); diff --git a/examples/widgets/textarea/lv_example_textarea_3.py b/examples/widgets/textarea/lv_example_textarea_3.py index e9cffb574..66ebc81dc 100644 --- a/examples/widgets/textarea/lv_example_textarea_3.py +++ b/examples/widgets/textarea/lv_example_textarea_3.py @@ -31,7 +31,7 @@ def ta_event_cb(e): # Create the text area ta = lv.textarea(lv.screen_active()) -ta.add_event(ta_event_cb, lv.EVENT.VALUE_CHANGED, None) +ta.add_event_cb(ta_event_cb, lv.EVENT.VALUE_CHANGED, None) ta.set_accepted_chars("0123456789:") ta.set_max_length(5) ta.set_one_line(True) diff --git a/examples/widgets/win/lv_example_win_1.c b/examples/widgets/win/lv_example_win_1.c index 7d0acb975..67411a958 100644 --- a/examples/widgets/win/lv_example_win_1.c +++ b/examples/widgets/win/lv_example_win_1.c @@ -13,15 +13,15 @@ void lv_example_win_1(void) lv_obj_t * win = lv_win_create(lv_screen_active()); lv_obj_t * btn; btn = lv_win_add_button(win, LV_SYMBOL_LEFT, 40); - lv_obj_add_event(btn, event_handler, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(btn, event_handler, LV_EVENT_CLICKED, NULL); lv_win_add_title(win, "A title"); btn = lv_win_add_button(win, LV_SYMBOL_RIGHT, 40); - 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_win_add_button(win, LV_SYMBOL_CLOSE, 60); - 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 * cont = lv_win_get_content(win); /*Content can be added here*/ lv_obj_t * label = lv_label_create(cont); diff --git a/examples/widgets/win/lv_example_win_1.py b/examples/widgets/win/lv_example_win_1.py index 6ec722db3..9db383973 100644 --- a/examples/widgets/win/lv_example_win_1.py +++ b/examples/widgets/win/lv_example_win_1.py @@ -7,12 +7,12 @@ def event_handler(e): win = lv.win(lv.screen_active()) button1 = win.add_button(lv.SYMBOL.LEFT, 40) -button1.add_event(event_handler, lv.EVENT.ALL, None) +button1.add_event_cb(event_handler, lv.EVENT.ALL, None) win.add_title("A title") button2=win.add_button(lv.SYMBOL.RIGHT, 40) -button2.add_event(event_handler, lv.EVENT.ALL, None) +button2.add_event_cb(event_handler, lv.EVENT.ALL, None) button3 = win.add_button(lv.SYMBOL.CLOSE, 60) -button3.add_event(event_handler, lv.EVENT.ALL, None) +button3.add_event_cb(event_handler, lv.EVENT.ALL, None) cont = win.get_content() # Content can be added here label = lv.label(cont) diff --git a/src/core/lv_obj_event.c b/src/core/lv_obj_event.c index fabb91076..4305e4ca8 100644 --- a/src/core/lv_obj_event.c +++ b/src/core/lv_obj_event.c @@ -92,8 +92,8 @@ lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e) return res; } -void lv_obj_add_event(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, - void * user_data) +void lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, + void * user_data) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_obj_allocate_spec_attr(obj); diff --git a/src/core/lv_obj_event.h b/src/core/lv_obj_event.h index f4df61392..9d8dbd249 100644 --- a/src/core/lv_obj_event.h +++ b/src/core/lv_obj_event.h @@ -102,8 +102,8 @@ struct _lv_obj_t * lv_event_get_target_obj(lv_event_t * e); * @param event_cb the new event function * @param user_data custom data data will be available in `event_cb` */ -void lv_obj_add_event(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, - void * user_data); +void lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, + void * user_data); uint32_t lv_obj_get_event_count(struct _lv_obj_t * obj); diff --git a/src/dev/nuttx/lv_nuttx_fbdev.c b/src/dev/nuttx/lv_nuttx_fbdev.c index 8677ac070..9461ad1f0 100644 --- a/src/dev/nuttx/lv_nuttx_fbdev.c +++ b/src/dev/nuttx/lv_nuttx_fbdev.c @@ -76,7 +76,7 @@ lv_display_t * lv_nuttx_fbdev_create(void) } dsc->fd = -1; lv_display_set_driver_data(disp, dsc); - lv_display_add_event(disp, display_release_cb, LV_EVENT_DELETE, disp); + lv_display_add_event_cb(disp, display_release_cb, LV_EVENT_DELETE, disp); lv_display_set_flush_cb(disp, flush_cb); return disp; } diff --git a/src/dev/nuttx/lv_nuttx_lcd.c b/src/dev/nuttx/lv_nuttx_lcd.c index 694977eba..0cffa7227 100644 --- a/src/dev/nuttx/lv_nuttx_lcd.c +++ b/src/dev/nuttx/lv_nuttx_lcd.c @@ -198,8 +198,8 @@ static lv_display_t * lcd_init(int fd, int hor_res, int ver_res) lcd->disp = disp; lv_display_set_draw_buffers(lcd->disp, draw_buf, draw_buf_2, buf_size, render_mode); lv_display_set_flush_cb(lcd->disp, flush_cb); - lv_display_add_event(lcd->disp, rounder_cb, LV_EVENT_INVALIDATE_AREA, lcd); - lv_display_add_event(lcd->disp, display_release_cb, LV_EVENT_DELETE, lcd->disp); + lv_display_add_event_cb(lcd->disp, rounder_cb, LV_EVENT_INVALIDATE_AREA, lcd); + lv_display_add_event_cb(lcd->disp, display_release_cb, LV_EVENT_DELETE, lcd->disp); lv_display_set_driver_data(lcd->disp, lcd); lv_display_set_user_data(lcd->disp, (void *)(uintptr_t)fd); diff --git a/src/dev/nuttx/lv_nuttx_touchscreen.c b/src/dev/nuttx/lv_nuttx_touchscreen.c index d8fc011eb..7a913b75f 100644 --- a/src/dev/nuttx/lv_nuttx_touchscreen.c +++ b/src/dev/nuttx/lv_nuttx_touchscreen.c @@ -156,7 +156,7 @@ static lv_indev_t * touchscreen_init(int fd) lv_indev_set_read_cb(indev, touchscreen_read); lv_indev_set_driver_data(indev, touchscreen); lv_indev_set_user_data(indev, (void *)(uintptr_t)fd); - lv_indev_add_event(indev, touchscreen_delete_cb, LV_EVENT_DELETE, indev); + lv_indev_add_event_cb(indev, touchscreen_delete_cb, LV_EVENT_DELETE, indev); return indev; } diff --git a/src/dev/sdl/lv_sdl_keyboard.c b/src/dev/sdl/lv_sdl_keyboard.c index ce192ac70..2a735e6fb 100644 --- a/src/dev/sdl/lv_sdl_keyboard.c +++ b/src/dev/sdl/lv_sdl_keyboard.c @@ -59,7 +59,7 @@ lv_indev_t * lv_sdl_keyboard_create(void) lv_indev_set_driver_data(indev, dsc); lv_timer_delete(lv_indev_get_read_timer(indev)); - lv_indev_add_event(indev, release_indev_cb, LV_EVENT_DELETE, indev); + lv_indev_add_event_cb(indev, release_indev_cb, LV_EVENT_DELETE, indev); return indev; } diff --git a/src/dev/sdl/lv_sdl_mouse.c b/src/dev/sdl/lv_sdl_mouse.c index 67dae95e4..7c1b17a4f 100644 --- a/src/dev/sdl/lv_sdl_mouse.c +++ b/src/dev/sdl/lv_sdl_mouse.c @@ -59,7 +59,7 @@ lv_indev_t * lv_sdl_mouse_create(void) lv_indev_set_driver_data(indev, dsc); lv_timer_delete(lv_indev_get_read_timer(indev)); - lv_indev_add_event(indev, release_indev_cb, LV_EVENT_DELETE, indev); + lv_indev_add_event_cb(indev, release_indev_cb, LV_EVENT_DELETE, indev); return indev; } diff --git a/src/dev/sdl/lv_sdl_mousewheel.c b/src/dev/sdl/lv_sdl_mousewheel.c index 8e112a029..3b37e0b16 100644 --- a/src/dev/sdl/lv_sdl_mousewheel.c +++ b/src/dev/sdl/lv_sdl_mousewheel.c @@ -54,7 +54,7 @@ lv_indev_t * lv_sdl_mousewheel_create(void) lv_indev_set_driver_data(indev, dsc); lv_timer_delete(lv_indev_get_read_timer(indev)); - lv_indev_add_event(indev, release_indev_cb, LV_EVENT_DELETE, indev); + lv_indev_add_event_cb(indev, release_indev_cb, LV_EVENT_DELETE, indev); return indev; } diff --git a/src/dev/sdl/lv_sdl_window.c b/src/dev/sdl/lv_sdl_window.c index e43085bc2..2b2a1eabd 100644 --- a/src/dev/sdl/lv_sdl_window.c +++ b/src/dev/sdl/lv_sdl_window.c @@ -101,7 +101,7 @@ lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res) lv_free(dsc); return NULL; } - lv_display_add_event(disp, release_disp_cb, LV_EVENT_DELETE, disp); + lv_display_add_event_cb(disp, release_disp_cb, LV_EVENT_DELETE, disp); lv_display_set_driver_data(disp, dsc); window_create(disp); @@ -122,7 +122,7 @@ lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res) lv_display_set_draw_buffers(disp, dsc->fb1, dsc->fb2, stride * lv_display_get_vertical_resolution(disp), LV_SDL_RENDER_MODE); } - lv_display_add_event(disp, res_chg_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL); + lv_display_add_event_cb(disp, res_chg_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL); return disp; } diff --git a/src/dev/x11/lv_x11_display.c b/src/dev/x11/lv_x11_display.c index 02386e239..779c3c58c 100644 --- a/src/dev/x11/lv_x11_display.c +++ b/src/dev/x11/lv_x11_display.c @@ -370,8 +370,8 @@ lv_display_t * lv_x11_window_create(char const * title, int32_t hor_res, int32_t } lv_display_set_driver_data(disp, xd); lv_display_set_flush_cb(disp, x11_flush_cb); - lv_display_add_event(disp, x11_resolution_evt_cb, LV_EVENT_RESOLUTION_CHANGED, disp); - lv_display_add_event(disp, x11_disp_delete_evt_cb, LV_EVENT_DELETE, disp); + lv_display_add_event_cb(disp, x11_resolution_evt_cb, LV_EVENT_RESOLUTION_CHANGED, disp); + lv_display_add_event_cb(disp, x11_disp_delete_evt_cb, LV_EVENT_DELETE, disp); x11_window_create(disp, title); diff --git a/src/dev/x11/lv_x11_input.c b/src/dev/x11/lv_x11_input.c index 0d3936161..bf9948204 100644 --- a/src/dev/x11/lv_x11_input.c +++ b/src/dev/x11/lv_x11_input.c @@ -163,7 +163,7 @@ static x11_inp_data_t * x11_input_get_user_data(lv_display_t * disp) if(NULL != *inp_data) { /* initialize timer callback for X11 kb/mouse input event reading */ (*inp_data)->timer = lv_timer_create(x11_inp_event_handler, 1, disp); - lv_display_add_event(disp, x11_inp_delete_evt_cb, LV_EVENT_DELETE, *inp_data); + lv_display_add_event_cb(disp, x11_inp_delete_evt_cb, LV_EVENT_DELETE, *inp_data); } } return *inp_data; diff --git a/src/display/lv_display.c b/src/display/lv_display.c index 600ec9da4..2262d24bf 100644 --- a/src/display/lv_display.c +++ b/src/display/lv_display.c @@ -128,7 +128,7 @@ lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res) disp_def = disp_def_tmp; /*Revert the default display*/ if(disp_def == NULL) disp_def = disp; /*Initialize the default display*/ - lv_display_add_event(disp, disp_event_cb, LV_EVENT_REFR_REQUEST, NULL); + lv_display_add_event_cb(disp, disp_event_cb, LV_EVENT_REFR_REQUEST, NULL); lv_timer_ready(disp->refr_timer); /*Be sure the screen will be refreshed immediately on start up*/ @@ -674,7 +674,7 @@ void lv_screen_load_anim(lv_obj_t * new_scr, lv_screen_load_anim_t anim_type, ui * OTHERS *--------------------*/ -void lv_display_add_event(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data) +void lv_display_add_event_cb(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data) { LV_ASSERT_NULL(disp); diff --git a/src/display/lv_display.h b/src/display/lv_display.h index fa497cc8f..d8b470601 100644 --- a/src/display/lv_display.h +++ b/src/display/lv_display.h @@ -427,7 +427,7 @@ static inline void lv_screen_load(struct _lv_obj_t * scr) * @param filter event code to react or `LV_EVENT_ALL` * @param user_data optional user_data */ -void lv_display_add_event(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); +void lv_display_add_event_cb(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); /** * Get the number of event attached to a display diff --git a/src/indev/lv_indev.c b/src/indev/lv_indev.c index 29a655114..b044f12f7 100644 --- a/src/indev/lv_indev.c +++ b/src/indev/lv_indev.c @@ -512,7 +512,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point) else return NULL; } -void lv_indev_add_event(lv_indev_t * indev, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data) +void lv_indev_add_event_cb(lv_indev_t * indev, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data) { LV_ASSERT_NULL(indev); diff --git a/src/indev/lv_indev.h b/src/indev/lv_indev.h index cb83c937c..cd1b8ed7d 100644 --- a/src/indev/lv_indev.h +++ b/src/indev/lv_indev.h @@ -254,7 +254,7 @@ struct _lv_obj_t * lv_indev_search_obj(struct _lv_obj_t * obj, lv_point_t * poin * @param filter event code to react or `LV_EVENT_ALL` * @param user_data optional user_data */ -void lv_indev_add_event(lv_indev_t * indev, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); +void lv_indev_add_event_cb(lv_indev_t * indev, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); /** * Get the number of event attached to an indev diff --git a/src/others/file_explorer/lv_file_explorer.c b/src/others/file_explorer/lv_file_explorer.c index ca8b5d57c..3b4489d51 100644 --- a/src/others/file_explorer/lv_file_explorer.c +++ b/src/others/file_explorer/lv_file_explorer.c @@ -267,8 +267,8 @@ static void lv_file_explorer_constructor(const lv_obj_class_t * class_p, lv_obj_ explorer->quick_access_area = lv_obj_create(explorer->cont); lv_obj_set_size(explorer->quick_access_area, LV_PCT(FILE_EXPLORER_QUICK_ACCESS_AREA_WIDTH), LV_PCT(100)); lv_obj_set_flex_flow(explorer->quick_access_area, LV_FLEX_FLOW_COLUMN); - lv_obj_add_event(explorer->quick_access_area, quick_access_area_event_handler, LV_EVENT_ALL, - explorer); + lv_obj_add_event_cb(explorer->quick_access_area, quick_access_area_event_handler, LV_EVENT_ALL, + explorer); #endif /*File table area on the right*/ @@ -294,7 +294,7 @@ static void lv_file_explorer_constructor(const lv_obj_class_t * class_p, lv_obj_ lv_obj_set_style_bg_color(lv_list_add_text(explorer->list_device, "DEVICE"), lv_palette_main(LV_PALETTE_ORANGE), 0); btn = lv_list_add_button(explorer->list_device, NULL, LV_SYMBOL_DRIVE " File System"); - lv_obj_add_event(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); + lv_obj_add_event_cb(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); /*list 2*/ explorer->list_places = lv_list_create(explorer->quick_access_area); @@ -302,15 +302,15 @@ static void lv_file_explorer_constructor(const lv_obj_class_t * class_p, lv_obj_ lv_obj_set_style_bg_color(lv_list_add_text(explorer->list_places, "PLACES"), lv_palette_main(LV_PALETTE_LIME), 0); btn = lv_list_add_button(explorer->list_places, NULL, LV_SYMBOL_HOME " HOME"); - lv_obj_add_event(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); + lv_obj_add_event_cb(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); btn = lv_list_add_button(explorer->list_places, NULL, LV_SYMBOL_VIDEO " Video"); - lv_obj_add_event(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); + lv_obj_add_event_cb(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); btn = lv_list_add_button(explorer->list_places, NULL, LV_SYMBOL_IMAGE " Pictures"); - lv_obj_add_event(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); + lv_obj_add_event_cb(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); btn = lv_list_add_button(explorer->list_places, NULL, LV_SYMBOL_AUDIO " Music"); - lv_obj_add_event(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); + lv_obj_add_event_cb(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); btn = lv_list_add_button(explorer->list_places, NULL, LV_SYMBOL_FILE " Documents"); - lv_obj_add_event(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); + lv_obj_add_event_cb(btn, quick_access_event_handler, LV_EVENT_CLICKED, obj); #endif /*Show current path*/ @@ -323,7 +323,7 @@ static void lv_file_explorer_constructor(const lv_obj_class_t * class_p, lv_obj_ lv_obj_set_size(explorer->file_table, LV_PCT(100), LV_PCT(86)); lv_table_set_col_width(explorer->file_table, 0, LV_PCT(100)); lv_table_set_column_count(explorer->file_table, 1); - lv_obj_add_event(explorer->file_table, browser_file_event_handler, LV_EVENT_ALL, obj); + lv_obj_add_event_cb(explorer->file_table, browser_file_event_handler, LV_EVENT_ALL, obj); /*only scroll up and down*/ lv_obj_set_scroll_dir(explorer->file_table, LV_DIR_TOP | LV_DIR_BOTTOM); diff --git a/src/others/fragment/lv_fragment.c b/src/others/fragment/lv_fragment.c index a0bce5d06..c04b3e84c 100644 --- a/src/others/fragment/lv_fragment.c +++ b/src/others/fragment/lv_fragment.c @@ -89,7 +89,7 @@ lv_obj_t * lv_fragment_create_obj(lv_fragment_t * fragment, lv_obj_t * container lv_fragment_manager_create_obj(fragment->child_manager); if(states) { states->obj_created = true; - lv_obj_add_event(obj, cb_delete_assertion, LV_EVENT_DELETE, NULL); + lv_obj_add_event_cb(obj, cb_delete_assertion, LV_EVENT_DELETE, NULL); } if(cls->obj_created_cb) { cls->obj_created_cb(fragment, obj); diff --git a/src/others/gridnav/lv_gridnav.c b/src/others/gridnav/lv_gridnav.c index 7044db12d..c2fc21199 100644 --- a/src/others/gridnav/lv_gridnav.c +++ b/src/others/gridnav/lv_gridnav.c @@ -67,7 +67,7 @@ void lv_gridnav_add(lv_obj_t * obj, lv_gridnav_ctrl_t ctrl) LV_ASSERT_MALLOC(dsc); dsc->ctrl = ctrl; dsc->focused_obj = NULL; - lv_obj_add_event(obj, gridnav_event_cb, LV_EVENT_ALL, dsc); + lv_obj_add_event_cb(obj, gridnav_event_cb, LV_EVENT_ALL, dsc); lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLL_WITH_ARROW); } diff --git a/src/others/ime/lv_ime_pinyin.c b/src/others/ime/lv_ime_pinyin.c index e085f4edf..3d421d291 100644 --- a/src/others/ime/lv_ime_pinyin.c +++ b/src/others/ime/lv_ime_pinyin.c @@ -438,7 +438,7 @@ void lv_ime_pinyin_set_keyboard(lv_obj_t * obj, lv_obj_t * kb) pinyin_ime->kb = kb; lv_obj_set_parent(obj, lv_obj_get_parent(kb)); lv_obj_set_parent(pinyin_ime->cand_panel, lv_obj_get_parent(kb)); - lv_obj_add_event(pinyin_ime->kb, lv_ime_pinyin_kb_event, LV_EVENT_VALUE_CHANGED, obj); + lv_obj_add_event_cb(pinyin_ime->kb, lv_ime_pinyin_kb_event, LV_EVENT_VALUE_CHANGED, obj); lv_obj_align_to(pinyin_ime->cand_panel, pinyin_ime->kb, LV_ALIGN_OUT_TOP_MID, 0, 0); } @@ -597,8 +597,8 @@ static void lv_ime_pinyin_constructor(const lv_obj_class_t * class_p, lv_obj_t * lv_obj_set_style_bg_color(pinyin_ime->cand_panel, lv_color_white(), LV_PART_ITEMS | LV_STATE_PRESSED); /* event handler */ - lv_obj_add_event(pinyin_ime->cand_panel, lv_ime_pinyin_cand_panel_event, LV_EVENT_VALUE_CHANGED, obj); - lv_obj_add_event(obj, lv_ime_pinyin_style_change_event, LV_EVENT_STYLE_CHANGED, NULL); + lv_obj_add_event_cb(pinyin_ime->cand_panel, lv_ime_pinyin_cand_panel_event, LV_EVENT_VALUE_CHANGED, obj); + lv_obj_add_event_cb(obj, lv_ime_pinyin_style_change_event, LV_EVENT_STYLE_CHANGED, NULL); #if LV_IME_PINYIN_USE_K9_MODE pinyin_ime->k9_input_str_len = 0; diff --git a/src/others/observer/lv_observer.c b/src/others/observer/lv_observer.c index 013f5c8f6..63dbfb354 100644 --- a/src/others/observer/lv_observer.c +++ b/src/others/observer/lv_observer.c @@ -285,7 +285,7 @@ lv_observer_t * lv_subject_add_observer_obj(lv_subject_t * subject, lv_observer_ observer->target = obj; /* subscribe to delete event of the object */ if(obj != NULL) { - lv_obj_add_event(obj, unsubscribe_on_delete_cb, LV_EVENT_DELETE, observer); + lv_obj_add_event_cb(obj, unsubscribe_on_delete_cb, LV_EVENT_DELETE, observer); } /* update object immediately */ @@ -402,7 +402,7 @@ lv_observer_t * lv_obj_bind_state_if_not_eq(lv_obj_t * obj, lv_subject_t * subje lv_observer_t * lv_button_bind_checked(lv_obj_t * obj, lv_subject_t * subject) { lv_observer_t * observable = bind_to_bitfield(subject, obj, obj_state_observer_cb, LV_STATE_CHECKED, 1, false); - lv_obj_add_event(obj, btn_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); + lv_obj_add_event_cb(obj, btn_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); return observable; } lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const char * fmt) @@ -432,7 +432,7 @@ lv_observer_t * lv_arc_bind_value(lv_obj_t * obj, lv_subject_t * subject) return NULL; } - lv_obj_add_event(obj, arc_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); + lv_obj_add_event_cb(obj, arc_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); lv_observer_t * observer = lv_subject_add_observer_obj(subject, arc_value_observer_cb, obj, NULL); return observer; @@ -445,7 +445,7 @@ lv_observer_t * lv_slider_bind_value(lv_obj_t * obj, lv_subject_t * subject) return NULL; } - lv_obj_add_event(obj, slider_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); + lv_obj_add_event_cb(obj, slider_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); lv_observer_t * observer = lv_subject_add_observer_obj(subject, slider_value_observer_cb, obj, NULL); return observer; @@ -458,7 +458,7 @@ lv_observer_t * lv_roller_bind_value(lv_obj_t * obj, lv_subject_t * subject) return NULL; } - lv_obj_add_event(obj, roller_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); + lv_obj_add_event_cb(obj, roller_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); lv_observer_t * observer = lv_subject_add_observer_obj(subject, roller_value_observer_cb, obj, NULL); return observer; @@ -472,7 +472,7 @@ lv_observer_t * lv_dropdown_bind_value(lv_obj_t * obj, lv_subject_t * subject) return NULL; } - lv_obj_add_event(obj, dropdown_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); + lv_obj_add_event_cb(obj, dropdown_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, subject); lv_observer_t * observer = lv_subject_add_observer_obj(subject, dropdown_value_observer_cb, obj, NULL); return observer; diff --git a/src/others/sysmon/lv_sysmon.c b/src/others/sysmon/lv_sysmon.c index 5a0eba108..ab7004740 100644 --- a/src/others/sysmon/lv_sysmon.c +++ b/src/others/sysmon/lv_sysmon.c @@ -228,7 +228,7 @@ static void sysmon_backend_init_async_cb(void * user_data) LV_UNUSED(user_data); #if LV_USE_PERF_MONITOR - lv_display_add_event(lv_display_get_default(), perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL); + lv_display_add_event_cb(lv_display_get_default(), perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL); lv_obj_t * obj1 = lv_sysmon_create(lv_layer_sys()); lv_obj_align(obj1, LV_USE_PERF_MONITOR_POS, 0, 0); diff --git a/src/widgets/calendar/lv_calendar.c b/src/widgets/calendar/lv_calendar.c index 888d65eb1..3439baf15 100644 --- a/src/widgets/calendar/lv_calendar.c +++ b/src/widgets/calendar/lv_calendar.c @@ -280,7 +280,7 @@ static void lv_calendar_constructor(const lv_obj_class_t * class_p, lv_obj_t * o calendar->btnm = lv_buttonmatrix_create(obj); lv_buttonmatrix_set_map(calendar->btnm, calendar->map); lv_buttonmatrix_set_button_ctrl_all(calendar->btnm, LV_BUTTONMATRIX_CTRL_CLICK_TRIG | LV_BUTTONMATRIX_CTRL_NO_REPEAT); - lv_obj_add_event(calendar->btnm, draw_part_begin_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); + lv_obj_add_event_cb(calendar->btnm, draw_part_begin_event_cb, LV_EVENT_DRAW_TASK_ADDED, NULL); lv_obj_set_width(calendar->btnm, lv_pct(100)); lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN); diff --git a/src/widgets/calendar/lv_calendar_header_arrow.c b/src/widgets/calendar/lv_calendar_header_arrow.c index 4949016f8..d2d277a3c 100644 --- a/src/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/widgets/calendar/lv_calendar_header_arrow.c @@ -80,7 +80,7 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) int32_t btn_size = lv_obj_get_height(mo_prev); lv_obj_set_width(mo_prev, btn_size); - lv_obj_add_event(mo_prev, month_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(mo_prev, month_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_remove_flag(mo_prev, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_t * label = lv_label_create(obj); @@ -92,10 +92,10 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_obj_set_style_bg_image_src(mo_next, LV_SYMBOL_RIGHT, 0); lv_obj_set_size(mo_next, btn_size, btn_size); - lv_obj_add_event(mo_next, month_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(mo_next, month_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_remove_flag(mo_next, LV_OBJ_FLAG_CLICK_FOCUSABLE); - lv_obj_add_event(obj, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(obj, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Refresh the drop downs*/ lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL); } diff --git a/src/widgets/calendar/lv_calendar_header_dropdown.c b/src/widgets/calendar/lv_calendar_header_dropdown.c index 6ff0412dd..79495cbce 100644 --- a/src/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/widgets/calendar/lv_calendar_header_dropdown.c @@ -84,15 +84,15 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_obj_t * year_dd = lv_dropdown_create(obj); lv_dropdown_set_options(year_dd, year_list); - lv_obj_add_event(year_dd, year_event_cb, LV_EVENT_VALUE_CHANGED, calendar); + lv_obj_add_event_cb(year_dd, year_event_cb, LV_EVENT_VALUE_CHANGED, calendar); lv_obj_set_flex_grow(year_dd, 1); lv_obj_t * month_dd = lv_dropdown_create(obj); lv_dropdown_set_options(month_dd, month_list); - lv_obj_add_event(month_dd, month_event_cb, LV_EVENT_VALUE_CHANGED, calendar); + lv_obj_add_event_cb(month_dd, month_event_cb, LV_EVENT_VALUE_CHANGED, calendar); lv_obj_set_flex_grow(month_dd, 1); - lv_obj_add_event(obj, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(obj, value_changed_event_cb, LV_EVENT_VALUE_CHANGED, NULL); /*Refresh the drop downs*/ lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL); } diff --git a/src/widgets/keyboard/lv_keyboard.c b/src/widgets/keyboard/lv_keyboard.c index a8437ad75..35b85b6f9 100644 --- a/src/widgets/keyboard/lv_keyboard.c +++ b/src/widgets/keyboard/lv_keyboard.c @@ -438,7 +438,7 @@ static void lv_keyboard_constructor(const lv_obj_class_t * class_p, lv_obj_t * o keyboard->popovers = 0; lv_obj_align(obj, LV_ALIGN_BOTTOM_MID, 0, 0); - lv_obj_add_event(obj, lv_keyboard_def_event_cb, LV_EVENT_VALUE_CHANGED, NULL); + lv_obj_add_event_cb(obj, lv_keyboard_def_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_set_style_base_dir(obj, LV_BASE_DIR_LTR, 0); lv_keyboard_update_map(obj); diff --git a/src/widgets/menu/lv_menu.c b/src/widgets/menu/lv_menu.c index 654324d1d..bfadaeadb 100644 --- a/src/widgets/menu/lv_menu.c +++ b/src/widgets/menu/lv_menu.c @@ -300,7 +300,7 @@ void lv_menu_set_sidebar_page(lv_obj_t * obj, lv_obj_t * page) menu->sidebar_header = sidebar_header; lv_obj_t * sidebar_header_back_btn = lv_button_create(menu->sidebar_header); - lv_obj_add_event(sidebar_header_back_btn, lv_menu_back_event_cb, LV_EVENT_CLICKED, menu); + lv_obj_add_event_cb(sidebar_header_back_btn, lv_menu_back_event_cb, LV_EVENT_CLICKED, menu); lv_obj_add_flag(sidebar_header_back_btn, LV_OBJ_FLAG_EVENT_BUBBLE); lv_obj_set_flex_flow(sidebar_header_back_btn, LV_FLEX_FLOW_ROW); menu->sidebar_header_back_btn = sidebar_header_back_btn; @@ -382,8 +382,8 @@ void lv_menu_set_load_page_event(lv_obj_t * menu, lv_obj_t * obj, lv_obj_t * pag event_data->menu = menu; event_data->page = page; - lv_obj_add_event(obj, lv_menu_load_page_event_cb, LV_EVENT_CLICKED, event_data); - lv_obj_add_event(obj, lv_menu_obj_delete_event_cb, LV_EVENT_DELETE, event_data); + lv_obj_add_event_cb(obj, lv_menu_load_page_event_cb, LV_EVENT_CLICKED, event_data); + lv_obj_add_event_cb(obj, lv_menu_obj_delete_event_cb, LV_EVENT_DELETE, event_data); } void lv_menu_set_page_title(lv_obj_t * page_obj, char const * const title) @@ -562,7 +562,7 @@ static void lv_menu_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) /* Create the default simple back btn and title */ lv_obj_t * main_header_back_btn = lv_button_create(menu->main_header); - lv_obj_add_event(main_header_back_btn, lv_menu_back_event_cb, LV_EVENT_CLICKED, menu); + lv_obj_add_event_cb(main_header_back_btn, lv_menu_back_event_cb, LV_EVENT_CLICKED, menu); lv_obj_add_flag(main_header_back_btn, LV_OBJ_FLAG_EVENT_BUBBLE); lv_obj_set_flex_flow(main_header_back_btn, LV_FLEX_FLOW_ROW); menu->main_header_back_btn = main_header_back_btn; @@ -577,7 +577,7 @@ static void lv_menu_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) menu->main_page = NULL; menu->selected_tab = NULL; - lv_obj_add_event(obj, lv_menu_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, menu); + lv_obj_add_event_cb(obj, lv_menu_value_changed_event_cb, LV_EVENT_VALUE_CHANGED, menu); LV_TRACE_OBJ_CREATE("finished"); } diff --git a/src/widgets/msgbox/lv_msgbox.c b/src/widgets/msgbox/lv_msgbox.c index 06b2b9c0f..810b2b21a 100644 --- a/src/widgets/msgbox/lv_msgbox.c +++ b/src/widgets/msgbox/lv_msgbox.c @@ -105,7 +105,7 @@ lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * if(add_close_btn) { mbox->close_btn = lv_button_create(obj); lv_obj_set_ext_click_area(mbox->close_btn, LV_DPX(10)); - lv_obj_add_event(mbox->close_btn, msgbox_close_click_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(mbox->close_btn, msgbox_close_click_event_cb, LV_EVENT_CLICKED, NULL); lv_obj_t * label = lv_label_create(mbox->close_btn); lv_label_set_text(label, LV_SYMBOL_CLOSE); const lv_font_t * font = lv_obj_get_style_text_font(mbox->close_btn, LV_PART_MAIN); diff --git a/src/widgets/tabview/lv_tabview.c b/src/widgets/tabview/lv_tabview.c index 9a54a1bb9..c0aea5066 100644 --- a/src/widgets/tabview/lv_tabview.c +++ b/src/widgets/tabview/lv_tabview.c @@ -78,7 +78,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name) lv_obj_t * button = lv_button_create(tab_bar); lv_obj_set_flex_grow(button, 1); lv_obj_set_size(button, lv_pct(100), lv_pct(100)); - lv_obj_add_event(button, button_clicked_event_cb, LV_EVENT_CLICKED, NULL); + lv_obj_add_event_cb(button, button_clicked_event_cb, LV_EVENT_CLICKED, NULL); lv_group_t * g = lv_group_get_default(); if(g) lv_group_add_obj(g, button); @@ -265,7 +265,7 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob cont = lv_obj_create(obj); lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW); - lv_obj_add_event(cont, cont_scroll_end_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(cont, cont_scroll_end_event_cb, LV_EVENT_ALL, NULL); lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF); lv_tabview_set_tab_position(obj, LV_DIR_TOP); diff --git a/src/widgets/textarea/lv_textarea.c b/src/widgets/textarea/lv_textarea.c index b80ada04e..f9cb03291 100644 --- a/src/widgets/textarea/lv_textarea.c +++ b/src/widgets/textarea/lv_textarea.c @@ -840,7 +840,7 @@ static void lv_textarea_constructor(const lv_obj_class_t * class_p, lv_obj_t * o ta->label = lv_label_create(obj); lv_obj_set_width(ta->label, lv_pct(100)); lv_label_set_text(ta->label, ""); - lv_obj_add_event(ta->label, label_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(ta->label, label_event_cb, LV_EVENT_ALL, NULL); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLL_WITH_ARROW); diff --git a/src/widgets/tileview/lv_tileview.c b/src/widgets/tileview/lv_tileview.c index 148c7f20a..b937f417c 100644 --- a/src/widgets/tileview/lv_tileview.c +++ b/src/widgets/tileview/lv_tileview.c @@ -133,7 +133,7 @@ static void lv_tileview_constructor(const lv_obj_class_t * class_p, lv_obj_t * o { LV_UNUSED(class_p); lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100)); - lv_obj_add_event(obj, tileview_event_cb, LV_EVENT_ALL, NULL); + lv_obj_add_event_cb(obj, tileview_event_cb, LV_EVENT_ALL, NULL); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ONE); lv_obj_set_scroll_snap_x(obj, LV_SCROLL_SNAP_CENTER); lv_obj_set_scroll_snap_y(obj, LV_SCROLL_SNAP_CENTER); diff --git a/tests/src/test_cases/test_bindings.c b/tests/src/test_cases/test_bindings.c index c8436b83b..fb6036a67 100644 --- a/tests/src/test_cases/test_bindings.c +++ b/tests/src/test_cases/test_bindings.c @@ -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*/ diff --git a/tests/src/test_cases/widgets/test_arc.c b/tests/src/test_cases/widgets/test_arc.c index 4f9d965bd..968ce89b3 100644 --- a/tests/src/test_cases/widgets/test_arc.c +++ b/tests/src/test_cases/widgets/test_arc.c @@ -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 */ diff --git a/tests/src/test_cases/widgets/test_btnmatrix.c b/tests/src/test_cases/widgets/test_btnmatrix.c index 84944ec30..d188bf0f5 100644 --- a/tests/src/test_cases/widgets/test_btnmatrix.c +++ b/tests/src/test_cases/widgets/test_btnmatrix.c @@ -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); diff --git a/tests/src/test_cases/widgets/test_checkbox.c b/tests/src/test_cases/widgets/test_checkbox.c index 39a5e12e2..23e4bad4e 100644 --- a/tests/src/test_cases/widgets/test_checkbox.c +++ b/tests/src/test_cases/widgets/test_checkbox.c @@ -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); diff --git a/tests/src/test_cases/widgets/test_dropdown.c b/tests/src/test_cases/widgets/test_dropdown.c index 3ca7d4518..b6c6bdd87 100644 --- a/tests/src/test_cases/widgets/test_dropdown.c +++ b/tests/src/test_cases/widgets/test_dropdown.c @@ -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); diff --git a/tests/src/test_cases/widgets/test_line.c b/tests/src/test_cases/widgets/test_line.c index bc5769ca9..24c7a6323 100644 --- a/tests/src/test_cases/widgets/test_line.c +++ b/tests/src/test_cases/widgets/test_line.c @@ -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); diff --git a/tests/src/test_cases/widgets/test_obj_flags.c b/tests/src/test_cases/widgets/test_obj_flags.c index 0dc68b5c7..41df79872 100644 --- a/tests/src/test_cases/widgets/test_obj_flags.c +++ b/tests/src/test_cases/widgets/test_obj_flags.c @@ -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"); diff --git a/tests/src/test_cases/widgets/test_switch.c b/tests/src/test_cases/widgets/test_switch.c index d962af282..9ab8a4604 100644 --- a/tests/src/test_cases/widgets/test_switch.c +++ b/tests/src/test_cases/widgets/test_switch.c @@ -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); diff --git a/tests/src/test_cases/widgets/test_table.c b/tests/src/test_cases/widgets/test_table.c index cd01796bd..eb8d381b9 100644 --- a/tests/src/test_cases/widgets/test_table.c +++ b/tests/src/test_cases/widgets/test_table.c @@ -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);