From 0cafbbf09c303a51a48b67ef951fa828979cde6e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 3 Mar 2020 21:42:08 +0100 Subject: [PATCH] LibGUI: Save some more state from AbstractButton The more stuff we save in save_to() overrides, the more interesting it becomes inspecting GUI programs. :^) --- Libraries/LibGUI/AbstractButton.cpp | 10 ++++++++++ Libraries/LibGUI/AbstractButton.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Libraries/LibGUI/AbstractButton.cpp b/Libraries/LibGUI/AbstractButton.cpp index 2c02b7d9fe..dfab44529f 100644 --- a/Libraries/LibGUI/AbstractButton.cpp +++ b/Libraries/LibGUI/AbstractButton.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -196,4 +197,13 @@ void AbstractButton::change_event(Event& event) Widget::change_event(event); } +void AbstractButton::save_to(JsonObject& json) +{ + json.set("text", m_text); + json.set("checked", m_checked); + json.set("checkable", m_checkable); + json.set("exclusive", m_exclusive); + Widget::save_to(json); +} + } diff --git a/Libraries/LibGUI/AbstractButton.h b/Libraries/LibGUI/AbstractButton.h index 09780b6f8d..3b833a08ec 100644 --- a/Libraries/LibGUI/AbstractButton.h +++ b/Libraries/LibGUI/AbstractButton.h @@ -70,6 +70,8 @@ protected: virtual void leave_event(Core::Event&) override; virtual void change_event(Event&) override; + virtual void save_to(JsonObject&) override; + void paint_text(Painter&, const Gfx::Rect&, const Gfx::Font&, Gfx::TextAlignment); private: