mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-23 16:14:23 +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
@@ -44,7 +44,7 @@ void AbstractButton::set_text(String text)
|
||||
update();
|
||||
}
|
||||
|
||||
void AbstractButton::set_checked(bool checked)
|
||||
void AbstractButton::set_checked(bool checked, AllowCallback allow_callback)
|
||||
{
|
||||
if (m_checked == checked)
|
||||
return;
|
||||
@@ -71,7 +71,7 @@ void AbstractButton::set_checked(bool checked)
|
||||
}
|
||||
|
||||
update();
|
||||
if (on_checked)
|
||||
if (on_checked && allow_callback == AllowCallback::Yes)
|
||||
on_checked(checked);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user