diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-07-04 22:37:55 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-01 08:39:26 +0200 |
commit | c35493c1564222e0019ff8a69bc01aea9f650692 (patch) | |
tree | 8865841fe0dbe1f232726b0a1b933066d79d187c /Libraries/LibGUI | |
parent | fd64be02e0774ec10e823de15886b8a946545877 (diff) | |
download | serenity-c35493c1564222e0019ff8a69bc01aea9f650692.zip |
LibGUI: Add focus hooks to TextEditor
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r-- | Libraries/LibGUI/TextEditor.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/TextEditor.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp index cdf05d3e88..4fbd98d632 100644 --- a/Libraries/LibGUI/TextEditor.cpp +++ b/Libraries/LibGUI/TextEditor.cpp @@ -1152,11 +1152,15 @@ void TextEditor::focusin_event(Core::Event&) m_cursor_state = true; update_cursor(); start_timer(500); + if (on_focusin) + on_focusin(); } void TextEditor::focusout_event(Core::Event&) { stop_timer(); + if (on_focusout) + on_focusout(); } void TextEditor::timer_event(Core::TimerEvent&) diff --git a/Libraries/LibGUI/TextEditor.h b/Libraries/LibGUI/TextEditor.h index 97dc70e02c..86390ada75 100644 --- a/Libraries/LibGUI/TextEditor.h +++ b/Libraries/LibGUI/TextEditor.h @@ -94,6 +94,8 @@ public: Function<void()> on_cursor_change; Function<void()> on_selection_change; + Function<void()> on_focusin; + Function<void()> on_focusout; void set_text(const StringView&); void scroll_cursor_into_view(); |