From de4d85b0976cb5d7684e5250c5c1f896fa8b3dbc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 22 Jun 2019 10:39:13 +0200 Subject: [PATCH] GButton: Make it possible to disable focusability. --- LibGUI/GButton.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/LibGUI/GButton.h b/LibGUI/GButton.h index ecb93aa024..c3e1b0c1ff 100644 --- a/LibGUI/GButton.h +++ b/LibGUI/GButton.h @@ -32,8 +32,10 @@ public: void set_action(GAction&); virtual const char* class_name() const override { return "GButton"; } - virtual bool accepts_focus() const override { return true; } - virtual bool supports_keyboard_activation() const; + virtual bool accepts_focus() const override { return m_focusable; } + virtual bool supports_keyboard_activation() const override; + + void set_focusable(bool b) { m_focusable = b; } protected: virtual void paint_event(GPaintEvent&) override; @@ -43,4 +45,5 @@ private: ButtonStyle m_button_style { ButtonStyle::Normal }; TextAlignment m_text_alignment { TextAlignment::Center }; WeakPtr m_action; + bool m_focusable { true }; };