1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:58:14 +00:00

LibGUI: Add ScrollableWidget helpers for rect conversion

to_content_rect() and to_widget_rect() help you convert rects from one
coordinate space to the other.
This commit is contained in:
Andreas Kling 2020-12-16 19:31:33 +01:00
parent 00dc615d53
commit 50aab509ce

View file

@ -77,6 +77,9 @@ public:
Gfx::IntPoint to_content_position(const Gfx::IntPoint& widget_position) const;
Gfx::IntPoint to_widget_position(const Gfx::IntPoint& content_position) const;
Gfx::IntRect to_content_rect(const Gfx::IntRect& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; }
Gfx::IntRect to_widget_rect(const Gfx::IntRect& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; }
protected:
ScrollableWidget();
virtual void custom_layout() override;