Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Represents a pair of operations: undo and the according redo. More...
#include <mitkOperationEvent.h>
Public Member Functions | |
OperationEvent (OperationActor *destination, Operation *operation, Operation *undoOperation, std::string description="") | |
~OperationEvent () override | |
Operation * | GetOperation () |
OperationActor * | GetDestination () |
void | ReverseOperations () override |
void | ReverseAndExecute () override |
virtual bool | IsValid () |
![]() | |
UndoStackItem (std::string description="") | |
virtual | ~UndoStackItem () |
int | GetGroupEventId () |
Returns the GroupEventId for this object. More... | |
int | GetObjectEventId () |
Returns the ObjectEventId for this object. More... | |
std::string | GetDescription () |
Returns the textual description of this object. More... | |
Protected Member Functions | |
void | OnObjectDeleted () |
Additional Inherited Members | |
![]() | |
static int | GetCurrGroupEventId () |
For combining operations in groups. More... | |
static int | GetCurrObjectEventId () |
For combining operations in Objects. More... | |
static void | IncCurrObjectEventId () |
Increases the current ObjectEventId For example if a button click generates operations the ObjectEventId has to be incremented to be able to undo. More... | |
static void | IncCurrGroupEventId () |
Increases the current GroupEventId For example if a button click generates operations the GroupEventId has to be incremented to be able to undo. More... | |
![]() | |
bool | m_Reversed |
true, if operation and undooperation have been swaped/changed More... | |
Represents a pair of operations: undo and the according redo.
Additionally to the base class UndoStackItem, which only provides a description of an item, OperationEvent does the actual accounting of the undo/redo stack. This class holds two Operation objects (operation and its inverse operation) and the corresponding OperationActor. The operations may be swapped by the undo models, when an OperationEvent is moved from their undo to their redo stack or vice versa.
Note, that memory management of operation and undooperation is done by this class. Memory of both objects is freed in the destructor. For this, the method IsValid() is needed which holds information of the state of m_Destination. In case the object referenced by m_Destination is already deleted, isValid() returns false. In more detail if the destination happens to be an itk::Object (often the case), OperationEvent is informed as
Definition at line 139 of file mitkOperationEvent.h.
mitk::OperationEvent::OperationEvent | ( | OperationActor * | destination, |
Operation * | operation, | ||
Operation * | undoOperation, | ||
std::string | description = "" |
||
) |
Definition at line 82 of file mitkOperationEvent.cpp.
References OnObjectDeleted().
|
override |
Definition at line 101 of file mitkOperationEvent.cpp.
mitk::OperationActor * mitk::OperationEvent::GetDestination | ( | ) |
Definition at line 137 of file mitkOperationEvent.cpp.
mitk::Operation * mitk::OperationEvent::GetOperation | ( | ) |
Definition at line 77 of file mitkOperationEvent.cpp.
|
virtual |
Definition at line 147 of file mitkOperationEvent.cpp.
|
protected |
Definition at line 142 of file mitkOperationEvent.cpp.
Referenced by OperationEvent().
|
overridevirtual |
Reimplemented from mitk::UndoStackItem.
Definition at line 130 of file mitkOperationEvent.cpp.
References mitk::OperationActor::ExecuteOperation(), and ReverseOperations().
|
overridevirtual |
swaps the Undo and Redo- operation and changes m_Reversed
Reimplemented from mitk::UndoStackItem.
Definition at line 118 of file mitkOperationEvent.cpp.
References mitk::UndoStackItem::ReverseOperations().
Referenced by ReverseAndExecute().