rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

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

List of all members.

Public Member Functions

 IlvMacroCommand (IlvActionHistory *h=0, const IlString &name="&macro")
 Constructor.
void add (IlvCommand *c)
 Adds a command to a macro.
IlBoolean canRedo () const
 Specifies whether there is a command that can be redone.
IlBoolean canUndo () const
 Specifies whether there is a command that can be undone.
void close ()
 Closes the macro.
IlvActionduplicate () const
 Must be implemented in subclasses for the action to be repeatable.
void executeIt ()
 Executes the action (internal interface).
IlUInt getLength () const
 Returns the number of internally recorded commands.
IlvCommandoperator[] (IlUInt i) const
 Returns the i th command stored.
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.
IlString userName () const
 Returns the name of the action in a readable form.

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

Member Function Documentation

void IlvMacroCommand::add ( IlvCommand c  ) 

Adds a command to a macro.

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

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.

IlvAction* IlvMacroCommand::duplicate (  )  const [virtual]

Must be implemented in subclasses for the action to be repeatable.

Most of the time, this member function is implemented by terminal classes of IlvAction and should perform the following:

 IlvAction* MyAction::duplicate() const
 { 
     return new MyAction(*this);
 }

Reimplemented from IlvAction.

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:
i The 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.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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