2
0

BsEditorCommand.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /**
  8. * @brief A command used for undo/redo purposes. It records a change occurring on
  9. * some object and allows you to apply or revert that change as needed.
  10. */
  11. class BS_ED_EXPORT EditorCommand
  12. {
  13. public:
  14. EditorCommand(const WString& description);
  15. virtual ~EditorCommand() { }
  16. /**
  17. * @brief Applies the command, committing the change.
  18. */
  19. virtual void commit() { }
  20. /**
  21. * @brief Reverts the command, reverting the change previously
  22. * done with "commit".
  23. */
  24. virtual void revert() { }
  25. /**
  26. * @brief Deletes the command.
  27. */
  28. static void destroy(EditorCommand* command);
  29. private:
  30. friend class UndoRedo;
  31. WString mDescription;
  32. UINT32 mId;
  33. };
  34. }