rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions
IlvMacroCommand Class Reference

Defines a list of commands to be executed in one operation. More...

#include <ilviews/base/command.h>

Inheritance diagram for IlvMacroCommand:
IlvCommand IlvAction

Public Member Functions

 IlvMacroCommand (IlvActionHistory *h=0, const IlString &name="&macro")
 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...
 
IlvCommandoperator[] (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 IlvActionduplicate () 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...
 
IlvActionHistorygetContext () 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.
 

Detailed Description

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.

See Also
IlvActionHistory, IlvCommand, IlvCommandHistory.

Constructor & Destructor Documentation

IlvMacroCommand::IlvMacroCommand ( IlvActionHistory h = 0,
const IlString name = "&macro" 
)

Constructor.

Parameters
hThe associated command history, if any.
nameThe 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.

Member Function Documentation

void IlvMacroCommand::add ( IlvCommand c)

Adds a command to a macro.

Parameters
cThe 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.

Returns
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.

Returns
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.

void IlvMacroCommand::executeIt ( )
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.

Returns
The number of internally recorded commands.
IlvCommand* IlvMacroCommand::operator[] ( IlUInt  i) const

Returns the i th command stored.

Parameters
iThe index of the command to be returned. This index must be valid.
Returns
The command that is located at the indicated index.
void IlvMacroCommand::undoIt ( )
virtual

Implements the undo behavior.

This method should be redefined in subclasses to cancel the executeIt method.

Reimplemented from IlvCommand.

IlString IlvMacroCommand::userName ( ) const
virtual

Returns the name of the action in a readable form.

By default, the method userName searches the default message database of the display for an entry of the form '&<ActionClass>', and returns the string found.

Reimplemented from IlvAction.


© 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.