mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +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:
parent
d47e431d54
commit
92fffc3abc
Notes:
sideshowbarker
2024-07-18 03:33:54 +09:00
Author: https://github.com/thankyouverycool
Commit: 92fffc3abc
Pull-request: https://github.com/SerenityOS/serenity/pull/10175
15 changed files with 40 additions and 39 deletions
|
@ -39,7 +39,7 @@ TextDocument::~TextDocument()
|
|||
{
|
||||
}
|
||||
|
||||
bool TextDocument::set_text(const StringView& text)
|
||||
bool TextDocument::set_text(const StringView& text, AllowCallback allow_callback)
|
||||
{
|
||||
m_client_notifications_enabled = false;
|
||||
m_undo_stack.clear();
|
||||
|
@ -90,7 +90,7 @@ bool TextDocument::set_text(const StringView& text)
|
|||
m_client_notifications_enabled = true;
|
||||
|
||||
for (auto* client : m_clients)
|
||||
client->document_did_set_text();
|
||||
client->document_did_set_text(allow_callback);
|
||||
|
||||
clear_text_guard.disarm();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue