add LV_EVENT_DELETE

This commit is contained in:
Gabor Kiss-Vamosi
2019-04-19 05:46:02 +02:00
parent beeedfc1b2
commit a2cb299c0c
3 changed files with 10 additions and 1 deletions

View File

@@ -1114,6 +1114,8 @@ static void indev_drag(lv_indev_proc_t * state)
if(state->types.pointer.drag_in_prog == 0) {
drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act);
if(state->reset_query != 0) return;
lv_event_send(drag_obj, LV_EVENT_DRAG_BEGIN, NULL);
if(state->reset_query) return; /*The object might be deleted*/
}
state->types.pointer.drag_in_prog = 1;

View File

@@ -379,7 +379,7 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
if(event_act_obj == obj && event_act_obj_deleted == false) event_act_obj_deleted = true;
/*Delete from the group*/
/*Delete from the group*/
#if LV_USE_GROUP
bool was_focused = false;
lv_group_t * group = lv_obj_get_group(obj);
@@ -410,6 +410,9 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
i = i_next;
}
/*Let the suer free the resources used in `LV_EVENT_DELETE`*/
lv_event_send(obj, LV_EVENT_DELETE, NULL);
/*Remove the object from parent's children list*/
lv_obj_t * par = lv_obj_get_parent(obj);
if(par == NULL) { /*It is a screen*/
@@ -2202,6 +2205,9 @@ static void delete_children(lv_obj_t * obj)
i = i_next;
}
/*Let the suer free the resources used in `LV_EVENT_DELETE`*/
lv_event_send(obj, LV_EVENT_DELETE, NULL);
/*Remove the animations from this object*/
#if LV_USE_ANIMATION
lv_anim_del(obj, NULL);

View File

@@ -98,6 +98,7 @@ enum {
LV_EVENT_REFRESH,
LV_EVENT_APPLY, /*"Ok", "Apply" or similar specific button has clicked*/
LV_EVENT_CANCEL, /*"Close", "Cancel" or similar specific button has clicked*/
LV_EVENT_DELETE,
};
typedef uint8_t lv_event_t;