mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +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
15 changed files with 40 additions and 39 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue