|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Pairs a do-operation with its inverse undo-operation. More...
#include <mitkOperationEvent.h>


Public Member Functions | |
| OperationEvent (OperationActor *destination, Operation *operation, Operation *undoOperation, std::string description="") | |
| Construct an OperationEvent. More... | |
| ~OperationEvent () override | |
| Destructor. More... | |
| Operation * | GetOperation () |
| Get the current do-operation. More... | |
| OperationActor * | GetDestination () |
| Get the destination actor for the operations. More... | |
| void | ReverseOperations () override |
| Swap the do-operation and undo-operation. More... | |
| void | ReverseAndExecute () override |
| Reverse the operations and execute the (now current) do-operation. More... | |
| bool | IsValid () const override |
| Check whether this event is still valid. More... | |
Public Member Functions inherited from mitk::UndoStackItem | |
| UndoStackItem (std::string description="") | |
| Construct an UndoStackItem with an optional description. More... | |
| virtual | ~UndoStackItem () |
| Virtual destructor. More... | |
| int | GetGroupEventId () |
| Get this item's GroupEventId. More... | |
| int | GetObjectEventId () |
| Get this item's ObjectEventId. More... | |
| std::string | GetDescription () |
| Get the textual description of this undo entry. More... | |
Protected Member Functions | |
| void | OnObjectDeleted () |
Additional Inherited Members | |
Static Public Member Functions inherited from mitk::UndoStackItem | |
| static int | GetCurrGroupEventId () |
| Get the current global GroupEventId. More... | |
| static int | GetCurrObjectEventId () |
| Get the current global ObjectEventId. More... | |
| static void | IncCurrObjectEventId () |
| Increment the global ObjectEventId counter. More... | |
| static void | IncCurrGroupEventId () |
| Increment the global GroupEventId counter. More... | |
Protected Attributes inherited from mitk::UndoStackItem | |
| bool | m_Reversed |
| true, if operation and undooperation have been swapped/changed More... | |
Pairs a do-operation with its inverse undo-operation.
Extends UndoStackItem with the actual operation accounting for the undo/redo framework. Holds two Operation objects and the OperationActor (destination) on which they are executed. The operations are swapped when the event moves between undo and redo stacks.
This class owns the memory of both operations and deletes them in its destructor. If the destination (an OperationActor, often an itk::Object) is deleted, this event becomes invalid; always check IsValid() before executing operations.
Definition at line 165 of file mitkOperationEvent.h.
| mitk::OperationEvent::OperationEvent | ( | OperationActor * | destination, |
| Operation * | operation, | ||
| Operation * | undoOperation, | ||
| std::string | description = "" |
||
| ) |
Construct an OperationEvent.
If the destination is an itk::Object, a delete observer is registered to detect when it is destroyed.
| [in] | destination | The OperationActor that executes the operations. |
| [in] | operation | The do-operation (ownership transferred). |
| [in] | undoOperation | The inverse undo-operation (ownership transferred). |
| [in] | description | Optional human-readable description. |
|
override |
Destructor.
Removes the delete observer (if destination is still valid) and frees both Operation objects.
| OperationActor* mitk::OperationEvent::GetDestination | ( | ) |
Get the destination actor for the operations.
| Operation* mitk::OperationEvent::GetOperation | ( | ) |
Get the current do-operation.
|
overridevirtual |
Check whether this event is still valid.
Returns false if the destination has been deleted or either operation reports itself as invalid.
Implements mitk::UndoStackItem.
|
protected |
|
overridevirtual |
Reverse the operations and execute the (now current) do-operation.
Used when an event is moved from the undo stack to the redo stack.
Reimplemented from mitk::UndoStackItem.
|
overridevirtual |
Swap the do-operation and undo-operation.
Called by the undo model when this event is moved between the undo and redo stacks.
Reimplemented from mitk::UndoStackItem.