mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibGUI: Rename CallOnChange => AllowCallback and implement elsewhere
This is a helpful option to prevent unwanted side effects, distinguish between user and programmatic input, etc. Sliders and SpinBoxes were implementing it idiosyncratically, so let's generalize the API and give Buttons and TextEditors the same ability.
This commit is contained in:
committed by
Andreas Kling
parent
d47e431d54
commit
92fffc3abc
@@ -53,7 +53,7 @@ void AbstractSlider::set_range(int min, int max)
|
||||
update();
|
||||
}
|
||||
|
||||
void AbstractSlider::set_value(int value, CallOnChange call_on_change)
|
||||
void AbstractSlider::set_value(int value, AllowCallback allow_callback)
|
||||
{
|
||||
value = clamp(value, m_min, m_max);
|
||||
if (m_value == value)
|
||||
@@ -61,7 +61,7 @@ void AbstractSlider::set_value(int value, CallOnChange call_on_change)
|
||||
m_value = value;
|
||||
update();
|
||||
|
||||
if (on_change && call_on_change == CallOnChange::Yes)
|
||||
if (on_change && allow_callback == AllowCallback::Yes)
|
||||
on_change(m_value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user