1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +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:
Andreas Kling 2019-04-11 03:34:37 +02:00
parent af070324db
commit c6ffb3e2b8
12 changed files with 94 additions and 87 deletions

View file

@ -56,6 +56,9 @@ public:
virtual void leave_event(CEvent&);
virtual void child_event(CChildEvent&) override;
// This is called after children have been painted.
virtual void second_paint_event(GPaintEvent&);
Rect relative_rect() const { return m_relative_rect; }
Point relative_position() const { return m_relative_rect.location(); }
@ -147,6 +150,9 @@ public:
bool spans_entire_window_horizontally() const;
bool is_greedy_for_hits() const { return m_greedy_for_hits; }
void set_greedy_for_hits(bool b) { m_greedy_for_hits = b; }
private:
virtual bool is_widget() const final { return true; }
@ -173,6 +179,7 @@ private:
bool m_fill_with_background_color { false };
bool m_visible { true };
bool m_greedy_for_hits { false };
CElapsedTimer m_click_clock;
};