Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::UndoRedoStack Class Reference

stack class managing any undo redo operation. More...

#include <vcf/ApplicationKit/UndoRedoStack.h>

Inheritance diagram for VCF::UndoRedoStack:

VCF::ObjectWithEvents VCF::Object List of all members.

Public Member Functions

 UndoRedoStack ()
virtual ~UndoRedoStack ()
virtual void undo ()
 undoes the last command.
virtual void redo ()
 redoes the last command ( undoes the previous undo ).
virtual bool hasUndoableItems ()
 tells if there is any undo item in the stack.
virtual bool hasRedoableItems ()
 tells if there is any redo item in the stack.
virtual void addCommand (Command *command, const bool &autoExecute=true)
 adds a command to the undo stack and clears the redo stack.
virtual CommandgetCurrentUndoCommand ()
 gets the first command to undo.
virtual CommandgetCurrentRedoCommand ()
 gets the first command to redo.
void clearCommands ()
 clears both the undo/redo stacks.

Public Attributes

VCF::Delegate UndoCommand
 Used if the user desires to bypass the default behaviour of this UndoRedoStack instance.
VCF::Delegate RedoCommand
 Used if the user desires to bypass the default action of this UndoRedoStack instance.
VCF::Delegate StackCleared
 to be notified that the stack is going to be be cleared.
VCF::Delegate StackChanged
 to be notified that the stack has been changed.
VCF::Delegate ExecuteCommand
 to be notified that a command has been executed.

Protected Member Functions

void movetToRedoStack (Command *command)
 Unused.

Protected Attributes

std::deque< Command * > undoStack_
 the undo and redo internal stacks.
std::deque< Command * > redoStack_

Detailed Description

stack class managing any undo redo operation.

It is possible to bypass the default undo redo behaviour of this class, without deriving form this class, through the use of its UndoCommand and RedoCommand delegates.


Constructor & Destructor Documentation

VCF::UndoRedoStack::UndoRedoStack  ) 
 

virtual VCF::UndoRedoStack::~UndoRedoStack  )  [virtual]
 


Member Function Documentation

virtual void VCF::UndoRedoStack::addCommand Command command,
const bool &  autoExecute = true
[virtual]
 

adds a command to the undo stack and clears the redo stack.

By default this also executes the command.

Parameters:
Command* command, the instance representing the action which is potentially undoable. bool& autoExecute, true if the operation needs also to be executed. This is the default.
fire event:: ExecuteCommand, only if autoExecute==true, after the command has been executed.
event class: UndoRedoEvent
event type: UNDOREDO_EVENT_EXECUTE.
fire event:: StackChanged, after the command has been added.
event class: UndoRedoEvent
event type: UNDOREDO_EVENT_STACK_CHANGED.

void VCF::UndoRedoStack::clearCommands  ) 
 

clears both the undo/redo stacks.


fire event:: StackChanged, event before the stack is cleared.
event class: UndoRedoEvent
event type: UNDOREDO_EVENT_STACK_CHANGED.

virtual Command* VCF::UndoRedoStack::getCurrentRedoCommand  )  [virtual]
 

gets the first command to redo.

virtual Command* VCF::UndoRedoStack::getCurrentUndoCommand  )  [virtual]
 

gets the first command to undo.

virtual bool VCF::UndoRedoStack::hasRedoableItems  )  [virtual]
 

tells if there is any redo item in the stack.

virtual bool VCF::UndoRedoStack::hasUndoableItems  )  [virtual]
 

tells if there is any undo item in the stack.

void VCF::UndoRedoStack::movetToRedoStack Command command  )  [protected]
 

Unused.

MP ?

virtual void VCF::UndoRedoStack::redo  )  [virtual]
 

redoes the last command ( undoes the previous undo ).

this default behaviour can be bypassed.
fire event:: UndoCommand, before the default redo action is performed.
event class: UndoRedoEvent
event type: UNDOREDO_EVENT_REDO

virtual void VCF::UndoRedoStack::undo  )  [virtual]
 

undoes the last command.

this default behaviour can be bypassed.
fire event:: UndoCommand, before the default undo action is performed.
event class: UndoRedoEvent
event type: UNDOREDO_EVENT_UNDO


Member Data Documentation

VCF::Delegate VCF::UndoRedoStack::ExecuteCommand
 

to be notified that a command has been executed.

This is called after the command has been added to the undo stack, and after the command has been executed

VCF::Delegate VCF::UndoRedoStack::RedoCommand
 

Used if the user desires to bypass the default action of this UndoRedoStack instance.

In this case the user needs to add an event handler to this delegate, and setAllowsRedo(false) inside this handler.

std::deque<Command*> VCF::UndoRedoStack::redoStack_ [protected]
 

VCF::Delegate VCF::UndoRedoStack::StackChanged
 

to be notified that the stack has been changed.

This is called afterward.

VCF::Delegate VCF::UndoRedoStack::StackCleared
 

to be notified that the stack is going to be be cleared.

This is called foreward.

VCF::Delegate VCF::UndoRedoStack::UndoCommand
 

Used if the user desires to bypass the default behaviour of this UndoRedoStack instance.

In this case the user needs to add an event handler to this delegate, and setAllowsUndo(false) inside this handler.

std::deque<Command*> VCF::UndoRedoStack::undoStack_ [protected]
 

the undo and redo internal stacks.


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information