rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvCommand Class Reference

Defines actions that can be undone. More...

#include <ilviews/base/command.h>

Inheritance diagram for IlvCommand:
IlvAction IlvChangeValueCommand IlvMacroCommand

List of all members.

Public Member Functions

 IlvCommand (IlvActionHistory *h=0, IlvUndoabilityReason u=notImplemented, IlBoolean ps=((IlBoolean) 0), IlBoolean r=((IlBoolean) 1), IlBoolean p=((IlBoolean) 0))
 Constructor.
IlBoolean isPseudoCommand () const
 Is set to IlTrue if the command is a pseudocommand.
IlvUndoabilityReason isUndoable () const
 Indicates whether the command can be undone, and tells why if it cannot.
virtual void redo ()
 Redoes a command that was previously undone.
virtual void undo ()
 Undoes a command.
virtual void undoIt ()
 Implements the undo behavior.

Detailed Description

Defines actions that can be undone.

Library: views

The class IlvCommand defines actions that can be undone. They are generally used to implement the real changes that objects undergo in an application in response to user input.

This class cannot be directly instantiated. For a command to be executed, you must override its executeIt and undoIt methods in subclasses.

See also:
IlvActionHistory, IlvCommandHistory, IlvMacroCommand, IlvChanveValueCommand

Constructor & Destructor Documentation

IlvCommand::IlvCommand ( IlvActionHistory h = 0,
IlvUndoabilityReason  u = notImplemented,
IlBoolean  ps = ((IlBoolean)0),
IlBoolean  r = ((IlBoolean)1),
IlBoolean  p = ((IlBoolean)0) 
)

Constructor.

Parameters:
h The action history that serves as the execution context of the command. If you do not set this parameter, this will be done when the command is added to an action history.
u A Boolean value specifying whether the command can be undone. As a precaution, it is set by default to notImplemented. Consequently, you must not forget to set it to IlTrue when the undoIt method is implemented.
ps A Boolean value specifying whether the command is a pseudocommand.
r A Boolean value specifying whether the command can be repeated.
p A Boolean value specifying whether the command is persistent. The persistence of commands is not yet implemented.

Member Function Documentation

IlBoolean IlvCommand::isPseudoCommand (  )  const

Is set to IlTrue if the command is a pseudocommand.

A pseudocommand is an action that does not actually modify the application objects, but that can be undone for practical purposes. Selection and navigation commands, such as panning and zooming, are pseudocommands. This is a flag that is statically defined for each command and not a parameter, since, depending on the application, you may consider actions, such as zooming, to be real commands. (A real command is one whose result is to be saved with the file.)
Typically, this flag is used by IlvModifiedFlagObserver to determine whether the document corresponding to a given command history should be considered as modified or not.

See also:
IlvModifiedFlagObserver
IlvUndoabilityReason IlvCommand::isUndoable (  )  const

Indicates whether the command can be undone, and tells why if it cannot.

Returns:
undoable if the command can be undone. It can also return another value, that indicates why this command cannot be undone.
virtual void IlvCommand::redo (  )  [virtual]

Redoes a command that was previously undone.

By default, its implementation calls the execute method. However, for efficiency reasons, you may wish to implement a specific version that performs less checks by assuming that executeIt has already been called once.

virtual void IlvCommand::undo (  )  [virtual]

Undoes a command.

Usually, this method is invoked by the command history and does not have to be called or redefined. In addition to calling undoIt, this method sets the done flag to IlFalse and informs its class observers that the command has been undone.

virtual void IlvCommand::undoIt (  )  [virtual]

Implements the undo behavior.

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

Reimplemented in IlvMacroCommand, and IlvChangeValueCommand.

 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.