#include <UndoC.h>
Public Methods | |
UndoC (const char *szName) | |
Default constructor. | |
virtual | ~UndoC () |
Default desctructor. | |
virtual void | undo () |
Undoes the undo object (used internally). | |
virtual void | redo () |
Redoes the undo object (used internally). | |
virtual void | add_restore_data (EditableI *pBlock) |
Adds restore data to the undo object. | |
virtual void | add_discardable_data (DataBlockI *pBlock, PajaTypes::uint32 ui32Flags) |
Adds discardable data to the undo object. | |
virtual const char * | get_name () |
Returns the name of the action. | |
virtual bool | can_redo () |
Returns true if redo can be done (the condition is that undo is called). |
Undo object class is used internally by the Demopaja system to hold the original data modified by the action the undo object relates. For example if the editor executes a move command all the position parameters of the selected objects are push into the undo object. Later if the commands the application do undo, the data stored in the undo object is copied to the original place.
When the undo object is pushed out of the undo stack, the discardable data and the copies of the original date are finally deleted.
This class is implemented by the system.
|
Default constructor. Creates new undo object and gives it name spcified by the argument. |
|
Default desctructor.
|
|
Adds discardable data to the undo object. The flags indicades whether the action was to remove or create new data. For example if you create new block of data and an undo object is available you should push the new data block, so that it can be deleted when the create action is undone. |
|
Adds restore data to the undo object. Adds cloned editable to the undo object which is later used to restore the original state of the editable. The data has to be created with the clone() method of the editable! Otherwise the pointer to the original data won't be available nad no data will be restored. Example usage: ...
pUndo->add_restore_data( clone() ); // push clone of editbale into the undo object.
...
|
|
Returns true if redo can be done (the condition is that undo is called).
|
|
Returns the name of the action.
|
|
Redoes the undo object (used internally).
|
|
Undoes the undo object (used internally).
|