Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef UNDOMODEL_H_HEADER_INCLUDED_C16ED098
18 #define UNDOMODEL_H_HEADER_INCLUDED_C16ED098
19 
20 #include "mitkCommon.h"
21 #include "mitkOperation.h"
22 #include <itkObject.h>
23 #include <itkObjectFactory.h>
24 
25 namespace mitk
26 {
27  class UndoStackItem;
28  class OperationEvent;
29  class OperationActor;
30 
31  //##Documentation
32  //## @brief superclass for all UndoModels
33  //##
34  //## all necessary operations, that all UndoModels share.
35  //## @ingroup Undo
36  class MITKCORE_EXPORT UndoModel : public itk::Object
37  {
38  public:
40 
41  // no New Macro because this is an abstract class!
42 
43  virtual bool SetOperationEvent(UndoStackItem *stackItem) = 0;
44 
45  virtual bool Undo() = 0;
46  virtual bool Undo(bool fine) = 0;
47 
48  virtual bool Redo() = 0;
49  virtual bool Redo(bool fine) = 0;
50 
51  //##Documentation
52  //## @brief clears undo and Redolist
53  virtual void Clear() = 0;
54 
55  //##Documentation
56  //## @brief clears the RedoList
57  virtual void ClearRedoList() = 0;
58 
59  //##Documentation
60  //## @brief true if RedoList is empty
61  virtual bool RedoListEmpty() = 0;
62 
63  //##Documentation
64  //## @brief returns the ObjectEventId of the
65  //## top Element in the OperationHistory of the selected
66  //## UndoModel
67  virtual int GetLastObjectEventIdInList() = 0;
68 
69  //##Documentation
70  //## @brief returns the GroupEventId of the
71  //## top Element in the OperationHistory of the selected
72  //## UndoModel
73  virtual int GetLastGroupEventIdInList() = 0;
74 
75  //##Documentation
76  //## @brief returns the last specified OperationEvent in Undo-list
77  //## corresponding to the given values; if nothing found, then returns NULL
78  //##
79  //## needed to get the old Position of an Element for declaring an UndoOperation
80  virtual OperationEvent *GetLastOfType(OperationActor *destination, OperationType opType) = 0;
81 
82  protected:
83  UndoModel(){};
84  virtual ~UndoModel(){};
85  };
86 
87 } // namespace mitk
88 #endif /* UNDOMODEL_H_HEADER_INCLUDED_C16ED098 */
#define MITKCORE_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
abstract class, that can be used by Undo to undo an operation.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
Represents an entry of the undo or redo stack.
virtual ~UndoModel()
Definition: mitkUndoModel.h:84
superclass for all UndoModels
Definition: mitkUndoModel.h:36
int OperationType
Definition: mitkOperation.h:27
Represents a pair of operations: undo and the according redo.