Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
A command class for storing simple attribute changes made to an object of the class IlvValueInterface
.
More...
#include <ilviews/base/command.h>
Public Member Functions | |
IlvChangeValueCommand (IlvActionHistory *h=0, IlUInt n=0, const IlvValue *af=0, IlvValueInterface *o=0, const IlvValue *bf=0) | |
Constructor. | |
IlvAction * | duplicate () const |
Must be implemented in subclasses for the action to be repeatable. | |
virtual void | executeIt () |
Executes the action (internal interface). | |
IlvValueInterface * | getObject () const |
Returns the object to which the command applies. | |
const IlvValue & | getValue (IlBoolean b, IlUInt i) const |
Returns the i th value stored in the command. | |
virtual void | snapshot (IlvValueInterface *o, const IlSymbol *s, IlBoolean before=((IlBoolean) 1)) |
Queries the specified value and records it. | |
virtual void | undoIt () |
Implements the undo behavior. | |
IlString | userName () const |
Returns the name of the action in a readable form. |
A command class for storing simple attribute changes made to an object of the class IlvValueInterface
.
Library: views
Instances of IlvChangeValueCommand
are used internally by IlvValueInterface::beforeChangeValues
and IlvValueInterface::afterChangeValues
to keep track of any value changes and store them in the current command history attached to a given value interface. If the flag recordValueChanges
is IlTrue
, all change value calls produce a change value object that will be added to the stack of executed commands. This process works by storing the value before and after it is modified.
IlvChangeValueCommand::IlvChangeValueCommand | ( | IlvActionHistory * | h = 0 , |
|
IlUInt | n = 0 , |
|||
const IlvValue * | af = 0 , |
|||
IlvValueInterface * | o = 0 , |
|||
const IlvValue * | bf = 0 | |||
) |
Constructor.
All these parameters are optional.
h | The context to which the command applies. | |
n | The number of changed values. | |
af | The values after the command has been executed | |
o | The object to which the change of values is applied. | |
bf | The values before the command has been executed. |
IlvAction* IlvChangeValueCommand::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.
virtual void IlvChangeValueCommand::executeIt | ( | ) | [virtual] |
Executes the action (internal interface).
This method must be implemented in subclasses to execute the action.
Implements IlvAction.
IlvValueInterface* IlvChangeValueCommand::getObject | ( | ) | const |
Returns the object to which the command applies.
Returns the i
th value stored in the command.
b | If set to IlTrue , the returned value is that of the object before the command is executed. Otherwise, it is the value of the object after the command is executed. | |
i | The index of the value in the array of stored values. |
virtual void IlvChangeValueCommand::snapshot | ( | IlvValueInterface * | o, | |
const IlSymbol * | s, | |||
IlBoolean | before = ((IlBoolean) 1) | |||
) | [virtual] |
Queries the specified value and records it.
o | The object to which the command applies. | |
s | The name of the value that is to be recorded. | |
before | If set to IlTrue , the command is considered as not executed. In this case, the snapshot is the state to which the undo method will revert the object. If set to IlFalse , the snapshot is the state to which the execute and redo methods should set the object. |
virtual void IlvChangeValueCommand::undoIt | ( | ) | [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.