/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Tools/Libs/ToolsFoundation/Command/Command.h
55 строк
2 KB
Jan Krassnigg
#303: Editing temporary properties don't set documents to modified anymore
18 авг 2020, 19:33
18 авг 2020, 19:33
6c0abff
Код
Авторство
О чём код?
#pragma once #include <Foundation/Reflection/Reflection.h> #include <Foundation/Types/Status.h> #include <ToolsFoundation/ToolsFoundationDLL.h> class ezDocument; class ezCommandTransaction; /// \brief Interface for a command /// /// Commands are the only objects that have non-const access to any data structures (contexts, documents etc.). /// Thus, any modification must go through a command and the ezCommandHistory is the only class capable of executing commands. class EZ_TOOLSFOUNDATION_DLL ezCommand : public ezReflectedClass { EZ_ADD_DYNAMIC_REFLECTION(ezCommand, ezReflectedClass); public: ezCommand(); ~ezCommand(); bool IsUndoable() const { return m_bUndoable; }; bool HasChildActions() const { return !m_ChildActions.IsEmpty(); } bool HasModifiedDocument() const; enum class CommandState { WasDone, WasUndone }; protected: ezStatus Do(bool bRedo); ezStatus Undo(bool bFireEvents); void Cleanup(CommandState state); ezStatus AddSubCommand(ezCommand& command); ezDocument* GetDocument() { return m_pDocument; }; private: virtual bool HasReturnValues() const { return false; } virtual ezStatus DoInternal(bool bRedo) = 0; virtual ezStatus UndoInternal(bool bFireEvents) = 0; virtual void CleanupInternal(CommandState state) = 0; protected: friend class ezCommandHistory; friend class ezCommandTransaction; ezString m_sDescription; bool m_bUndoable = true; bool m_bModifiedDocument = true; ezHybridArray<ezCommand*, 8> m_ChildActions; ezDocument* m_pDocument = nullptr; };