mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
LibGUI: Add option to disable on_change call for sliders set_value()
This makes it possible to avoid messy situations where a slider controlled value can be changed from multiple sources.
This commit is contained in:
parent
5a91f5b320
commit
3c8493c667
5 changed files with 12 additions and 6 deletions
|
@ -53,7 +53,7 @@ void AbstractSlider::set_range(int min, int max)
|
|||
update();
|
||||
}
|
||||
|
||||
void AbstractSlider::set_value(int value)
|
||||
void AbstractSlider::set_value(int value, CallOnChange call_on_change)
|
||||
{
|
||||
value = clamp(value, m_min, m_max);
|
||||
if (m_value == value)
|
||||
|
@ -61,7 +61,7 @@ void AbstractSlider::set_value(int value)
|
|||
m_value = value;
|
||||
update();
|
||||
|
||||
if (on_change)
|
||||
if (on_change && call_on_change == CallOnChange::Yes)
|
||||
on_change(m_value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue