LibGUI: Change gradient colors when ValueSlider is disabled

Make it more obivous when ValueSlider is disabled by changing the
gradient colors.
This commit is contained in:
Marcus Nilsson 2022-01-09 21:35:58 +01:00 committed by Andreas Kling
parent 5e20c45174
commit bcf764cecf

View file

@ -81,7 +81,11 @@ void ValueSlider::paint_event(PaintEvent& event)
GUI::Painter painter(*this);
painter.add_clip_rect(event.rect());
painter.fill_rect_with_gradient(m_orientation, bar_rect(), palette().active_window_border1(), palette().active_window_border2());
if (is_enabled())
painter.fill_rect_with_gradient(m_orientation, bar_rect(), palette().active_window_border1(), palette().active_window_border2());
else
painter.fill_rect_with_gradient(m_orientation, bar_rect(), palette().inactive_window_border1(), palette().inactive_window_border2());
auto unfilled_rect = bar_rect();
unfilled_rect.set_left(knob_rect().right());
painter.fill_rect(unfilled_rect, palette().base());