Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Command Class Reference

A Command represents an interface describing a single action, that is potentially undoable. More...

#include <vcf/ApplicationKit/Command.h>

Inheritance diagram for VCF::Command:

VCF::AbstractCommand VCF::CommandGroup List of all members.

Public Member Functions

virtual ~Command ()
virtual void undo ()=0
 Undo the command.
virtual void redo ()=0
 redo the command.
virtual void execute ()=0
 execute the command.
virtual UndoRedoStackgetOwningStack ()=0
 returns the UndoRedoStack that owns this command.
virtual void setOwningStack (UndoRedoStack *stack)=0
 sets the owning UndoRedoStack for this command
virtual String getName ()=0
 The name of this command.
virtual void setName (const String &name)=0
 sets the name of this command
virtual bool isUndoable ()=0
 Is this command undoable ?

Detailed Description

A Command represents an interface describing a single action, that is potentially undoable.

Commands are placed on the application wide UndoRedoStack object during the course of the application. Each command should represent a single user action like, typing text, or removing an item from a tree. The actual implementation will vary widely and will need whatever state variables are neccessary to both execute/redo the command, and undo the command.


Constructor & Destructor Documentation

virtual VCF::Command::~Command  )  [inline, virtual]
 


Member Function Documentation

virtual void VCF::Command::execute  )  [pure virtual]
 

execute the command.

Usually called by the UndoRedoStack after the command has been added to it.

Implemented in VCF::CommandGroup.

virtual String VCF::Command::getName  )  [pure virtual]
 

The name of this command.

Frequently the name is the basis for the display text that is shown in the "Edit | Undo" or "Edit | Redo" menu items.

Returns:
String the name of this command

Implemented in VCF::AbstractCommand.

virtual UndoRedoStack* VCF::Command::getOwningStack  )  [pure virtual]
 

returns the UndoRedoStack that owns this command.

Returns:
UndoRedoStack a pointer to the current UndoRedoStack instance for this command object.

Implemented in VCF::AbstractCommand.

virtual bool VCF::Command::isUndoable  )  [pure virtual]
 

Is this command undoable ?

Returns:
bool true if the command's undo()/redo() methods can be safely called, otherwise false. Commands that return false for this method are usually not added to the UndoRedoStack though they will be executed.

Implemented in VCF::AbstractCommand.

virtual void VCF::Command::redo  )  [pure virtual]
 

redo the command.

Generally the same, or similar, code as performed in the execute() method

Implemented in VCF::CommandGroup.

virtual void VCF::Command::setName const String name  )  [pure virtual]
 

sets the name of this command

Implemented in VCF::AbstractCommand.

virtual void VCF::Command::setOwningStack UndoRedoStack stack  )  [pure virtual]
 

sets the owning UndoRedoStack for this command

Parameters:
UndoRedoStack the UndoRedoStack that will own this command

Implemented in VCF::AbstractCommand.

virtual void VCF::Command::undo  )  [pure virtual]
 

Undo the command.

Implemented in VCF::CommandGroup.


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information