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

FX::FXCommand Class Reference

Base class for undoable commands. More...

#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
 Undo this command; this should save the information for a subsequent redo.
virtual void redo ()=0
 Redo this command; this should save the information for a subsequent undo.
virtual FXuint size () const
 Return the size of the information in the undo record.
virtual FXString undoName () const
 Name of the undo command to be shown on a button; for example, "Undo Delete".
virtual FXString redoName () const
 Name of the redo command to be shown on a button; for example, "Redo Delete".
virtual FXbool canMerge () const
 Return true if this command can be merged with previous undo commands.
virtual FXbool mergeWith (FXCommand *command)
 Called by the undo system to try and merge the new incoming command with this command; should return true if merging was possible.
virtual ~FXCommand ()
 Delete undo command.
- Public Member Functions inherited from FX::FXObject
const FXchar * getClassName () const
 Get class name of some object.
FXbool isMemberOf (const FXMetaClass *metaclass) const
 Check if object is member of metaclass.
virtual long tryHandle (FXObject *sender, FXSelector sel, void *ptr)
 Try handle message safely, catching certain exceptions.
virtual long onDefault (FXObject *, FXSelector, void *)
 Called for unhandled messages.
virtual void save (FXStream &store) const
 Save object to stream.
virtual void load (FXStream &store)
 Load object from stream.
virtual ~FXObject ()
 Virtual destructor.

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).


Member Function Documentation

virtual FXbool 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 FXbool 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.

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.


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

Copyright © 1997-2016 Jeroen van der Zijp