From 5b68a76c7792e58188f9834c67c7464c4052207b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 1 May 2021 18:50:01 +0200 Subject: LibGUI: Track modified state in GUI::TextDocument Until now, this has been hackishly tracked by the TextEditor app's main widget. Let's do it in GUI::TextDocument instead, so that anyone who uses this class can know whether it's modified or not. --- Userland/Libraries/LibGUI/TextDocument.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Userland/Libraries/LibGUI/TextDocument.h') diff --git a/Userland/Libraries/LibGUI/TextDocument.h b/Userland/Libraries/LibGUI/TextDocument.h index bd711685d7..d73f505799 100644 --- a/Userland/Libraries/LibGUI/TextDocument.h +++ b/Userland/Libraries/LibGUI/TextDocument.h @@ -122,6 +122,8 @@ public: virtual bool is_code_document() const { return false; } bool is_empty() const; + bool is_modified() const { return m_modified; } + void set_modified(bool); protected: explicit TextDocument(Client* client); @@ -134,6 +136,7 @@ private: HashTable m_clients; bool m_client_notifications_enabled { true }; + bool m_modified { false }; UndoStack m_undo_stack; RefPtr m_undo_timer; -- cgit v1.2.3