BsEditorCommand.h 807 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. namespace BansheeEngine
  4. {
  5. /**
  6. * @brief A command used for undo/redo purposes. It records a change occurring on
  7. * some object and allows you to apply or revert that change as needed.
  8. */
  9. class BS_ED_EXPORT EditorCommand
  10. {
  11. public:
  12. EditorCommand(const WString& description);
  13. virtual ~EditorCommand() { }
  14. /**
  15. * @brief Applies the command, committing the change.
  16. */
  17. virtual void commit() { }
  18. /**
  19. * @brief Reverts the command, reverting the change previously
  20. * done with "commit".
  21. */
  22. virtual void revert() { }
  23. /**
  24. * @brief Deletes the command.
  25. */
  26. static void destroy(EditorCommand* command);
  27. private:
  28. friend class UndoRedo;
  29. WString mDescription;
  30. UINT32 mId;
  31. };
  32. }