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

UndoC Class Reference

Undo object class. More...

#include <UndoC.h>

List of all members.

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


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.

virtual ~UndoC   [virtual]
 

Default desctructor.


Member Function Documentation

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

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

virtual bool can_redo   [virtual]
 

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

virtual const char* get_name   [virtual]
 

Returns the name of the action.

virtual void redo   [virtual]
 

Redoes the undo object (used internally).

virtual void undo   [virtual]
 

Undoes the undo object (used internally).


Moppi Demopaja SDK Documentation -- Copyright © 2000-2002 Moppi Productions