mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 16:15:10 +00:00
LibGUI: Make focus events more aware of why focus is changing
This patch adds GUI::FocusEvent which has a GUI::FocusSource. The focus source is one of three things: - Programmatic - Mouse - Keyboard This allows receivers of focus events to implement different behaviors depending on how they receive/lose focus.
This commit is contained in:
parent
110b3d89d3
commit
75b8f4e4e6
14 changed files with 94 additions and 41 deletions
|
@ -65,7 +65,7 @@ const EditorWrapper& Editor::wrapper() const
|
|||
return static_cast<const EditorWrapper&>(*parent());
|
||||
}
|
||||
|
||||
void Editor::focusin_event(Core::Event& event)
|
||||
void Editor::focusin_event(GUI::FocusEvent& event)
|
||||
{
|
||||
wrapper().set_editor_has_focus({}, true);
|
||||
if (on_focus)
|
||||
|
@ -73,7 +73,7 @@ void Editor::focusin_event(Core::Event& event)
|
|||
GUI::TextEditor::focusin_event(event);
|
||||
}
|
||||
|
||||
void Editor::focusout_event(Core::Event& event)
|
||||
void Editor::focusout_event(GUI::FocusEvent& event)
|
||||
{
|
||||
wrapper().set_editor_has_focus({}, false);
|
||||
GUI::TextEditor::focusout_event(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue