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

FX::FXCommandGroup Class Reference

Group of undoable commands. More...

#include <FXUndoList.h>

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

Public Member Functions

 FXCommandGroup ()
 Construct initially empty undo command group.
 
FXbool empty ()
 Return true if empty.
 
virtual void undo ()
 Undo whole command group.
 
virtual void redo ()
 Redo whole command group.
 
virtual FXuval size () const
 Return the size of the command group.
 
virtual void clear ()
 Clear list.
 
virtual ~FXCommandGroup ()
 Delete undo command and sub-commands.
 
- Public Member Functions inherited from FX::FXCommand
FXival nrefs () const
 
void ref ()
 
void unref ()
 
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 could possibly be merged with a previous undo command. More...
 
virtual FXuint mergeWith (FXCommand *command)
 Called by the undo system to try and merge the new incoming command with this command. More...
 
- 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
 

Detailed Description

Group of undoable commands.

Complicated manipulations may sometimes be more effectively implemented as a combination of multiple sub-commands. The CommandGroup implements this concept by invoking each the sub-commands undo() and redo() in the proper order. For example, a network editing program may decompose a "Delete Node" operation into a number of connection changes followed by a unconnected node removal operation. Note that some sub-commands may themselves be also CommandGroup items. You start a new CommandGroup by creating an instance of CommandGroup cg and calling undolist.begin(ch), and end it by calling undolist.end(). In between, additional CommandGroup items may be created as well, keeping in mind that the inner CommandGroup must be closed with undolist.end() before adding to the outer CommandGroup. They are strictly nested.


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

Copyright © 1997-2022 Jeroen van der Zijp