vtkUndoStack.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
26 #ifndef vtkUndoStack_h
27 #define vtkUndoStack_h
28 
29 #include "vtkObject.h"
30 #include "vtkPVVTKExtensionsCoreModule.h" // needed for export macro
31 
33 class vtkUndoSet;
34 
36 {
37 public:
38  enum EventIds
39  {
40  UndoSetRemovedEvent = 1989,
41  UndoSetClearedEvent = 1990
42  };
43 
44  static vtkUndoStack* New();
45  vtkTypeMacro(vtkUndoStack, vtkObject);
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
52  virtual void Push(const char* label, vtkUndoSet* changeSet);
53 
61  const char* GetUndoSetLabel(unsigned int position);
62 
70  const char* GetRedoSetLabel(unsigned int position);
71 
75  unsigned int GetNumberOfUndoSets();
76 
80  unsigned int GetNumberOfRedoSets();
81 
85  int CanUndo() { return (this->GetNumberOfUndoSets() > 0); }
86 
90  int CanRedo() { return (this->GetNumberOfRedoSets() > 0); }
91 
95  virtual vtkUndoSet* GetNextUndoSet();
96 
100  virtual vtkUndoSet* GetNextRedoSet();
101 
109  virtual int Undo();
110 
118  virtual int Redo();
119 
125  void PopUndoStack();
126 
132  void PopRedoStack();
133 
137  void Clear();
138 
140 
143  vtkGetMacro(InUndo, bool);
145 
147 
150  vtkGetMacro(InRedo, bool);
152 
154 
159  vtkSetClampMacro(StackDepth, int, 1, 100);
160  vtkGetMacro(StackDepth, int);
161 
162 protected:
163  vtkUndoStack();
164  ~vtkUndoStack() override;
166 
169 
170 private:
171  vtkUndoStack(const vtkUndoStack&) = delete;
172  void operator=(const vtkUndoStack&) = delete;
173 
174  bool InUndo;
175  bool InRedo;
176 };
177 
178 #endif
undo/redo stack.
Definition: vtkUndoStack.h:35
#define VTKPVVTKEXTENSIONSCORE_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
int CanUndo()
Returns if undo operation can be performed.
Definition: vtkUndoStack.h:85
Maintains a collection of vtkUndoElement that can be undone/redone in a single step.
Definition: vtkUndoSet.h:30
int CanRedo()
Returns if redo operation can be performed.
Definition: vtkUndoStack.h:90
static vtkObject * New()
void operator=(const vtkObjectBase &)
vtkUndoStackInternal * Internal
Definition: vtkUndoStack.h:167