mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:28:13 +00:00
LibGUI: Fire Show/Hide events when adding/removing widget from tree
This ensures that widgets always get an initial show event.
This commit is contained in:
parent
4ee5dfbe4b
commit
5908873b45
1 changed files with 9 additions and 0 deletions
|
@ -219,6 +219,11 @@ void Widget::child_event(Core::ChildEvent& event)
|
|||
}
|
||||
if (window() && event.child() && is<Widget>(*event.child()))
|
||||
window()->did_add_widget({}, verify_cast<Widget>(*event.child()));
|
||||
|
||||
if (event.child() && is<Widget>(*event.child()) && static_cast<Widget const&>(*event.child()).is_visible()) {
|
||||
ShowEvent show_event;
|
||||
event.child()->dispatch_event(show_event);
|
||||
}
|
||||
}
|
||||
if (event.type() == Event::ChildRemoved) {
|
||||
if (layout()) {
|
||||
|
@ -228,6 +233,10 @@ void Widget::child_event(Core::ChildEvent& event)
|
|||
}
|
||||
if (window() && event.child() && is<Widget>(*event.child()))
|
||||
window()->did_remove_widget({}, verify_cast<Widget>(*event.child()));
|
||||
if (event.child() && is<Widget>(*event.child())) {
|
||||
HideEvent hide_event;
|
||||
event.child()->dispatch_event(hide_event);
|
||||
}
|
||||
update();
|
||||
}
|
||||
return Core::Object::child_event(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue