Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvActionHistory Class Reference

A repository of user actions. More...

#include <ilviews/base/action.h>

Inheritance diagram for IlvActionHistory:
IlvObservable IlvSmartData IlvCommandHistory

Public Member Functions

 IlvActionHistory (IlUInt max=8)
 Constructor. More...
 
virtual ~IlvActionHistory ()
 Destructor.
 
virtual void add (IlvAction *action)
 Adds an action or a command and executes it (if necessary). More...
 
void addProperty (const IlSymbol *key, IlAny value)
 Adds a property. More...
 
virtual IlvActioncanRepeat ()
 Specifies whether the last executed action can be repeated. More...
 
IlvActiongetAction (IlUInt i) const
 Returns the i th action stored in the history. More...
 
IlvValueInterface *const * getCurrentSelection (IlUInt &c)
 Simplifies access to the current selection in the attached document. More...
 
IlvActiongetLast () const
 Shortcut method for getAction(0). More...
 
IlUInt getLength () const
 Returns the number of actions stored in the history. More...
 
IlUInt getMaxLength () const
 Returns the maximum number of commands that can be stored in the history. More...
 
IlAny getProperty (const IlSymbol *key) const
 Gets a property value. More...
 
IlvActionSelectionHandlergetSelectionHandler () const
 Returns the selection handler attached to this history. More...
 
IlBoolean hasProperty (const IlSymbol *key) const
 Checks if a property exists. More...
 
virtual void purge (IlUInt n=(IlUInt) -1)
 Purges the history of recorded actions or commands. More...
 
IlBoolean recordValueChanges () const
 Indicates whether changes to objects should be recorded as commands. More...
 
IlBoolean removeProperty (const IlSymbol *key)
 Removes a property. More...
 
virtual void repeatLast ()
 Repeats the last action stored in the history. More...
 
IlBoolean replaceProperty (const IlSymbol *key, IlAny value)
 Replaces a property. More...
 
virtual void setMaxLength (IlUInt maxLength)
 Sets the maximum number of commands that can be stored in the history. More...
 
void setRecordValueChanges (IlBoolean b)
 Enables or disables command recording when objects are modified. More...
 
void setSelectionHandler (IlvActionSelectionHandler *handler)
 Attaches a selection handler to a history. More...
 
- Public Member Functions inherited from IlvObservable
 IlvObservable ()
 Empty constructor. More...
 
virtual void notify (IlAny arg=0)
 Notification method, to be called in methods that modify the state of the object whenever required. More...
 
- Public Member Functions inherited from IlvSmartData
 IlvSmartData ()
 Constructor. More...
 
 IlvSmartData (const IlvSmartData &data)
 Copy constructor. More...
 
virtual ~IlvSmartData ()
 Destructor.
 
void decrRef ()
 Decrements the reference counter of the object and deletes this object when the counter reaches 0. More...
 
void incrRef ()
 Increments the reference counter.
 
int refCount ()
 Returns the number of references to this object. More...
 

Detailed Description

A repository of user actions.

Library: views

The class IlvActionHistory defines a repository of user actions. It allows you to implement user feedback, smart repeat, and other advanced input features based on the analysis of the recorded user actions.

See also
IlvAction, IlvCommand, IlvCommandHistory.

Constructor & Destructor Documentation

◆ IlvActionHistory()

IlvActionHistory::IlvActionHistory ( IlUInt  max = 8)

Constructor.

Parameters
maxThe maximum number of actions that can be recorded in the history.

Member Function Documentation

◆ add()

virtual void IlvActionHistory::add ( IlvAction action)
virtual

Adds an action or a command and executes it (if necessary).

If the total number of actions exceeds the maximum number of actions that can be stored in the history, the least recently executed actions are deleted with the delete operator. This means actions added to an action history must be dynamically allocated with the new operator for the action history to keep track of more than one action.

Parameters
actionThe action to be added to the history.

Reimplemented in IlvCommandHistory.

◆ addProperty()

void IlvActionHistory::addProperty ( const IlSymbol key,
IlAny  value 
)

