Skip to content

Commit

Permalink
widget_clone trigger EVT_WIDGET_LOAD
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Jan 27, 2025
1 parent 9d1468b commit dcc3ae1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

2025/01/27
* 事件名支持 anim_start/anim_once/anim_end
* widget_clone 触发 EVT_WIDGET_LOAD 事件。

2025/01/21
* 调整打包工具参数顺序,兼容原来打包工具的使用方式(感谢培煌提供补丁)
Expand Down
5 changes: 4 additions & 1 deletion src/base/widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -3957,8 +3957,11 @@ widget_t* widget_clone(widget_t* widget, widget_t* parent) {
clone = widget->vt->create(parent, widget->x, widget->y, widget->w, widget->h);
return_value_if_fail(clone != NULL, NULL);

clone->loading = TRUE;
widget_copy(clone, widget);

widget_dispatch_simple_event(widget, EVT_WIDGET_LOAD);
clone->loading = FALSE;

WIDGET_FOR_EACH_CHILD_BEGIN(widget, iter, i)
if (iter->auto_created != TRUE) {
widget_clone(iter, clone);
Expand Down

0 comments on commit dcc3ae1

Please sign in to comment.