00001 00006 00007 #ifndef _H_ACT_ACTIONSTACK 00008 #define _H_ACT_ACTIONSTACK 00009 00010 #include "ACT_Action.h" 00011 #include <deque> 00012 00013 00025 00026 class ACT_ActionStack { 00027 public: 00031 ACT_ActionStack(unsigned int maxStackDepth = 1); 00032 00036 ~ACT_ActionStack(); 00037 00042 virtual unsigned int getStackDepth() const; 00043 00048 virtual unsigned int getMaxStackDepth() const; 00049 00054 virtual void setMaxStackDepth(unsigned int maxStackDepth); 00055 00063 virtual void push(ACT_Action& action); 00064 00069 virtual ACT_Action* peekUndo(); 00070 00075 virtual ACT_Action* peekRedo(); 00076 00081 virtual void flush(); 00082 00087 virtual bool canUndo() const; 00088 00093 virtual void undo(); 00094 00099 virtual bool canRedo() const; 00100 00105 virtual void redo(); 00106 00107 protected: 00113 virtual unsigned int popBack(unsigned int numActions = 1); 00114 00120 virtual unsigned int popFront(unsigned int numActions = 1); 00121 00127 virtual bool getUndoIndex(unsigned int& index) const; 00128 00134 virtual bool getRedoIndex(unsigned int& index) const; 00135 00137 unsigned int m_maxStackDepth; 00139 unsigned int m_undoIndex; 00141 bool m_undoIndexValid; 00143 unsigned int m_redoIndex; 00145 bool m_redoIndexValid; 00147 deque<ACT_Action*> m_stack; 00148 }; 00149 00150 00151 #endif // _H_ACT_ACTIONSTACK