1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:27:42 +00:00

LibGUI: In ScrollBar, rename AutomaticScrollingDirection to AutomaticScrollingKind

Also rename Decrement to DecrementButton and Increment to
IncrementButton.
This commit is contained in:
Nico Weber 2020-08-25 08:30:40 -04:00 committed by Andreas Kling
parent c34956839e
commit 129816e056
2 changed files with 13 additions and 13 deletions

View file

@ -237,8 +237,8 @@ void ScrollBar::paint_event(PaintEvent& event)
painter.fill_rect_with_dither_pattern(rect(), palette().button().lightened(1.3f), palette().button()); painter.fill_rect_with_dither_pattern(rect(), palette().button().lightened(1.3f), palette().button());
bool decrement_pressed = m_automatic_scrolling_direction == AutomaticScrollingDirection::Decrement; bool decrement_pressed = m_automatic_scrolling_kind == AutomaticScrollingKind::DecrementButton;
bool increment_pressed = m_automatic_scrolling_direction == AutomaticScrollingDirection::Increment; bool increment_pressed = m_automatic_scrolling_kind == AutomaticScrollingKind::IncrementButton;
Gfx::StylePainter::paint_button(painter, decrement_button_rect(), palette(), Gfx::ButtonStyle::Normal, decrement_pressed, m_hovered_component == Component::DecrementButton); Gfx::StylePainter::paint_button(painter, decrement_button_rect(), palette(), Gfx::ButtonStyle::Normal, decrement_pressed, m_hovered_component == Component::DecrementButton);
Gfx::StylePainter::paint_button(painter, increment_button_rect(), palette(), Gfx::ButtonStyle::Normal, increment_pressed, m_hovered_component == Component::IncrementButton); Gfx::StylePainter::paint_button(painter, increment_button_rect(), palette(), Gfx::ButtonStyle::Normal, increment_pressed, m_hovered_component == Component::IncrementButton);
@ -261,11 +261,11 @@ void ScrollBar::paint_event(PaintEvent& event)
void ScrollBar::on_automatic_scrolling_timer_fired() void ScrollBar::on_automatic_scrolling_timer_fired()
{ {
if (m_automatic_scrolling_direction == AutomaticScrollingDirection::Decrement) { if (m_automatic_scrolling_kind == AutomaticScrollingKind::DecrementButton) {
set_value(value() - m_step); set_value(value() - m_step);
return; return;
} }
if (m_automatic_scrolling_direction == AutomaticScrollingDirection::Increment) { if (m_automatic_scrolling_kind == AutomaticScrollingKind::IncrementButton) {
set_value(value() + m_step); set_value(value() + m_step);
return; return;
} }
@ -279,13 +279,13 @@ void ScrollBar::mousedown_event(MouseEvent& event)
return; return;
if (decrement_button_rect().contains(event.position())) { if (decrement_button_rect().contains(event.position())) {
m_automatic_scrolling_direction = AutomaticScrollingDirection::Decrement; m_automatic_scrolling_kind = AutomaticScrollingKind::DecrementButton;
set_automatic_scrolling_active(true); set_automatic_scrolling_active(true);
update(); update();
return; return;
} }
if (increment_button_rect().contains(event.position())) { if (increment_button_rect().contains(event.position())) {
m_automatic_scrolling_direction = AutomaticScrollingDirection::Increment; m_automatic_scrolling_kind = AutomaticScrollingKind::IncrementButton;
set_automatic_scrolling_active(true); set_automatic_scrolling_active(true);
update(); update();
return; return;
@ -312,7 +312,7 @@ void ScrollBar::mouseup_event(MouseEvent& event)
if (event.button() != MouseButton::Left) if (event.button() != MouseButton::Left)
return; return;
m_scrubber_in_use = false; m_scrubber_in_use = false;
m_automatic_scrolling_direction = AutomaticScrollingDirection::None; m_automatic_scrolling_kind = AutomaticScrollingKind::None;
set_automatic_scrolling_active(false); set_automatic_scrolling_active(false);
m_scrubbing = false; m_scrubbing = false;
update(); update();
@ -375,9 +375,9 @@ void ScrollBar::mousemove_event(MouseEvent& event)
if (old_hovered_component != m_hovered_component) { if (old_hovered_component != m_hovered_component) {
update(); update();
if (m_automatic_scrolling_direction == AutomaticScrollingDirection::Decrement) if (m_automatic_scrolling_kind == AutomaticScrollingKind::DecrementButton)
set_automatic_scrolling_active(m_hovered_component == Component::DecrementButton); set_automatic_scrolling_active(m_hovered_component == Component::DecrementButton);
else if (m_automatic_scrolling_direction == AutomaticScrollingDirection::Increment) else if (m_automatic_scrolling_kind == AutomaticScrollingKind::IncrementButton)
set_automatic_scrolling_active(m_hovered_component == Component::IncrementButton); set_automatic_scrolling_active(m_hovered_component == Component::IncrementButton);
} }
if (!m_scrubbing) if (!m_scrubbing)

View file

@ -111,13 +111,13 @@ private:
Component m_hovered_component { Component::Invalid }; Component m_hovered_component { Component::Invalid };
bool m_scrubber_in_use { false }; bool m_scrubber_in_use { false };
enum class AutomaticScrollingDirection { enum class AutomaticScrollingKind {
None = 0, None = 0,
Decrement, DecrementButton,
Increment, IncrementButton,
}; };
AutomaticScrollingDirection m_automatic_scrolling_direction { AutomaticScrollingDirection::None }; AutomaticScrollingKind m_automatic_scrolling_kind { AutomaticScrollingKind::None };
RefPtr<Core::Timer> m_automatic_scrolling_timer; RefPtr<Core::Timer> m_automatic_scrolling_timer;
}; };