BsEditorCommand.h 1010 B

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