Command.h 541 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. namespace GUI {
  9. class Command {
  10. public:
  11. virtual ~Command();
  12. virtual void undo() { }
  13. virtual void redo() { }
  14. String action_text() const { return m_action_text; }
  15. virtual bool merge_with(Command const&) { return false; }
  16. protected:
  17. Command() { }
  18. void set_action_text(const String& text) { m_action_text = text; }
  19. private:
  20. String m_action_text;
  21. };
  22. }