Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Defines a list of commands to be executed in one operation. More...
#include <ilviews/base/command.h>
Public Member Functions | |
IlvMacroCommand (IlvActionHistory *h=0, const IlString &name="¯o") | |
Constructor. More... | |
void | add (IlvCommand *c) |
Adds a command to a macro. More... | |
IlBoolean | canRedo () const |
Specifies whether there is a command that can be redone. More... | |
IlBoolean | canUndo () const |
Specifies whether there is a command that can be undone. More... | |
void | close () |
Closes the macro. More... | |
void | executeIt () |
Executes the action (internal interface). More... | |
IlUInt | getLength () const |
Returns the number of internally recorded commands. More... | |
IlvCommand * | operator[] (IlUInt i) const |
Returns the i th command stored. More... | |
void | redoInner () |
Redoes the last undone command, if any, and puts it back on top of the stack of the executed commands. | |
void | undoInner () |
Undoes the last added command and put it on top of a local undo stack. | |
void | undoIt () |
Implements the undo behavior. More... | |
IlString | userName () const |
Returns the name of the action in a readable form. More... | |
Public Member Functions inherited from IlvCommand | |
IlvCommand (IlvActionHistory *h=0, IlvUndoabilityReason u=notImplemented, IlBoolean ps=IlFalse, IlBoolean r=IlTrue, IlBoolean p=IlFalse) | |
Constructor. More... | |
IlBoolean | isPseudoCommand () const |
Is set to IlTrue if the command is a pseudocommand. More... | |
IlvUndoabilityReason | isUndoable () const |
Indicates whether the command can be undone, and tells why if it cannot. More... | |
virtual void | redo () |
Redoes a command that was previously undone. More... | |
virtual void | undo () |
Undoes a command. More... | |
Public Member Functions inherited from IlvAction | |
IlvAction (IlvActionHistory *h=0, IlBoolean r=IlTrue, IlBoolean p=IlFalse) | |
Constructor. More... | |
IlvAction (const IlvAction &a) | |
Copy constructor used to repeat actions. More... | |
virtual IlvAction * | duplicate () const |
Must be implemented in subclasses for the action to be repeatable. More... | |
virtual IlString | errorMessage (IlUInt &severity) const |
Returns an error message. More... | |
virtual void | execute () |
Executes the action (external interface). More... | |
IlvActionHistory * | getContext () const |
Returns the action history of the action or command. More... | |
IlBoolean | isCommand () const |
Indicates whether an action is an IlvCommand object. More... | |
IlBoolean | isDone () const |
Indicates whether the execute method has already been called for this action. More... | |
IlBoolean | isRepeatable () const |
Indicates whether an action can be repeated. More... | |
virtual void | setContext (IlvActionHistory *history) |
Sets the execution context and the history of an action. More... | |
void | setDone (IlBoolean d=IlTrue) |
Specifies whether a command or action should be considered as being executed. More... | |
Additional Inherited Members | |
Public Attributes inherited from IlvAction | |
IlvActionFlags | _flags |
Action flags. Can be set directly by subclasses to change the status of the action. | |
Defines a list of commands to be executed in one operation.
Library: views
The class IlvMacroCommand
lets you define a list of commands to be executed in a single operation. Executing a macro command performs all the commands the macro includes in the order in which they were recorded. Likewise, undoing a macro command cancels all its commands in the reverse order of their execution.
If you do not want to create macro commands explicitly, use the methods IlvCommandHistory::openMacro
and IlvCommandHistory::closeMacro
to have the command history automatically record all the executed commands in one single macro.
IlvActionHistory
, IlvCommand
, IlvCommandHistory
. IlvMacroCommand::IlvMacroCommand | ( | IlvActionHistory * | h = 0 , |
const IlString & | name = "¯o" |
||
) |
Constructor.
h | The associated command history, if any. |
name | The name of the command to be returned by the getUserName method. If no name is provided, or if the string is empty, the name of the macro will be set to the name of the first command contained in the macro. |
void IlvMacroCommand::add | ( | IlvCommand * | c | ) |
Adds a command to a macro.
c | The command to be added. This command must have been allocated with the new operator because the macro command will attempt to delete it when it is itself deleted. |
IlBoolean IlvMacroCommand::canRedo | ( | ) | const |
Specifies whether there is a command that can be redone.
IlTrue
is there is a command that can be redone, and IlFalse
otherwise. IlBoolean IlvMacroCommand::canUndo | ( | ) | const |
Specifies whether there is a command that can be undone.
IlTrue
is there is a command that can be undone, and IlFalse
otherwise. void IlvMacroCommand::close | ( | ) |
Closes the macro.
Basically, this member function gets rid of any remaining undone commands and marks them as being executed.
|
virtual |
Executes the action (internal interface).
This method must be implemented in subclasses to execute the action.
Implements IlvAction.
IlUInt IlvMacroCommand::getLength | ( | ) | const |
Returns the number of internally recorded commands.
IlvCommand* IlvMacroCommand::operator[] | ( | IlUInt | i | ) | const |
Returns the i
th command stored.
i | The index of the command to be returned. This index must be valid. |
|
virtual |
Implements the undo behavior.
This method should be redefined in subclasses to cancel the executeIt
method.
Reimplemented from IlvCommand.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.