#include <ACT_ActionStack.h>
Public Methods | |
ACT_ActionStack (unsigned int maxStackDepth=1) | |
Constructs an action stack. More... | |
~ACT_ActionStack () | |
Destructs an action stack. | |
virtual unsigned int | getStackDepth ()const |
Returns the current depth of the stack. More... | |
virtual unsigned int | getMaxStackDepth ()const |
Returns the current maximum depth of the stack. More... | |
virtual void | setMaxStackDepth (unsigned int maxStackDepth) |
Sets new maximum depth of the stack. More... | |
virtual void | push (ACT_Action &action) |
Pushes an action on the stack. More... | |
virtual ACT_Action* | peekUndo () |
Returns pointer to the current undo item. More... | |
virtual ACT_Action* | peekRedo () |
Returns pointer to the current redo item. More... | |
virtual void | flush () |
Flushes the action stack. More... | |
virtual bool | canUndo ()const |
Returns whether we can undo the current action. More... | |
virtual void | undo () |
Undos the current action. More... | |
virtual bool | canRedo ()const |
Returns whether we can redo the current action. More... | |
virtual void | redo () |
Redos the current action. More... | |
Protected Methods | |
virtual unsigned int | popBack (unsigned int numActions=1) |
Removes numItem actions from the back of the stack. More... | |
virtual unsigned int | popFront (unsigned int numActions=1) |
Removes numItem actions from the front of the stack. More... | |
virtual bool | getUndoIndex (unsigned int &index)const |
Returns the index of the current undo action. More... | |
virtual bool | getRedoIndex (unsigned int &index)const |
Returns the index of the current redo action. More... | |
Protected Attributes | |
unsigned int | m_maxStackDepth |
The maximum depth of this stack. | |
unsigned int | m_undoIndex |
The index of the current undo action in the stack. | |
bool | m_undoIndexValid |
Is the index of the current undo action in the stack valid. | |
unsigned int | m_redoIndex |
The index of the current redo action in the stack. | |
bool | m_redoIndexValid |
Is the index of the current redo action in the stack valid. | |
deque<ACT_Action*> | m_stack |
The stack with actions. |
A stack can grow to a maximum number of actions by pushing actions on the stack. By calling undo and redo the apply and undo members of the actions on the stack are called. In addition, this will move the stackIndex up and down the stack. When a new action is pushed onto the stack, the actions above the current action are removed from the stack. Actions pushed onto the stack are applied if they are not applied already.
|
Constructs an action stack.
|
|
Returns whether we can redo the current action.
|
|
Returns whether we can undo the current action.
|
|
Flushes the action stack. All actions are removed from the stack and their reference counts decreased. |
|
Returns the current maximum depth of the stack.
|
|
Returns the index of the current redo action.
|
|
Returns the current depth of the stack.
|
|
Returns the index of the current undo action.
|
|
Returns pointer to the current redo item.
|
|
Returns pointer to the current undo item.
|
|
Removes numItem actions from the back of the stack.
|
|
Removes numItem actions from the front of the stack.
|
|
Pushes an action on the stack. If the action has not been applied yet, it will be applied here. This will increase the reference count of the action. If there is not enough capacity, the action at the bottom of the stack is removed (and its reference count decreased).
|
|
Redos the current action. This will move the action index up (if the stack depth allows it). |
|
Sets new maximum depth of the stack.
|
|
Undos the current action. This will move the current undo index down (if the stack depth allows it). |