mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:27:44 +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
|
@ -147,7 +147,7 @@ public:
|
|||
virtual bool accepts_focus() const { return false; }
|
||||
|
||||
bool is_focused() const;
|
||||
void set_focus(bool);
|
||||
void set_focus(bool, FocusSource = FocusSource::Programmatic);
|
||||
|
||||
enum class ShouldRespectGreediness { No = 0,
|
||||
Yes };
|
||||
|
@ -287,8 +287,8 @@ protected:
|
|||
virtual void mousewheel_event(MouseEvent&);
|
||||
virtual void doubleclick_event(MouseEvent&);
|
||||
virtual void context_menu_event(ContextMenuEvent&);
|
||||
virtual void focusin_event(Core::Event&);
|
||||
virtual void focusout_event(Core::Event&);
|
||||
virtual void focusin_event(FocusEvent&);
|
||||
virtual void focusout_event(FocusEvent&);
|
||||
virtual void enter_event(Core::Event&);
|
||||
virtual void leave_event(Core::Event&);
|
||||
virtual void child_event(Core::ChildEvent&) override;
|
||||
|
@ -310,8 +310,8 @@ private:
|
|||
void handle_mouseup_event(MouseEvent&);
|
||||
void handle_enter_event(Core::Event&);
|
||||
void handle_leave_event(Core::Event&);
|
||||
void focus_previous_widget();
|
||||
void focus_next_widget();
|
||||
void focus_previous_widget(FocusSource);
|
||||
void focus_next_widget(FocusSource);
|
||||
|
||||
Window* m_window { nullptr };
|
||||
RefPtr<Layout> m_layout;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue