A repository of user actions. More...
#include <ilviews/base/action.h>
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 IlvAction * | canRepeat () |
Specifies whether the last executed action can be repeated. More... | |
IlvAction * | getAction (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... | |
IlvAction * | getLast () 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... | |
IlvActionSelectionHandler * | getSelectionHandler () 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... | |
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.
IlvAction
, IlvCommand
, IlvCommandHistory
. IlvActionHistory::IlvActionHistory | ( | IlUInt | max = 8 | ) |
Constructor.
max | The maximum number of actions that can be recorded in the history. |
|
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.
action | The action to be added to the history. |
Reimplemented in IlvCommandHistory.
Adds a property.
key | The name of the property to be added. |
value | The value of the property. |
|
virtual |
Specifies whether the last executed action can be repeated.
0
if it cannot. 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.
i | The index of the action to be retrieved. |
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.
IlvAction* IlvActionHistory::getLast | ( | ) | const |
Shortcut method for getAction(0)
.
IlUInt IlvActionHistory::getLength | ( | ) | const |
Returns the number of actions stored in the history.
IlUInt IlvActionHistory::getMaxLength | ( | ) | const |
Returns the maximum number of commands that can be stored in the history.
Gets a property value.
key | The name of the property to be retrieved. |
0
if there is none. IlvActionSelectionHandler* IlvActionHistory::getSelectionHandler | ( | ) | const |
Returns the selection handler attached to this history.
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.
key | The name of the property to be tested. |
IlTrue
if this property exists, and IlFalse
if it does not. Purges the history of recorded actions or commands.
n | The number of actions to be removed from the history. |
IlBoolean IlvActionHistory::recordValueChanges | ( | ) | const |
Indicates whether changes to objects should be recorded as commands.
IlTrue
if changes on objects are recorder as commands and IlFalse
otherwise. Removes a property.
key | The name of the property to be removed. |
|
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.
Replaces a property.
key | The name of the property to be replaced. |
value | The new value of the property. |
|
virtual |
Sets the maximum number of commands that can be stored in the history.
maxLength | The maximum length of the history stack. |
void IlvActionHistory::setRecordValueChanges | ( | IlBoolean | b | ) |
Enables or disables command recording when objects are modified.
b | When 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. |
void IlvActionHistory::setSelectionHandler | ( | IlvActionSelectionHandler * | handler | ) |
Attaches a selection handler to a history.
handler | The selection handler to attach to this history. If this parameter is set to 0 , the handler is detached. |