mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibGUI: Add focus hooks to TextEditor
This commit is contained in:
parent
fd64be02e0
commit
c35493c156
2 changed files with 6 additions and 0 deletions
|
@ -1152,11 +1152,15 @@ void TextEditor::focusin_event(Core::Event&)
|
||||||
m_cursor_state = true;
|
m_cursor_state = true;
|
||||||
update_cursor();
|
update_cursor();
|
||||||
start_timer(500);
|
start_timer(500);
|
||||||
|
if (on_focusin)
|
||||||
|
on_focusin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditor::focusout_event(Core::Event&)
|
void TextEditor::focusout_event(Core::Event&)
|
||||||
{
|
{
|
||||||
stop_timer();
|
stop_timer();
|
||||||
|
if (on_focusout)
|
||||||
|
on_focusout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditor::timer_event(Core::TimerEvent&)
|
void TextEditor::timer_event(Core::TimerEvent&)
|
||||||
|
|
|
@ -94,6 +94,8 @@ public:
|
||||||
|
|
||||||
Function<void()> on_cursor_change;
|
Function<void()> on_cursor_change;
|
||||||
Function<void()> on_selection_change;
|
Function<void()> on_selection_change;
|
||||||
|
Function<void()> on_focusin;
|
||||||
|
Function<void()> on_focusout;
|
||||||
|
|
||||||
void set_text(const StringView&);
|
void set_text(const StringView&);
|
||||||
void scroll_cursor_into_view();
|
void scroll_cursor_into_view();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue