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. More... | |
virtual void | executeIt () |
Executes the action (internal interface). More... | |
IlvValueInterface * | getObject () const |
Returns the object to which the command applies. More... | |
const IlvValue & | getValue (IlBoolean b, IlUInt i) const |
Returns the ith value stored in the command. More... | |
virtual void | snapshot (IlvValueInterface *o, const IlSymbol *s, IlBoolean before=IlTrue) |
Queries the specified value and records it. More... | |
virtual 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 (const IlvAction &action) | |
Copy constructor used to repeat actions. More... | |
IlvAction (IlvActionHistory *history=0, IlBoolean repeatable=IlTrue, IlBoolean persistent=IlFalse) | |
Constructor. More... | |
virtual | ~IlvAction () |
Destructor. | |
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. 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. | |
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. |
|
virtual |
IlvValueInterface* IlvChangeValueCommand::getObject | ( | ) | const |
Returns the object to which the command applies.
Returns the ith
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 |
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 |
Implements the undo behavior.
This method should be redefined in subclasses to cancel the executeIt
method.
Reimplemented from IlvCommand.
|
virtual |
Returns the name of the action in a readable form.
By default, userName()
searches the default message database of the display for an entry of the form '&<ActionClass>', and returns the string found.
Reimplemented from IlvAction.