00001 // -*- c-basic-offset: 4 -*- 00024 #ifndef _COMMANDHISTORY_H 00025 #define _COMMANDHISTORY_H 00026 00027 #include <appbase/Command.h> 00028 00034 class CommandHistory 00035 { 00036 public: 00037 00040 CommandHistory(); 00041 00044 virtual ~CommandHistory(); 00045 00051 void clear(); 00052 00064 void addCommand(Command *command, bool execute=true); 00065 00069 virtual void undo(); 00073 virtual void redo(); 00074 00076 bool canUndo(); 00077 00079 bool canRedo(); 00080 private: 00081 // our commands 00082 std::vector<Command*> commands; 00083 size_t nextCmd; 00084 00085 }; 00086 00087 00093 class GlobalCmdHist : public CommandHistory 00094 { 00095 public: 00096 static GlobalCmdHist & getInstance(); 00097 protected: 00098 GlobalCmdHist(); 00099 private: 00100 static GlobalCmdHist * instance; 00101 }; 00102 00103 #endif // _COMMANDHISTORY_H
1.3.9.1