feat(event) add LV_EVENT_SCREEN_LOADED/UNLOADED events
This commit is contained in:
@@ -110,6 +110,8 @@ The following event codes exist:
|
|||||||
- `LV_EVENT_STYLE_CHANGED` Object's style has changed
|
- `LV_EVENT_STYLE_CHANGED` Object's style has changed
|
||||||
- `LV_EVENT_BASE_DIR_CHANGED` The base dir 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_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
|
### Special events
|
||||||
- `LV_EVENT_VALUE_CHANGED` The object's value has changed (i.e. slider moved)
|
- `LV_EVENT_VALUE_CHANGED` The object's value has changed (i.e. slider moved)
|
||||||
|
|||||||
@@ -82,8 +82,13 @@ void lv_disp_load_scr(lv_obj_t * scr)
|
|||||||
{
|
{
|
||||||
lv_disp_t * d = lv_obj_get_disp(scr);
|
lv_disp_t * d = lv_obj_get_disp(scr);
|
||||||
if(!d) return; /*Shouldn't happen, just to be sure*/
|
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;
|
d->act_scr = scr;
|
||||||
|
|
||||||
|
if(d->act_scr) lv_event_send(d->act_scr, LV_EVENT_SCREEN_LOADED, NULL);
|
||||||
|
|
||||||
lv_obj_invalidate(scr);
|
lv_obj_invalidate(scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ typedef enum {
|
|||||||
LV_EVENT_CHILD_CHANGED, /**< Child was removed, added, or its size, position were changed */
|
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_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_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_SIZE_CHANGED, /**< Object coordinates/size have changed*/
|
||||||
LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/
|
LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/
|
||||||
LV_EVENT_LAYOUT_CHANGED, /**< The children position has changed due to a layout recalculation*/
|
LV_EVENT_LAYOUT_CHANGED, /**< The children position has changed due to a layout recalculation*/
|
||||||
|
|||||||
Reference in New Issue
Block a user