mirror of
https://github.com/RGBCube/serenity
synced 2025-07-05 13:47:36 +00:00
LibGUI: Add GWidget::for_each_child_widget(callback).
This commit is contained in:
parent
906fde8f8c
commit
723ba91f74
6 changed files with 43 additions and 40 deletions
|
@ -116,15 +116,15 @@ void GWidget::handle_paint_event(GPaintEvent& event)
|
|||
#endif
|
||||
}
|
||||
paint_event(event);
|
||||
for (auto* ch : children()) {
|
||||
auto* child = (GWidget*)ch;
|
||||
if (!child->is_visible())
|
||||
continue;
|
||||
if (child->relative_rect().intersects(event.rect())) {
|
||||
GPaintEvent local_event(event.rect().intersected(child->relative_rect()).translated(-child->relative_position()));
|
||||
child->event(local_event);
|
||||
for_each_child_widget([&] (auto& child) {
|
||||
if (!child.is_visible())
|
||||
return IterationDecision::Continue;
|
||||
if (child.relative_rect().intersects(event.rect())) {
|
||||
GPaintEvent local_event(event.rect().intersected(child.relative_rect()).translated(-child.relative_position()));
|
||||
child.event(local_event);
|
||||
}
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
second_paint_event(event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue