Undo / Redo / Repeat Actions

The Undo, Redo, and Repeat actions are automatically managed by the document. To process these actions, the document invokes the following methods (which can be overridden for specific uses):

  • virtual IlBoolean canUndo() const;

This method returns true if the command that has just been executed can be undone. If there is no command that can be undone, for example if the document has not been modified, this method returns false.

  • virtual void undo(IlBoolean bUpdateUI = IlTrue);

This method calls the undo method of the last command executed. The bUpdateUI parameter specifies that the UI of the Undo, Redo, and Repeat commands must be updated.

  • virtual IlBoolean canRedo() const;

This method returns true if the command that has just been undone can be redone by calling the doIt method. If there is no command that can be done, for example if the document has not been modified, this method returns false.

  • virtual void redo(IlBoolean bUpdateUI = IlTrue);

This method calls the doIt method of the last undone command. The bUpdateUI parameter specifies that the UI of the Undo, Redo, and Repeat commands must be updated.

  • virtual void repeat(IlBoolean bUpdateUI = IlTrue);

This method repeats the last command executed. This command is copied by calling its copy method. The copy is added to the commands history and then executed. The bUpdateUI parameter specifies that the UI of the Undo, Redo, and Repeat commands must be updated.