DialogEngine CATUndoableCommand
Usage: you can derive this class.
public class CATUndoableCommand
Class representing an undoable command.
Role: An undoable command adds an item in the Undo stack when it is activated,
replaced by a new global one when it ends in order to enable the user to reverse what
has been done during the command.
IMPORTANT NOTICE :
To activate your command either in exclusive, shared or undefined mode,
you must respectively call one of the following methods immediately after its creation:
- RequestStatusChange(CATCommandMsgRequestExclusiveMode);
- RequestStatusChange(CATCommandMsgRequestSharedMode);
- Activate(NULL,NULL);
To end your command, you must call RequestDelayedDestruction();
note: the command cannot end before it has been activated. So cannot be called immediately after the (asynchronous) RequestStatusChange call
if the command is exclusive or shared. Then you must call it at the end of the overriden
method if the command is expected to end without any user interaction.
To localize your command, you must create a NLS file whose name is the command identifier.
For example if you create an instance with "MyCommand" as identifier,
you must create a MyCommand.CATNls file including the UndoTitle key definition.
(for example : UndoTitle="Object Analysis";)
If for any reason you want to use another file or another key you must use the
method to set them.
Constructor and Destructor Index
- o
CATUndoableCommand(CATString&)
- Constructs an undoable command.
- o
~CATUndoableCommand()
-
Method Index
- o
Activate(CATCommand*,CATNotification*)
- Activates a command.
- o
Cancel(CATCommand*,CATNotification*)
- Cancels a command.
- o
Desactivate(CATCommand*,CATNotification*)
- Deactivates a command.
- o
ExecuteUndoAtEnd()
- Requests to undo the command when it ends.
- o
GetGlobalUndo()
- Returns the command global undo.
- o
RequestDelayedDestruction()
- Requests the command delayed destruction.
- o
SetResourceID(CATString&,CATString&)
- Sets specific resource file name and key.
Constructor and Destructor
o CATUndoableCommand
public CATUndoableCommand( | const | iId) |
-
Constructs an undoable command.
- Parameters:
-
- iId
- The command identifier. It is used to identify both the resource file and the Undo title.
o ~CATUndoableCommand
public virtual ~CATUndoableCommand( | ) |
-
Methods
o Activate
public virtual Activate( | | iFromClient, |
| | iNotification) |
-
Activates a command.
Role: Gives the focus to the command.
If you override this method, the CATUndoableCommand::Activate method must be called
at the beginning of your own method.
- Parameters:
-
- iFromClient
- The command that requests to activate the current one
- iNotification
- The associated notification
- Returns:
- The command status.
o Cancel
public virtual Cancel( | | iFromClient, |
| | iNotification) |
-
Cancels a command.
Role: Called by the command selector to definitely
withdraw the focus from the command.
The command should then request its destruction, using the
method.
If you override this method, the CATUndoableCommand::Cancel method must be called
at the end of your own method.
- Parameters:
-
- iFromClient
- The command that requests to cancel the current one
- iNotification
- The notification sent
- Returns:
- The command status.
o Desactivate
public virtual Desactivate( | | iFromClient, |
| | iNotification) |
-
Deactivates a command.
Role: Called by the command selector to temporarily
withdraw the focus from the command.
If you override this method, the CATUndoableCommand::Desactivate method must be called
anywhere in your own method.
- Parameters:
-
- iFromClient
- The command that requests to deactivate the current one
- iNotification
- The associated notification
- Returns:
- The command status.
o ExecuteUndoAtEnd
public ExecuteUndoAtEnd( | ) |
-
Requests to undo the command when it ends.
Role: This method requests a global undo at the end of the command.
o GetGlobalUndo
public virtual GetGlobalUndo( | ) |
-
Returns the command global undo.
Role: Enables to add actions during Undo or Redo.
o RequestDelayedDestruction
public virtual RequestDelayedDestruction( | ) |
-
Requests the command delayed destruction.
Role: The command will be destroyed as soon as this will be possible.
o SetResourceID
public SetResourceID( | const | iRscFileName, |
| const | iRscKey) |
-
Sets specific resource file name and key.
Role: Defines resource file and/or key for localization.
If you call this method, call it before the CATUndoableCommand::Activate method is called.
- Parameters:
-
- iRscFileName
- The resource file name
- iRscKey
- The resource key
This object is included in the file: CATUndoableCommand.h
If needed, your Imakefile.mk should include the module: CATDialogEngine
Copyright © 1999-2014, Dassault Systèmes. All rights reserved.