summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-25 13:58:47 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-25 13:58:47 +0100
commit4d3478aa7157bde0f8e54df4464531abe901c7b5 (patch)
tree4d1df9f1ce08a6a8e8ea75e12927520eb6ed76c7 /LibGUI
parent20137e45f487ad3a9314e96de2f24e9676184134 (diff)
downloadserenity-4d3478aa7157bde0f8e54df4464531abe901c7b5.zip
GItemView: Hide the horizontal scrollbar since we never need it.
This view always relayouts the content to fit the available width, so we don't need a horizontal scrollbar. :^)
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GItemView.cpp1
-rw-r--r--LibGUI/GScrollableWidget.cpp7
2 files changed, 6 insertions, 2 deletions
diff --git a/LibGUI/GItemView.cpp b/LibGUI/GItemView.cpp
index 29195cdc7b..f5ef4ba387 100644
--- a/LibGUI/GItemView.cpp
+++ b/LibGUI/GItemView.cpp
@@ -7,6 +7,7 @@
GItemView::GItemView(GWidget* parent)
: GAbstractView(parent)
{
+ horizontal_scrollbar().set_visible(false);
}
GItemView::~GItemView()
diff --git a/LibGUI/GScrollableWidget.cpp b/LibGUI/GScrollableWidget.cpp
index a47e99e1d6..d0ec6a12cc 100644
--- a/LibGUI/GScrollableWidget.cpp
+++ b/LibGUI/GScrollableWidget.cpp
@@ -29,8 +29,11 @@ void GScrollableWidget::resize_event(GResizeEvent& event)
{
update_scrollbar_ranges();
- m_vertical_scrollbar->set_relative_rect(event.size().width() - m_vertical_scrollbar->preferred_size().width(), 0, m_vertical_scrollbar->preferred_size().width(), event.size().height() - m_horizontal_scrollbar->preferred_size().height());
- m_horizontal_scrollbar->set_relative_rect(0, event.size().height() - m_horizontal_scrollbar->preferred_size().height(), event.size().width() - m_vertical_scrollbar->preferred_size().width(), m_horizontal_scrollbar->preferred_size().height());
+ int height_wanted_by_horizontal_scrollbar = m_horizontal_scrollbar->is_visible() ? m_horizontal_scrollbar->height() : 0;
+ int width_wanted_by_vertical_scrollbar = m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->width() : 0;
+
+ m_vertical_scrollbar->set_relative_rect(event.size().width() - m_vertical_scrollbar->preferred_size().width(), 0, m_vertical_scrollbar->preferred_size().width(), event.size().height() - height_wanted_by_horizontal_scrollbar);
+ m_horizontal_scrollbar->set_relative_rect(0, event.size().height() - m_horizontal_scrollbar->preferred_size().height(), event.size().width() - m_vertical_scrollbar->preferred_size().width(), width_wanted_by_vertical_scrollbar);
m_corner_widget->set_visible(m_vertical_scrollbar->is_visible() && m_horizontal_scrollbar->is_visible());
if (m_corner_widget->is_visible()) {