[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

AppBase::CommandHistory< CommandClass > Class Template Reference

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

#include <CommandHistory.h>

List of all members.

Public Member Functions

 CommandHistory ()
 ctor.
virtual ~CommandHistory ()
 dtor.
void clear ()
 Erases all the undo/redo history.
void addCommand (CommandClass *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.
virtual bool canUndo ()
virtual bool canRedo ()


Detailed Description

template<class CommandClass = Command<std::string>>
class AppBase::CommandHistory< CommandClass >

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

template<class CommandClass = Command<std::string>>
AppBase::CommandHistory< CommandClass >::CommandHistory  )  [inline]
 

ctor.

template<class CommandClass = Command<std::string>>
virtual AppBase::CommandHistory< CommandClass >::~CommandHistory  )  [inline, virtual]
 

dtor.


Member Function Documentation

template<class CommandClass = Command<std::string>>
void AppBase::CommandHistory< CommandClass >::addCommand CommandClass *  command,
bool  execute = true
[inline]
 

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

template<class CommandClass = Command<std::string>>
virtual bool AppBase::CommandHistory< CommandClass >::canRedo  )  [inline, virtual]
 

template<class CommandClass = Command<std::string>>
virtual bool AppBase::CommandHistory< CommandClass >::canUndo  )  [inline, virtual]
 

template<class CommandClass = Command<std::string>>
void AppBase::CommandHistory< CommandClass >::clear  )  [inline]
 

Erases all the undo/redo history.

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

template<class CommandClass = Command<std::string>>
virtual void AppBase::CommandHistory< CommandClass >::redo  )  [inline, virtual]
 

Redoes the last undone action.

template<class CommandClass = Command<std::string>>
virtual void AppBase::CommandHistory< CommandClass >::undo  )  [inline, virtual]
 

Undoes the last action.


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

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