rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvChangeValueCommand Class Reference

A command class for storing simple attribute changes made to an object of the class IlvValueInterface. More...

#include <ilviews/base/command.h>

Inheritance diagram for IlvChangeValueCommand:
IlvCommand IlvAction

List of all members.

Public Member Functions

 IlvChangeValueCommand (IlvActionHistory *h=0, IlUInt n=0, const IlvValue *af=0, IlvValueInterface *o=0, const IlvValue *bf=0)
 Constructor.
IlvActionduplicate () 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 IlvValuegetValue (IlBoolean b, IlUInt i) const
 Returns the ith 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.

Detailed Description

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.

See also:
IlvActionHistory, IlvCommand, IlvCommandHistory

Constructor & Destructor Documentation

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.

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

Member Function Documentation

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 object that the command applies to.
const IlvValue& IlvChangeValueCommand::getValue ( IlBoolean  b,
IlUInt  i 
) const

Returns the ith value stored in the command.

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

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

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