Main Page Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members Related Pages

# Edit::UndoC Class Reference

Undo object class. More...

`#include <UndoC.h>`

List of all members.

## Public Methods

- UndoC ( const char* szName )
- virtual ~UndoC ()
- virtual void undo ()
- virtual void redo ()
- virtual void add_restore_data ( EditableI* pBlock )
- virtual void add_discardable_data ( DataBlockI* pBlock, PajaTypes::uint32 ui32Flags )
- virtual const char* get_name ()
- virtual bool can_redo ()

## Detailed Description

Undo object class.

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.

## Constructor & Destructor Documentation

UndoC ( | const char * szName )

| Default constructor. Creates new undo object and gives it name spcified by the argument.

~UndoC ( | )`[virtual]`

| Default desctructor.

## Member Function Documentation

void add_discardable_data ( | DataBlockI * pBlock,
| PajaTypes::uint32 ui32Flags )`[virtual]`

| 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.

void add_restore_data ( | EditableI * pBlock )`[virtual]`

| 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.
                ...

bool can_redo ( | )`[virtual]`

| Returns true if redo can be done (the condition is that undo is called).

const char * get_name ( | )`[virtual]`

| Returns the name of the action.

void redo ( | )`[virtual]`

| Redoes the undo object (used internally).

void undo ( | )`[virtual]`

| Undoes the undo object (used internally).

The documentation for this class was generated from the following file:

- UndoC.h