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

FX::FXUndoList Class Reference

The Undo List class manages a list of undoable commands. More...

#include <FXUndoList.h>

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

List of all members.

Public Types

enum  {
  ID_CLEAR = FXWindow::ID_LAST, ID_REVERT, ID_UNDO, ID_REDO,
  ID_UNDO_ALL, ID_REDO_ALL, ID_UNDO_COUNT, ID_REDO_COUNT,
  ID_LAST
}

Public Member Functions

long onCmdUndo (FXObject *, FXSelector, void *)
long onUpdUndo (FXObject *, FXSelector, void *)
long onCmdRedo (FXObject *, FXSelector, void *)
long onUpdRedo (FXObject *, FXSelector, void *)
long onCmdClear (FXObject *, FXSelector, void *)
long onUpdClear (FXObject *, FXSelector, void *)
long onCmdRevert (FXObject *, FXSelector, void *)
long onUpdRevert (FXObject *, FXSelector, void *)
long onCmdUndoAll (FXObject *, FXSelector, void *)
long onCmdRedoAll (FXObject *, FXSelector, void *)
long onUpdUndoCount (FXObject *, FXSelector, void *)
long onUpdRedoCount (FXObject *, FXSelector, void *)
 FXUndoList ()
 Make new empty undo list, initially unmarked.
void cut ()
 Cut the redo list.
void add (FXCommand *command, FXbool doit=false, FXbool merge=true)
 Add new command, executing it if desired.
void begin (FXCommandGroup *command)
 Begin undo command sub-group.
void end ()
 End undo command sub-group.
void abort ()
 Abort the current command sub-group being compiled.
virtual void undo ()
 Undo last command.
virtual void redo ()
 Redo next command.
void undoAll ()
 Undo all commands.
void redoAll ()
 Redo all commands.
void revert ()
 Revert to marked.
FXbool canUndo () const
 Can we undo more commands.
FXbool canRedo () const
 Can we redo more commands.
FXbool canRevert () const
 Can revert to marked.
FXbool busy () const
 Return true if currently inside undo or redo operation; this is useful to avoid generating another undo command while inside an undo operation.
FXCommandcurrent () const
 Current top level undo command.
virtual FXString undoName () const
 Return name of the first undo command available; if no undo command available this will return the empty string.
virtual FXString redoName () const
 Return name of the first redo command available; if no Redo command available this will return the empty string.
FXint undoCount () const
 Number of undo records.
FXint redoCount () const
 Number of redo records.
virtual FXuint size () const
 Size of undo information.
void clear ()
 Clear list, and unmark all states.
void trimCount (FXint nc)
 Trim undo list down to at most nc commands.
void trimSize (FXuint sz)
 Trim undo list down to at most size sz.
void mark ()
 Mark the current state of the undo list, which is initially unmarked.
void unmark ()
 Unmark all states in the undo list.
FXbool marked () const
 Check if the current state was marked, if the application has returned to the previously marked state.
- Public Member Functions inherited from FX::FXCommandGroup
 FXCommandGroup ()
 Construct initially empty undo command group.
FXbool empty ()
 Return true if empty.
virtual ~FXCommandGroup ()
 Delete undo command and sub-commands.
- Public Member Functions inherited from FX::FXCommand
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.

Detailed Description

The Undo List class manages a list of undoable commands.


Member Function Documentation

void FX::FXUndoList::abort ( )

Abort the current command sub-group being compiled.

All commands already added to the sub-groups undo list will be discarded. Intermediate command groups will be left intact.

void FX::FXUndoList::add ( FXCommand command,
FXbool  doit = false,
FXbool  merge = true 
)

Add new command, executing it if desired.

The new command will be merged with the previous command if merge is true and we're not at a marked position and the commands are mergeable. Otherwise the new command will be appended after the last undo command in the currently active undo group. If the new command is successfully merged, it will be deleted. Furthermore, all redo commands will be deleted since it is no longer possible to redo from this point.

void FX::FXUndoList::begin ( FXCommandGroup command)

Begin undo command sub-group.

This begins a new group of commands that are treated as a single command. Must eventually be followed by a matching end() after recording the sub-commands. The new sub-group will be appended to its parent group's undo list when end() is called.

void FX::FXUndoList::clear ( )

Clear list, and unmark all states.

All undo and redo information will be destroyed.

void FX::FXUndoList::cut ( )

Cut the redo list.

This is automatically invoked when a new undo command is added.

void FX::FXUndoList::end ( )

End undo command sub-group.

If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.

void FX::FXUndoList::mark ( )

Mark the current state of the undo list, which is initially unmarked.

There can be only one active mark at any time. Call mark() at any time when you know the document to be "clean"; for example when you save the document to disk.

virtual void FX::FXUndoList::redo ( )
virtual

Redo next command.

This will move the command back to the undo list.

Reimplemented from FX::FXCommandGroup.

void FX::FXUndoList::trimCount ( FXint  nc)

Trim undo list down to at most nc commands.

Call this periodically to prevent the undo-list from growing beyond a certain number of records.

void FX::FXUndoList::trimSize ( FXuint  sz)

Trim undo list down to at most size sz.

Call this periodically to prevent the undo-list from growing beyond a certain amount of memory.

virtual void FX::FXUndoList::undo ( )
virtual

Undo last command.

This will move the command to the redo list.

Reimplemented from FX::FXCommandGroup.


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

Copyright © 1997-2016 Jeroen van der Zijp