1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibGUI: Paint Scrollbar buttons with appropriate thread highlighting

Similar to increment/decrement buttons on SpinBoxes, Scrollbar
buttons now draw with the correct highlights after reaching their
min or max.
This commit is contained in:
thankyouverycool 2023-04-02 13:26:18 -04:00 committed by Andreas Kling
parent 82c06f58af
commit b79b70f197
Notes: sideshowbarker 2024-07-17 03:51:15 +09:00

View file

@ -209,14 +209,14 @@ void Scrollbar::paint_event(PaintEvent& event)
auto decrement_location = decrement_button_rect().location().translated(3, 3);
if (decrement_pressed)
decrement_location.translate_by(1, 1);
if (!has_scrubber() || !is_enabled())
if (!has_scrubber() || !is_enabled() || is_min())
painter.draw_triangle(decrement_location + Gfx::IntPoint { 1, 1 }, orientation() == Orientation::Vertical ? s_up_arrow_coords : s_left_arrow_coords, palette().threed_highlight());
painter.draw_triangle(decrement_location, orientation() == Orientation::Vertical ? s_up_arrow_coords : s_left_arrow_coords, (has_scrubber() && is_enabled() && !is_min()) ? palette().button_text() : palette().threed_shadow1());
auto increment_location = increment_button_rect().location().translated(3, 3);
if (increment_pressed)
increment_location.translate_by(1, 1);
if (!has_scrubber() || !is_enabled())
if (!has_scrubber() || !is_enabled() || is_max())
painter.draw_triangle(increment_location + Gfx::IntPoint { 1, 1 }, orientation() == Orientation::Vertical ? s_down_arrow_coords : s_right_arrow_coords, palette().threed_highlight());
painter.draw_triangle(increment_location, orientation() == Orientation::Vertical ? s_down_arrow_coords : s_right_arrow_coords, (has_scrubber() && is_enabled() && !is_max()) ? palette().button_text() : palette().threed_shadow1());
}