add EVT_WIDGET_LOAD event

This commit is contained in:
lixianjing 2019-12-11 09:31:31 +08:00
parent 8169cf9383
commit a2d4763bc3
3 changed files with 18 additions and 1 deletions

View File

@ -241,6 +241,11 @@ typedef enum _event_type_t {
* (event_t)
*/
EVT_WINDOW_LOAD,
/**
* @const EVT_WIDGET_LOAD
* (event_t)
*/
EVT_WIDGET_LOAD,
/**
* @const EVT_WINDOW_WILL_OPEN
* (event_t)

View File

@ -373,6 +373,12 @@ struct _widget_t {
*
*/
uint8_t initializing : 1;
/**
* @property {bool_t} loading
* @annotation ["readable"]
*
*/
uint8_t loading : 1;
/**
* @property {bool_t} destroying
* @annotation ["readable"]

View File

@ -44,6 +44,7 @@ static ret_t ui_builder_default_on_widget_start(ui_builder_t* b, const widget_de
}
b->widget = widget;
b->widget->loading = TRUE;
if (b->root == NULL) {
b->root = widget;
}
@ -61,7 +62,12 @@ static ret_t ui_builder_default_on_widget_prop(ui_builder_t* b, const char* name
}
static ret_t ui_builder_default_on_widget_prop_end(ui_builder_t* b) {
(void)b;
if (b->widget != NULL) {
event_t e = event_init(EVT_WIDGET_LOAD, NULL);
widget_dispatch(b->widget, &e);
b->widget->loading = FALSE;
}
return RET_OK;
}