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

 FXUndoList ()
void cut ()
void add (FXCommand *command, bool doit=false, bool merge=true)
void begin (FXCommandGroup *command)
void end ()
void abort ()
virtual void undo ()
virtual void redo ()
void undoAll ()
void redoAll ()
void revert ()
bool canUndo () const
bool canRedo () const
bool canRevert () const
bool busy () const
FXCommandcurrent () const
virtual FXString undoName () const
virtual FXString redoName () const
FXint undoCount () const
FXint redoCount () const
virtual FXuint size () const
void clear ()
void trimCount (FXint nc)
void trimSize (FXuint sz)
void mark ()
void unmark ()
bool marked () const

Detailed Description

The Undo List class manages a list of undoable commands.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
ID_CLEAR 
ID_REVERT 
ID_UNDO 
ID_REDO 
ID_UNDO_ALL 
ID_REDO_ALL 
ID_UNDO_COUNT 
ID_REDO_COUNT 
ID_LAST 


Constructor & Destructor Documentation

FX::FXUndoList::FXUndoList  ) 
 

Make new empty undo list, initially unmarked.


Member Function Documentation

void FX::FXUndoList::cut  ) 
 

Cut the redo list.

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

void FX::FXUndoList::add FXCommand command,
bool  doit = false,
bool  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::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::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.

virtual void FX::FXUndoList::undo  )  [virtual]
 

Undo last command.

This will move the command to the redo list.

Reimplemented from FX::FXCommandGroup.

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::undoAll  ) 
 

Undo all commands.

void FX::FXUndoList::redoAll  ) 
 

Redo all commands.

void FX::FXUndoList::revert  ) 
 

Revert to marked.

bool FX::FXUndoList::canUndo  )  const
 

Can we undo more commands.

bool FX::FXUndoList::canRedo  )  const
 

Can we redo more commands.

bool FX::FXUndoList::canRevert  )  const
 

Can revert to marked.

bool FX::FXUndoList::busy  )  const [inline]
 

Return TRUE if currently inside undo or redo operation; this is useful to avoid generating another undo command while inside an undo operation.

FXCommand* FX::FXUndoList::current  )  const [inline]
 

Current top level undo command.

virtual FXString FX::FXUndoList::undoName  )  const [virtual]
 

Return name of the first undo command available; if no undo command available this will return the empty string.

Reimplemented from FX::FXCommand.

virtual FXString FX::FXUndoList::redoName  )  const [virtual]
 

Return name of the first redo command available; if no Redo command available this will return the empty string.

Reimplemented from FX::FXCommand.

FXint FX::FXUndoList::undoCount  )  const [inline]
 

Number of undo records.

FXint FX::FXUndoList::redoCount  )  const [inline]
 

Number of redo records.

virtual FXuint FX::FXUndoList::size  )  const [virtual]
 

Size of undo information.

Reimplemented from FX::FXCommandGroup.

void FX::FXUndoList::clear  ) 
 

Clear list, and unmark all states.

All undo and redo information will be destroyed.

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.

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.

void FX::FXUndoList::unmark  ) 
 

Unmark all states in the undo list.

bool FX::FXUndoList::marked  )  const
 

Check if the current state was marked, if the application has returned to the previously marked state.

Copyright © 1997-2005 Jeroen van der Zijp