Adds a property.

Parameters
keyThe name of the property to be added.
valueThe value of the property.

◆ canRepeat()

virtual IlvAction* IlvActionHistory::canRepeat ( )
virtual

Specifies whether the last executed action can be repeated.

Returns
The last executed action if it can be repeated, or 0 if it cannot.

◆ getAction()

IlvAction* IlvActionHistory::getAction ( IlUInt  i) const

Returns the i th action stored in the history.

h.getAction(0) returns the last executed action. h.getAction(h.getLength()-1) returns the earliest executed action still stored in the history.

Parameters
iThe index of the action to be retrieved.

◆ getCurrentSelection()

IlvValueInterface* const* IlvActionHistory::getCurrentSelection ( IlUInt c)

Simplifies access to the current selection in the attached document.

This method delegates its implementation to the attached IlvActionSelectionHandler object, if any.

◆ getLast()

IlvAction* IlvActionHistory::getLast ( ) const

Shortcut method for getAction(0).

Returns
A pointer to the last action.

◆ getLength()

IlUInt IlvActionHistory::getLength ( ) const

Returns the number of actions stored in the history.

Returns
The number of actions stored in the history.

◆ getMaxLength()

IlUInt IlvActionHistory::getMaxLength ( ) const

Returns the maximum number of commands that can be stored in the history.

Returns
The maximum length of the history stack.

◆ getProperty()

IlAny IlvActionHistory::getProperty ( const IlSymbol key) const

Gets a property value.

Parameters
keyThe name of the property to be retrieved.
Returns
The value of this property or 0 if there is none.

◆ getSelectionHandler()

IlvActionSelectionHandler* IlvActionHistory::getSelectionHandler ( ) const

Returns the selection handler attached to this history.

Returns
The selection handler of this history.

◆ hasProperty()

IlBoolean IlvActionHistory::hasProperty ( const IlSymbol key) const

Checks if a property exists.

Properties can be added to the history through commands or other objects, therefore allowing you to implement smart repeat features.

Parameters
keyThe name of the property to be tested.
Returns
IlTrue if this property exists, and IlFalse if it does not.

◆ purge()

virtual void IlvActionHistory::purge ( IlUInt  n = (IlUInt) -1)
virtual

Purges the history of recorded actions or commands.

Parameters
nThe number of actions to be removed from the history.

◆ recordValueChanges()

IlBoolean IlvActionHistory::recordValueChanges ( ) const

Indicates whether changes to objects should be recorded as commands.

Returns
IlTrue if changes on objects are recorder as commands and IlFalse otherwise.

◆ removeProperty()

IlBoolean IlvActionHistory::removeProperty ( const IlSymbol key)

Removes a property.

Parameters
keyThe name of the property to be removed.

◆ repeatLast()

virtual void IlvActionHistory::repeatLast ( )
virtual

Repeats the last action stored in the history.

This is performed by duplicating the last action, executing it, and adding it to the history.

◆ replaceProperty()

IlBoolean IlvActionHistory::replaceProperty ( const IlSymbol key,
IlAny  value 
)

Replaces a property.

Parameters
keyThe name of the property to be replaced.
valueThe new value of the property.

◆ setMaxLength()

virtual void IlvActionHistory::setMaxLength ( IlUInt  maxLength)
virtual

Sets the maximum number of commands that can be stored in the history.

Parameters
maxLengthThe maximum length of the history stack.

◆ setRecordValueChanges()

void IlvActionHistory::setRecordValueChanges ( IlBoolean  b)

Enables or disables command recording when objects are modified.

Parameters
bWhen set to IlTrue (the default), calls to changeValue() should record changes in the attached history. Otherwise, they should consider that the recording has already been carried out and therefore should not record commands.

◆ setSelectionHandler()

void IlvActionHistory::setSelectionHandler ( IlvActionSelectionHandler handler)

Attaches a selection handler to a history.

Parameters
handlerThe selection handler to attach to this history. If this parameter is set to 0, the handler is detached.