Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXCommand Class Reference

#include <FXUndoList.h>

Inheritance diagram for FX::FXCommand:
FX::FXObject FX::FXCommandGroup FX::FXUndoList

List of all members.

Public Member Functions

virtual void undo ()=0
virtual void redo ()=0
virtual FXuint size () const
virtual FXString undoName () const
virtual FXString redoName () const
virtual bool canMerge () const
virtual bool mergeWith (FXCommand *command)
virtual ~FXCommand ()

Friends

class FXUndoList
class FXCommandGroup

Detailed Description

Base class for undoable commands.

Each undo records all the information necessary to undo as well as redo a given operation. Since commands are derived from FXObject, subclassed commands can both send and receive messages (like ID_GETINTVALUE, for example).


Constructor & Destructor Documentation

virtual FX::FXCommand::~FXCommand ( ) [inline, virtual]

Delete undo command.


Member Function Documentation

virtual void FX::FXCommand::undo ( ) [pure virtual]

Undo this command; this should save the information for a subsequent redo.

Implemented in FX::FXUndoList, and FX::FXCommandGroup.

virtual void FX::FXCommand::redo ( ) [pure virtual]

Redo this command; this should save the information for a subsequent undo.

Implemented in FX::FXUndoList, and FX::FXCommandGroup.

virtual FXuint FX::FXCommand::size ( ) const [virtual]

Return the size of the information in the undo record.

The undo list may be trimmed to limit memory usage to a certain limit. The value returned should include the size of the command record itself as well as any data linked from it.

Reimplemented in FX::FXUndoList, and FX::FXCommandGroup.

virtual FXString FX::FXCommand::undoName ( ) const [virtual]

Name of the undo command to be shown on a button; for example, "Undo Delete".

Reimplemented in FX::FXUndoList.

virtual FXString FX::FXCommand::redoName ( ) const [virtual]

Name of the redo command to be shown on a button; for example, "Redo Delete".

Reimplemented in FX::FXUndoList.

virtual bool FX::FXCommand::canMerge ( ) const [virtual]

Return TRUE if this command can be merged with previous undo commands.

This is useful to combine e.g. multiple consecutive single-character text changes into a single block change. The default implementation returns FALSE.

virtual bool FX::FXCommand::mergeWith ( FXCommand command) [virtual]

Called by the undo system to try and merge the new incoming command with this command; should return TRUE if merging was possible.

The default implementation returns FALSE.


Friends And Related Function Documentation

friend class FXUndoList [friend]

Reimplemented in FX::FXCommandGroup.

friend class FXCommandGroup [friend]

Copyright © 1997-2005 Jeroen van der Zijp