summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
diff options
context:
space:
mode:
authorFrHun <28605587+frhun@users.noreply.github.com>2022-06-12 23:34:02 +0200
committerSam Atkins <atkinssj@gmail.com>2022-06-28 17:52:42 +0100
commit0d56d80514d707c3ebffe32bf03e5f0ec1f73678 (patch)
tree74d2b123d4184273534727438cb17007f055fe7f /Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
parent3451181fbf2d6c33d70f3e2cd493ac39cc3ef65a (diff)
downloadserenity-0d56d80514d707c3ebffe32bf03e5f0ec1f73678.zip
LibGUI: Use new layout system in scrollable widgets
These changes are mainly nessecairy to remove dependence on the temporary implicit conversions currently still in place.
Diffstat (limited to 'Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp')
-rw-r--r--Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
index 5be629187e..22f1567c05 100644
--- a/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
+++ b/Userland/Libraries/LibGUI/AbstractScrollableWidget.cpp
@@ -78,17 +78,23 @@ void AbstractScrollableWidget::custom_layout()
int height_wanted_by_horizontal_scrollbar = m_horizontal_scrollbar->is_visible() ? int(m_horizontal_scrollbar->min_height()) : 0;
int width_wanted_by_vertical_scrollbar = m_vertical_scrollbar->is_visible() ? int(m_vertical_scrollbar->min_width()) : 0;
- m_vertical_scrollbar->set_relative_rect(
- inner_rect.right() + 1 - m_vertical_scrollbar->min_width(),
- inner_rect.top(),
- m_vertical_scrollbar->min_width(),
- inner_rect.height() - height_wanted_by_horizontal_scrollbar);
-
- m_horizontal_scrollbar->set_relative_rect(
- inner_rect.left(),
- inner_rect.bottom() + 1 - m_horizontal_scrollbar->min_height(),
- inner_rect.width() - width_wanted_by_vertical_scrollbar,
- m_horizontal_scrollbar->min_height());
+ {
+ int vertical_scrollbar_width = m_vertical_scrollbar->effective_min_size().width().as_int();
+ m_vertical_scrollbar->set_relative_rect(
+ inner_rect.right() + 1 - vertical_scrollbar_width,
+ inner_rect.top(),
+ vertical_scrollbar_width,
+ inner_rect.height() - height_wanted_by_horizontal_scrollbar);
+ }
+
+ {
+ int horizontal_scrollbar_height = m_horizontal_scrollbar->effective_min_size().height().as_int();
+ m_horizontal_scrollbar->set_relative_rect(
+ inner_rect.left(),
+ inner_rect.bottom() + 1 - horizontal_scrollbar_height,
+ inner_rect.width() - width_wanted_by_vertical_scrollbar,
+ horizontal_scrollbar_height);
+ }
m_corner_widget->set_visible(m_vertical_scrollbar->is_visible() && m_horizontal_scrollbar->is_visible());
if (m_corner_widget->is_visible()) {
@@ -106,8 +112,8 @@ void AbstractScrollableWidget::resize_event(ResizeEvent& event)
Gfx::IntSize AbstractScrollableWidget::available_size() const
{
auto inner_size = Widget::content_size();
- unsigned available_width = max(inner_size.width() - m_size_occupied_by_fixed_elements.width(), 0);
- unsigned available_height = max(inner_size.height() - m_size_occupied_by_fixed_elements.height(), 0);
+ int available_width = max(inner_size.width() - m_size_occupied_by_fixed_elements.width(), 0);
+ int available_height = max(inner_size.height() - m_size_occupied_by_fixed_elements.height(), 0);
return { available_width, available_height };
}