UndoManager Class Reference

#include <undo.h>

Inheritance diagram for UndoManager:

Inheritance graph
[legend]
List of all members.

Public Types

typedef SimObject Parent

Public Member Functions

 DECLARE_CONOBJECT (UndoManager)
 UndoManager (U32 levels=kDefaultNumLevels)
 Constructor. If levels = 0, we use the default number of undo levels.
 ~UndoManager ()
 Destructor. deletes and clears the undo & redo stacks.
void undo ()
 Undo last action, and put it on the redo stack.
void redo ()
 Redo the last action, and put it on the undo stack.
void clearAll ()
 Clears the undo and redo stacks.
StringTableEntry getNextUndoName ()
 Returns the printable name of the top actions on the undo & redo stacks.
StringTableEntry getNextRedoName ()
S32 getUndoCount ()
S32 getRedoCount ()
StringTableEntry getUndoName (S32 index)
StringTableEntry getRedoName (S32 index)
void addAction (UndoAction *action)
 Add an action to the top of the undo stack, and clear the redo stack.
void removeAction (UndoAction *action)

Static Public Member Functions

static void initPersistFields ()
 Register dynamic fields in a subclass of ConsoleObject.
static UndoManagergetDefaultManager ()
 Accessor to the default undo manager singleton. Creates one if needed.

Public Attributes

U32 mNumLevels
 Number of undo & redo levels.

Private Member Functions

void clearStack (Vector< UndoAction * > &stack)
 Deletes all the UndoActions in a stack, then clears it.
void clampStack (Vector< UndoAction * > &stack)
 Clamps a Vector to mNumLevels entries.

Private Attributes

Vector< UndoAction * > mUndoStack
 The stacks of undo & redo actions. They will be capped at size mNumLevels.
Vector< UndoAction * > mRedoStack

Static Private Attributes

static const U32 kDefaultNumLevels = 100
 Default number of undo & redo levels.

Member Typedef Documentation

Reimplemented from SimObject.


Constructor & Destructor Documentation

UndoManager::UndoManager ( U32  levels = kDefaultNumLevels  ) 

Constructor. If levels = 0, we use the default number of undo levels.

UndoManager::~UndoManager (  ) 

Destructor. deletes and clears the undo & redo stacks.


Member Function Documentation

void UndoManager::clearStack ( Vector< UndoAction * > &  stack  )  [private]

Deletes all the UndoActions in a stack, then clears it.

void UndoManager::clampStack ( Vector< UndoAction * > &  stack  )  [private]

Clamps a Vector to mNumLevels entries.

UndoManager::DECLARE_CONOBJECT ( UndoManager   ) 

static void UndoManager::initPersistFields (  )  [static]

Register dynamic fields in a subclass of ConsoleObject.

See also:
addField(), addFieldV(), addDeprecatedField(), addGroup(), endGroup()

Reimplemented from SimObject.

static UndoManager& UndoManager::getDefaultManager (  )  [static]

Accessor to the default undo manager singleton. Creates one if needed.

void UndoManager::undo (  ) 

Undo last action, and put it on the redo stack.

void UndoManager::redo (  ) 

Redo the last action, and put it on the undo stack.

void UndoManager::clearAll (  ) 

Clears the undo and redo stacks.

StringTableEntry UndoManager::getNextUndoName (  ) 

Returns the printable name of the top actions on the undo & redo stacks.

StringTableEntry UndoManager::getNextRedoName (  ) 

S32 UndoManager::getUndoCount (  ) 

S32 UndoManager::getRedoCount (  ) 

StringTableEntry UndoManager::getUndoName ( S32  index  ) 

StringTableEntry UndoManager::getRedoName ( S32  index  ) 

void UndoManager::addAction ( UndoAction action  ) 

Add an action to the top of the undo stack, and clear the redo stack.

void UndoManager::removeAction ( UndoAction action  ) 


Member Data Documentation

const U32 UndoManager::kDefaultNumLevels = 100 [static, private]

Default number of undo & redo levels.

The stacks of undo & redo actions. They will be capped at size mNumLevels.

Number of undo & redo levels.