mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
LibGUI: Allow widgets to make themselves non-auto-focusable
This patchs adds a way for widgets exclude themselves from being a focus candidate in Window::focus_a_widget_if_possible(). This is to allow the URL box to not get auto-focused when the browser is loaded.
This commit is contained in:
parent
6f19bf8501
commit
fbf824a50f
2 changed files with 6 additions and 0 deletions
|
@ -114,6 +114,9 @@ public:
|
||||||
String tooltip() const { return m_tooltip; }
|
String tooltip() const { return m_tooltip; }
|
||||||
void set_tooltip(String);
|
void set_tooltip(String);
|
||||||
|
|
||||||
|
bool is_auto_focusable() const { return m_auto_focusable; }
|
||||||
|
void set_auto_focusable(bool auto_focusable) { m_auto_focusable = auto_focusable; }
|
||||||
|
|
||||||
bool is_enabled() const { return m_enabled; }
|
bool is_enabled() const { return m_enabled; }
|
||||||
void set_enabled(bool);
|
void set_enabled(bool);
|
||||||
|
|
||||||
|
@ -357,6 +360,7 @@ private:
|
||||||
bool m_fill_with_background_color { false };
|
bool m_fill_with_background_color { false };
|
||||||
bool m_visible { true };
|
bool m_visible { true };
|
||||||
bool m_greedy_for_hits { false };
|
bool m_greedy_for_hits { false };
|
||||||
|
bool m_auto_focusable { true };
|
||||||
bool m_enabled { true };
|
bool m_enabled { true };
|
||||||
bool m_updates_enabled { true };
|
bool m_updates_enabled { true };
|
||||||
bool m_accepts_emoji_input { false };
|
bool m_accepts_emoji_input { false };
|
||||||
|
|
|
@ -947,6 +947,8 @@ Vector<Widget&> Window::focusable_widgets(FocusSource source) const
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
if (!child.is_enabled())
|
if (!child.is_enabled())
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
|
if (!child.is_auto_focusable())
|
||||||
|
return IterationDecision::Continue;
|
||||||
collect_focusable_widgets(child);
|
collect_focusable_widgets(child);
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue