mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:55:09 +00:00
VisualBuilder: Use real GWidgets instead of pretend VBWidgets.
That first design was the wrong idea. Instead, have VBWidget instantiate a GWidget of the appropriate type and parent it to the VBForm. We then use a new "greedy hit-testing" mechanism in GWidget to prevent any mouse events from reaching the VBForm's children. To paint the grabbers above the child widgets, I added a slightly hackish but kind of neat second_paint_event() that is called after a widget has painted all of his children. :^)
This commit is contained in:
parent
af070324db
commit
c6ffb3e2b8
12 changed files with 94 additions and 87 deletions
|
@ -115,6 +115,7 @@ void GWidget::handle_paint_event(GPaintEvent& event)
|
|||
child->event(local_event);
|
||||
}
|
||||
}
|
||||
second_paint_event(event);
|
||||
}
|
||||
|
||||
void GWidget::set_layout(OwnPtr<GLayout>&& layout)
|
||||
|
@ -207,6 +208,10 @@ void GWidget::paint_event(GPaintEvent&)
|
|||
{
|
||||
}
|
||||
|
||||
void GWidget::second_paint_event(GPaintEvent&)
|
||||
{
|
||||
}
|
||||
|
||||
void GWidget::show_event(GShowEvent&)
|
||||
{
|
||||
}
|
||||
|
@ -282,6 +287,8 @@ Rect GWidget::screen_relative_rect() const
|
|||
|
||||
GWidget::HitTestResult GWidget::hit_test(int x, int y)
|
||||
{
|
||||
if (is_greedy_for_hits())
|
||||
return { this, x, y };
|
||||
for (int i = children().size() - 1; i >= 0; --i) {
|
||||
if (!children()[i]->is_widget())
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue