MeVisLabToolboxReference
ml::CSOUndoRedoManager Class Reference

Manager class for maintaining the undo and the redo stacks. More...

#include <CSOUndoRedoManager.h>

List of all members.

Public Types

enum  UNDO_MODE { MODE_UNDOING = 0, MODE_REDOING = 1, MODE_NORMAL = 2 }
 The undo (and redo) modes. More...

Public Member Functions

 CSOUndoRedoManager (CSOList *csoList)
 Constructor.
 ~CSOUndoRedoManager ()
 Destructor.
void addCommand (CSOCommand *command)
 Adds a command (modification).
void popUndoCommand ()
 Removes the last added undo command without executing it.
void undo ()
 Performs an undo of the last modification (if undo stack is not empty).
void redo ()
 Performs a redo (if the undo stack is not empty).
void openGroup ()
 Opens a group of commands that are undone/redone as one.
void closeGroup ()
 Closes a group of commands that are undone/redone as one.
void clearUndo ()
 Clears the undo stack.
void clearRedo ()
 Clears the redo stack.
void clearAll ()
 Clears the undo and redo stack.
void pushUndoCommand (CSOCommand *command)
 Pushes a command onto the undo stack.
void pushRedoCommand (CSOCommand *command)
 Pushes a command onto the redo stack.
bool canUndo () const
 Returns whether there are possible undoes.
bool canRedo () const
 Returns whether there are possible redoes.
int maxNumUndos () const
 Returns the maximum number of possible undos. If a -1 is returned, the undo stack has no limitation.
void setMaxNumUndos (int maxNumUndos)
 Sets the maximum number of possible undos. If a -1 is passed, the undo stack has no limitation.
int numUndos () const
 Returns the number of stored undo steps.
int numRedos () const
 Returns the number of stored redo steps.
bool isInUndoMode () const
 Returns whether the manager is in undo-mode.
bool isInRedoMode () const
 Returns whether the manager is in redo-mode.
void enableUndoRedo ()
 Enables this undo/redo manager.
void disableUndoRedo ()
 Disables this undo/redo manager; if it is disabled, the incoming commands are deleted and not added.
bool isEnabled ()
 Returns whether this undo/redo manager is currently enabled.

Detailed Description

Manager class for maintaining the undo and the redo stacks.

Definition at line 24 of file CSOUndoRedoManager.h.


Member Enumeration Documentation

The undo (and redo) modes.

Enumerator:
MODE_UNDOING 

The manager is in undo-mode.

MODE_REDOING 

The manager is in redo-mode.

MODE_NORMAL 

The manager is no special mode and pushes commands onto the undo stack.

Definition at line 30 of file CSOUndoRedoManager.h.


Constructor & Destructor Documentation

ml::CSOUndoRedoManager::CSOUndoRedoManager ( CSOList csoList)

Constructor.

ml::CSOUndoRedoManager::~CSOUndoRedoManager ( )

Destructor.


Member Function Documentation

void ml::CSOUndoRedoManager::addCommand ( CSOCommand command)

Adds a command (modification).

The inverse command is added to the undo stack while the command itself is added to the redo stack.

bool ml::CSOUndoRedoManager::canRedo ( ) const

Returns whether there are possible redoes.

bool ml::CSOUndoRedoManager::canUndo ( ) const

Returns whether there are possible undoes.

void ml::CSOUndoRedoManager::clearAll ( )

Clears the undo and redo stack.

void ml::CSOUndoRedoManager::clearRedo ( )

Clears the redo stack.

void ml::CSOUndoRedoManager::clearUndo ( )

Clears the undo stack.

void ml::CSOUndoRedoManager::closeGroup ( )

Closes a group of commands that are undone/redone as one.

void ml::CSOUndoRedoManager::disableUndoRedo ( ) [inline]

Disables this undo/redo manager; if it is disabled, the incoming commands are deleted and not added.

Definition at line 101 of file CSOUndoRedoManager.h.

void ml::CSOUndoRedoManager::enableUndoRedo ( ) [inline]

Enables this undo/redo manager.

Definition at line 98 of file CSOUndoRedoManager.h.

bool ml::CSOUndoRedoManager::isEnabled ( ) [inline]

Returns whether this undo/redo manager is currently enabled.

Definition at line 104 of file CSOUndoRedoManager.h.

bool ml::CSOUndoRedoManager::isInRedoMode ( ) const

Returns whether the manager is in redo-mode.

bool ml::CSOUndoRedoManager::isInUndoMode ( ) const

Returns whether the manager is in undo-mode.

int ml::CSOUndoRedoManager::maxNumUndos ( ) const [inline]

Returns the maximum number of possible undos. If a -1 is returned, the undo stack has no limitation.

Definition at line 82 of file CSOUndoRedoManager.h.

int ml::CSOUndoRedoManager::numRedos ( ) const

Returns the number of stored redo steps.

int ml::CSOUndoRedoManager::numUndos ( ) const

Returns the number of stored undo steps.

void ml::CSOUndoRedoManager::openGroup ( )

Opens a group of commands that are undone/redone as one.

void ml::CSOUndoRedoManager::popUndoCommand ( )

Removes the last added undo command without executing it.

This could be useful if you temporarily want to save a state of a CSOList in your C++ code.

void ml::CSOUndoRedoManager::pushRedoCommand ( CSOCommand command)

Pushes a command onto the redo stack.

void ml::CSOUndoRedoManager::pushUndoCommand ( CSOCommand command)

Pushes a command onto the undo stack.

void ml::CSOUndoRedoManager::redo ( )

Performs a redo (if the undo stack is not empty).

void ml::CSOUndoRedoManager::setMaxNumUndos ( int  maxNumUndos)

Sets the maximum number of possible undos. If a -1 is passed, the undo stack has no limitation.

void ml::CSOUndoRedoManager::undo ( )

Performs an undo of the last modification (if undo stack is not empty).


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