[an error occurred while processing this directive]
Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

CommandHistory Class Reference

A history for Command, provides undo/redo functionality. More...

#include <CommandHistory.h>

Inheritance diagram for CommandHistory:

Inheritance graph
List of all members.

Public Member Functions

 CommandHistory ()
virtual ~CommandHistory ()
void clear ()
 Erases all the undo/redo history.
void addCommand (Command *command, bool execute=true)
 Adds a command to the history.
virtual void undo ()
 Undoes the last action.
virtual void redo ()
 Redoes the last undone action.

Detailed Description

A history for Command, provides undo/redo functionality.

To use this, all modifications to the model have to be done through commands that are executed with addCommand();

Constructor & Destructor Documentation

CommandHistory::CommandHistory  ) 


CommandHistory::~CommandHistory  )  [virtual]


Member Function Documentation

void CommandHistory::addCommand Command command,
bool  execute = true

Adds a command to the history.

Call this for each command you create. Unless you set execute to false, this will also execute the command. This means, most of the application's code will look like

    MyCommand * cmd = new MyCommand(...);
    m_historyCommand.addCommand( cmd );

Ownership of command is transfered to CommandHistory

void CommandHistory::clear  ) 

Erases all the undo/redo history.

Use this when reloading the data, for instance, since this invalidates all the commands.

void CommandHistory::redo  )  [virtual]

Redoes the last undone action.

void CommandHistory::undo  )  [virtual]

Undoes the last action.

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

Generated on Mon Sep 20 01:01:33 2010 for Hugintrunk by doxygen