GUI: Rename ScrollBar::scrubber_size() to ScrollBar::visibile_scrubber_size()

This commit is contained in:
Nico Weber 2020-08-11 21:32:40 -04:00 committed by Andreas Kling
parent cb2d56b909
commit 8eee5312c5
Notes: sideshowbarker 2024-07-19 03:52:30 +09:00
2 changed files with 8 additions and 8 deletions

View file

@ -179,9 +179,9 @@ Gfx::IntRect ScrollBar::increment_gutter_rect() const
int ScrollBar::scrubbable_range_in_pixels() const int ScrollBar::scrubbable_range_in_pixels() const
{ {
if (orientation() == Orientation::Vertical) if (orientation() == Orientation::Vertical)
return height() - button_height() * 2 - scrubber_size(); return height() - button_height() * 2 - visible_scrubber_size();
else else
return width() - button_width() * 2 - scrubber_size(); return width() - button_width() * 2 - visible_scrubber_size();
} }
bool ScrollBar::has_scrubber() const bool ScrollBar::has_scrubber() const
@ -189,7 +189,7 @@ bool ScrollBar::has_scrubber() const
return m_max != m_min; return m_max != m_min;
} }
int ScrollBar::scrubber_size() const int ScrollBar::visible_scrubber_size() const
{ {
int pixel_range = length(orientation()) - button_size() * 2; int pixel_range = length(orientation()) - button_size() * 2;
int value_range = m_max - m_min; int value_range = m_max - m_min;
@ -205,13 +205,13 @@ int ScrollBar::scrubber_size() const
Gfx::IntRect ScrollBar::scrubber_rect() const Gfx::IntRect ScrollBar::scrubber_rect() const
{ {
if (!has_scrubber() || length(orientation()) <= (button_size() * 2) + scrubber_size()) if (!has_scrubber() || length(orientation()) <= (button_size() * 2) + visible_scrubber_size())
return {}; return {};
float x_or_y; float x_or_y;
if (m_value == m_min) if (m_value == m_min)
x_or_y = button_size(); x_or_y = button_size();
else if (m_value == m_max) else if (m_value == m_max)
x_or_y = (length(orientation()) - button_size() - scrubber_size()) + 1; x_or_y = (length(orientation()) - button_size() - visible_scrubber_size()) + 1;
else { else {
float range_size = m_max - m_min; float range_size = m_max - m_min;
float available = scrubbable_range_in_pixels(); float available = scrubbable_range_in_pixels();
@ -220,9 +220,9 @@ Gfx::IntRect ScrollBar::scrubber_rect() const
} }
if (orientation() == Orientation::Vertical) if (orientation() == Orientation::Vertical)
return { 0, (int)x_or_y, button_width(), scrubber_size() }; return { 0, (int)x_or_y, button_width(), visible_scrubber_size() };
else else
return { (int)x_or_y, 0, scrubber_size(), button_height() }; return { (int)x_or_y, 0, visible_scrubber_size(), button_height() };
} }
void ScrollBar::paint_event(PaintEvent& event) void ScrollBar::paint_event(PaintEvent& event)

View file

@ -87,7 +87,7 @@ private:
Gfx::IntRect decrement_gutter_rect() const; Gfx::IntRect decrement_gutter_rect() const;
Gfx::IntRect increment_gutter_rect() const; Gfx::IntRect increment_gutter_rect() const;
Gfx::IntRect scrubber_rect() const; Gfx::IntRect scrubber_rect() const;
int scrubber_size() const; int visible_scrubber_size() const;
int scrubbable_range_in_pixels() const; int scrubbable_range_in_pixels() const;
void on_automatic_scrolling_timer_fired(); void on_automatic_scrolling_timer_fired();
void set_automatic_scrolling_active(bool); void set_automatic_scrolling_active(bool);