Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkUndoModel.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkUndoModel_h
14 #define mitkUndoModel_h
15 
16 #include <mitkCommon.h>
17 #include <mitkOperation.h>
18 #include <itkObject.h>
19 #include <itkObjectFactory.h>
20 
21 namespace mitk
22 {
23  class UndoStackItem;
24  class OperationEvent;
25  class OperationActor;
26 
35  class MITKCORE_EXPORT UndoModel : public itk::Object
36  {
37  public:
39 
40  // no New Macro because this is an abstract class!
41 
48  virtual bool SetOperationEvent(UndoStackItem *stackItem) = 0;
49 
54  virtual bool Undo() = 0;
55 
62  virtual bool Undo(bool fine) = 0;
63 
68  virtual bool Redo() = 0;
69 
76  virtual bool Redo(bool fine) = 0;
77 
79  virtual void Clear() = 0;
80 
82  virtual void ClearRedoList() = 0;
83 
88  virtual bool RedoListEmpty() = 0;
89 
94  virtual bool UndoListEmpty() = 0;
95 
104  virtual std::size_t GetUndoLimit() const = 0;
105 
115  virtual void SetUndoLimit(std::size_t limit) = 0;
116 
121  virtual int GetLastObjectEventIdInList() = 0;
122 
127  virtual int GetLastGroupEventIdInList() = 0;
128 
139  virtual OperationEvent *GetLastOfType(OperationActor *destination, OperationType opType) = 0;
140 
149  virtual unsigned int RemoveInvalidOperations() = 0;
150 
151  protected:
153  ~UndoModel() override{};
154  };
155 
156 } // namespace mitk
157 #endif
#define MITKCORE_EXPORT
abstract class, that can be used by Undo to undo an operation.
Pairs a do-operation with its inverse undo-operation.
Abstract superclass for all undo models.
Definition: mitkUndoModel.h:36
virtual bool SetOperationEvent(UndoStackItem *stackItem)=0
Store an operation event on the undo stack.
virtual bool RedoListEmpty()=0
Check whether the redo list is empty.
~UndoModel() override
virtual bool Undo(bool fine)=0
Undo the last operation with control over granularity.
mitkClassMacroItkParent(UndoModel, itk::Object)
virtual int GetLastGroupEventIdInList()=0
Return the GroupEventId of the top element in the undo history.
virtual unsigned int RemoveInvalidOperations()=0
Remove invalid operations from the undo/redo stack.
virtual std::size_t GetUndoLimit() const =0
Get the limit on the size of the undo history.
virtual void Clear()=0
Clear both the undo and redo lists.
virtual void SetUndoLimit(std::size_t limit)=0
Set a limit on the size of the undo history.
virtual bool UndoListEmpty()=0
Check whether the undo list is empty.
virtual OperationEvent * GetLastOfType(OperationActor *destination, OperationType opType)=0
Return the last OperationEvent matching the given destination and type.
virtual void ClearRedoList()=0
Clear the redo list only.
virtual int GetLastObjectEventIdInList()=0
Return the ObjectEventId of the top element in the undo history.
virtual bool Redo()=0
Redo the last undone operation (fine-grained by ObjectEventId).
virtual bool Redo(bool fine)=0
Redo the last undone operation with control over granularity.
virtual bool Undo()=0
Undo the last operation (fine-grained by ObjectEventId).
Represents an entry on the undo or redo stack.
Find image slices visible on a given plane.
int OperationType
Type alias for operation type identifiers.
Definition: mitkOperation.h:24