1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

LibGUI: Implement calculated_min_size() for AbstractScrollableWidget

This commit is contained in:
thankyouverycool 2022-09-22 11:15:25 -04:00 committed by Andreas Kling
parent 521e19444c
commit d495405e53
2 changed files with 10 additions and 0 deletions

View file

@ -331,4 +331,12 @@ Gfx::IntPoint AbstractScrollableWidget::to_widget_position(Gfx::IntPoint const&
widget_position.translate_by(frame_thickness(), frame_thickness()); widget_position.translate_by(frame_thickness(), frame_thickness());
return widget_position; return widget_position;
} }
Optional<UISize> AbstractScrollableWidget::calculated_min_size() const
{
auto vertical_scrollbar = m_vertical_scrollbar->effective_min_size().height().as_int();
auto horizontal_scrollbar = m_horizontal_scrollbar->effective_min_size().width().as_int();
return { { horizontal_scrollbar + corner_widget().width() + frame_thickness() * 2, vertical_scrollbar + corner_widget().height() + frame_thickness() * 2 } };
}
} }

View file

@ -70,6 +70,8 @@ public:
Gfx::IntRect to_content_rect(Gfx::IntRect const& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; } Gfx::IntRect to_content_rect(Gfx::IntRect const& widget_rect) const { return { to_content_position(widget_rect.location()), widget_rect.size() }; }
Gfx::IntRect to_widget_rect(Gfx::IntRect const& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; } Gfx::IntRect to_widget_rect(Gfx::IntRect const& content_rect) const { return { to_widget_position(content_rect.location()), content_rect.size() }; }
virtual Optional<UISize> calculated_min_size() const override;
protected: protected:
AbstractScrollableWidget(); AbstractScrollableWidget();
virtual void custom_layout() override; virtual void custom_layout() override;