diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2021-09-21 17:02:48 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-22 21:35:42 +0200 |
commit | 92fffc3abc50dfd6a7cf6788984f712cece0b7d8 (patch) | |
tree | 2ae0356cb4ee078bdba20c47b846d0c40c45a6c2 /Userland/Libraries/LibGUI/TextEditor.h | |
parent | d47e431d54b4facd77703f8efd3b68e2eedc4835 (diff) | |
download | serenity-92fffc3abc50dfd6a7cf6788984f712cece0b7d8.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibGUI/TextEditor.h')
-rw-r--r-- | Userland/Libraries/LibGUI/TextEditor.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h index a0ea51005e..c291e38c49 100644 --- a/Userland/Libraries/LibGUI/TextEditor.h +++ b/Userland/Libraries/LibGUI/TextEditor.h @@ -108,7 +108,7 @@ public: Function<void()> on_focusin; Function<void()> on_focusout; - void set_text(StringView const&); + void set_text(StringView const&, AllowCallback = AllowCallback::Yes); void scroll_cursor_into_view(); void scroll_position_into_view(TextPosition const&); size_t line_count() const { return document().line_count(); } @@ -195,7 +195,7 @@ public: TextRange* selection() { return &m_selection; }; void did_update_selection(); - void did_change(); + void did_change(AllowCallback = AllowCallback::Yes); void update_cursor(); void add_code_point(u32 code_point); @@ -248,8 +248,8 @@ private: virtual void document_did_insert_line(size_t) override; virtual void document_did_remove_line(size_t) override; virtual void document_did_remove_all_lines() override; - virtual void document_did_change() override; - virtual void document_did_set_text() override; + virtual void document_did_change(AllowCallback = AllowCallback::Yes) override; + virtual void document_did_set_text(AllowCallback = AllowCallback::Yes) override; virtual void document_did_set_cursor(TextPosition const&) override; virtual void document_did_update_undo_stack() override; |