LibGUI: Allow bypassing hook when setting SpinBox range

Pass false to set_range to avoid on_change side-effects.
This commit is contained in:
thankyouverycool 2021-04-22 13:29:22 -04:00 committed by Andreas Kling
commit 99e7ad4b76
Notes: sideshowbarker 2024-07-18 19:12:57 +09:00
2 changed files with 3 additions and 3 deletions

View file

@ -63,7 +63,7 @@ void SpinBox::set_value(int value)
on_change(value);
}
void SpinBox::set_range(int min, int max)
void SpinBox::set_range(int min, int max, bool change)
{
VERIFY(min <= max);
if (m_min == min && m_max == max)
@ -76,7 +76,7 @@ void SpinBox::set_range(int min, int max)
m_value = clamp(m_value, m_min, m_max);
if (m_value != old_value) {
m_editor->set_text(String::number(m_value));
if (on_change)
if (change && on_change)
on_change(m_value);
}