summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-09-22 11:15:25 -0400
committerAndreas Kling <kling@serenityos.org>2022-09-24 22:59:12 +0200
commitd495405e531e054535e3698d7dd49da170eb7479 (patch)
tree6630cde4fe7dcde2a6d9f079976e047eda012ef5
parent521e19444c2244f4240ca69be44040b47d91a303 (diff)
downloadserenity-d495405e531e054535e3698d7dd49da170eb7479.zip
LibGUI: Implement calculated_min_size() for AbstractScrollableWidget
-rw-r--r--Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp8
-rw-r--r--Userland/Libraries/LibGUI/AbstractScrollableWidget.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
index 596884a075..8dc67c0672 100644
--- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
+++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
@@ -331,4 +331,12 @@ Gfx::IntPoint AbstractScrollableWidget::to_widget_position(Gfx::IntPoint const&
widget_position.translate_by(frame_thickness(), frame_thickness());
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 } };
+}
+
}
diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.h b/Userland/Libraries/LibGUI/AbstractScrollableWidget.h
index 88030ef5f6..4c521ecae2 100644
--- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.h
+++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.h
@@ -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_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:
AbstractScrollableWidget();
virtual void custom_layout() override;