feat(event) add LV_EVENT_SCREEN_LOADED/UNLOADED events

This commit is contained in:
Gabor Kiss-Vamosi
2021-10-13 12:35:58 +02:00
parent 7124ef7761
commit ee5369e2d2
3 changed files with 10 additions and 0 deletions

View File

@@ -110,6 +110,8 @@ The following event codes exist:
- `LV_EVENT_STYLE_CHANGED` Object's style has changed
- `LV_EVENT_BASE_DIR_CHANGED` The base dir has changed
- `LV_EVENT_GET_SELF_SIZE` Get the internal size of a widget
- `LV_EVENT_SCREEN_LOADED` A screen was loaded
- `LV_EVENT_SCREEN_UNLOADED` A screen was unloaded
### Special events
- `LV_EVENT_VALUE_CHANGED` The object's value has changed (i.e. slider moved)

View File

@@ -82,8 +82,13 @@ void lv_disp_load_scr(lv_obj_t * scr)
{
lv_disp_t * d = lv_obj_get_disp(scr);
if(!d) return; /*Shouldn't happen, just to be sure*/
if(d->act_scr) lv_event_send(d->act_scr, LV_EVENT_SCREEN_UNLOADED, NULL);
d->act_scr = scr;
if(d->act_scr) lv_event_send(d->act_scr, LV_EVENT_SCREEN_LOADED, NULL);
lv_obj_invalidate(scr);
}

View File

@@ -75,6 +75,9 @@ typedef enum {
LV_EVENT_CHILD_CHANGED, /**< Child was removed, added, or its size, position were changed */
LV_EVENT_CHILD_CREATED, /**< Child was created, always bubbles up to all parents*/
LV_EVENT_CHILD_DELETED, /**< Child was deleted, always bubbles up to all parents*/
LV_EVENT_SCREEN_LOADED, /**< A screen was loaded*/
LV_EVENT_SCREEN_UNLOADED, /**< A screen was unloaded*/
LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed*/
LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/
LV_EVENT_LAYOUT_CHANGED, /**< The children position has changed due to a layout recalculation*/