diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-10-06 08:25:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 08:25:06 +0200 |
commit | 9962c59dc518ed62b9e471752e621bb73af97211 (patch) | |
tree | 92c1e8f4ea2bbb75cbd29b76afc25b0af813b364 /scene/gui | |
parent | b04b3064ec3f28ac1bd87b97cf66e125a6d3843a (diff) | |
parent | 1c0ebc85dd8002e3763e858d71c10b8b72727fff (diff) |
Merge pull request #53446 from nekomatata/container-pre-sort-children
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/container.cpp | 6 | ||||
-rw-r--r-- | scene/gui/container.h | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 11941529cd..a1bd82f6f7 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -87,6 +87,9 @@ void Container::_sort_children() { return; } + notification(NOTIFICATION_PRE_SORT_CHILDREN); + emit_signal(SceneStringNames::get_singleton()->pre_sort_children); + notification(NOTIFICATION_SORT_CHILDREN); emit_signal(SceneStringNames::get_singleton()->sort_children); pending_sort = false; @@ -174,7 +177,10 @@ void Container::_bind_methods() { ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort); ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child", "rect"), &Container::fit_child_in_rect); + BIND_CONSTANT(NOTIFICATION_PRE_SORT_CHILDREN); BIND_CONSTANT(NOTIFICATION_SORT_CHILDREN); + + ADD_SIGNAL(MethodInfo("pre_sort_children")); ADD_SIGNAL(MethodInfo("sort_children")); } diff --git a/scene/gui/container.h b/scene/gui/container.h index bce3085f0c..f3ae948556 100644 --- a/scene/gui/container.h +++ b/scene/gui/container.h @@ -51,7 +51,8 @@ protected: public: enum { - NOTIFICATION_SORT_CHILDREN = 50 + NOTIFICATION_PRE_SORT_CHILDREN = 50, + NOTIFICATION_SORT_CHILDREN = 51, }; void fit_child_in_rect(Control *p_child, const Rect2 &p_rect); |