mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-28 13:36:27 +08:00
fix(obj): remove all events from the object (#7811)
Arduino Lint / lint (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Arduino Lint / lint (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Co-authored-by: Fabian Zäh <Fabian.Zaeh@livetec.de>
This commit is contained in:
+18
-17
@@ -126,23 +126,6 @@ bool lv_obj_remove_event(lv_obj_t * obj, uint32_t index)
|
|||||||
return lv_event_remove(&obj->spec_attr->event_list, index);
|
return lv_event_remove(&obj->spec_attr->event_list, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
|
|
||||||
{
|
|
||||||
LV_ASSERT_NULL(obj);
|
|
||||||
|
|
||||||
uint32_t event_cnt = lv_obj_get_event_count(obj);
|
|
||||||
uint32_t i;
|
|
||||||
for(i = 0; i < event_cnt; i++) {
|
|
||||||
lv_event_dsc_t * dsc = lv_obj_get_event_dsc(obj, i);
|
|
||||||
if(dsc && dsc->cb == event_cb) {
|
|
||||||
lv_obj_remove_event(obj, i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc)
|
bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc)
|
||||||
{
|
{
|
||||||
LV_ASSERT_NULL(obj);
|
LV_ASSERT_NULL(obj);
|
||||||
@@ -151,6 +134,24 @@ bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc)
|
|||||||
return lv_event_remove_dsc(&obj->spec_attr->event_list, dsc);
|
return lv_event_remove_dsc(&obj->spec_attr->event_list, dsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
|
||||||
|
{
|
||||||
|
LV_ASSERT_NULL(obj);
|
||||||
|
|
||||||
|
uint32_t event_cnt = lv_obj_get_event_count(obj);
|
||||||
|
uint32_t removed_count = 0;
|
||||||
|
uint32_t i;
|
||||||
|
for(i = 0; i < event_cnt; i++) {
|
||||||
|
lv_event_dsc_t * dsc = lv_obj_get_event_dsc(obj, i);
|
||||||
|
if(dsc && dsc->cb == event_cb) {
|
||||||
|
lv_obj_remove_event(obj, i);
|
||||||
|
removed_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return removed_count;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data)
|
uint32_t lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_cb, void * user_data)
|
||||||
{
|
{
|
||||||
LV_ASSERT_NULL(obj);
|
LV_ASSERT_NULL(obj);
|
||||||
|
|||||||
@@ -86,10 +86,16 @@ lv_event_dsc_t * lv_obj_get_event_dsc(lv_obj_t * obj, uint32_t index);
|
|||||||
|
|
||||||
bool lv_obj_remove_event(lv_obj_t * obj, uint32_t index);
|
bool lv_obj_remove_event(lv_obj_t * obj, uint32_t index);
|
||||||
|
|
||||||
bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
|
|
||||||
|
|
||||||
bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc);
|
bool lv_obj_remove_event_dsc(lv_obj_t * obj, lv_event_dsc_t * dsc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an event_cb from an object
|
||||||
|
* @param obj pointer to a obj
|
||||||
|
* @param event_cb the event_cb of the event to remove
|
||||||
|
* @return the count of the event removed
|
||||||
|
*/
|
||||||
|
uint32_t lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an event_cb with user_data
|
* Remove an event_cb with user_data
|
||||||
* @param obj pointer to a obj
|
* @param obj pointer to a obj
|
||||||
|
|||||||
Reference in New Issue
Block a user