summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Widget.h
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-11-17 11:15:34 -0500
committerAndreas Kling <kling@serenityos.org>2022-11-19 16:04:42 +0100
commit3b18226fcb6be003704cc007b9d9573d4f2f1f35 (patch)
tree2261ee6f47b1a84288864eeea77e727075b9ad13 /Userland/Libraries/LibGUI/Widget.h
parent4aa608aa717fdf35e0f7bf91077b79147d3f0253 (diff)
downloadserenity-3b18226fcb6be003704cc007b9d9573d4f2f1f35.zip
LibGUI: Let Widgets track their focus proxy delegators
And update them on relevant events.
Diffstat (limited to 'Userland/Libraries/LibGUI/Widget.h')
-rw-r--r--Userland/Libraries/LibGUI/Widget.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h
index 677b6edef4..1a7f901729 100644
--- a/Userland/Libraries/LibGUI/Widget.h
+++ b/Userland/Libraries/LibGUI/Widget.h
@@ -226,6 +226,9 @@ public:
Widget const* focus_proxy() const { return m_focus_proxy; }
void set_focus_proxy(Widget*);
+ Vector<WeakPtr<Widget>>& focus_delegators() { return m_focus_delegators; }
+ Vector<WeakPtr<Widget>> const& focus_delegators() const { return m_focus_delegators; }
+
void set_focus_policy(FocusPolicy policy);
FocusPolicy focus_policy() const;
@@ -406,6 +409,9 @@ protected:
void show_or_hide_tooltip();
+ void add_focus_delegator(Widget*);
+ void remove_focus_delegator(Widget*);
+
private:
virtual bool is_widget() const final { return true; }
@@ -453,6 +459,7 @@ private:
String m_title { String::empty() };
WeakPtr<Widget> m_focus_proxy;
+ Vector<WeakPtr<Widget>> m_focus_delegators;
FocusPolicy m_focus_policy { FocusPolicy::NoFocus };
AK::Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> m_override_cursor { Gfx::StandardCursor::None };