vtkUndoStack.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkUndoStack.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
38 #ifndef vtkUndoStack_h
39 #define vtkUndoStack_h
40 
41 #include "vtkObject.h"
42 #include "vtkPVVTKExtensionsCoreModule.h" // needed for export macro
43 
45 class vtkUndoSet;
46 
48 {
49 public:
50  enum EventIds
51  {
52  UndoSetRemovedEvent = 1989,
53  UndoSetClearedEvent = 1990
54  };
55 
56  static vtkUndoStack* New();
57  vtkTypeMacro(vtkUndoStack, vtkObject);
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
64  virtual void Push(const char* label, vtkUndoSet* changeSet);
65 
73  const char* GetUndoSetLabel(unsigned int position);
74 
82  const char* GetRedoSetLabel(unsigned int position);
83 
87  unsigned int GetNumberOfUndoSets();
88 
92  unsigned int GetNumberOfRedoSets();
93 
97  int CanUndo() { return (this->GetNumberOfUndoSets() > 0); }
98 
102  int CanRedo() { return (this->GetNumberOfRedoSets() > 0); }
103 
107  virtual vtkUndoSet* GetNextUndoSet();
108 
112  virtual vtkUndoSet* GetNextRedoSet();
113 
121  virtual int Undo();
122 
130  virtual int Redo();
131 
137  void PopUndoStack();
138 
144  void PopRedoStack();
145 
149  void Clear();
150 
152 
155  vtkGetMacro(InUndo, bool);
157 
159 
162  vtkGetMacro(InRedo, bool);
164 
166 
171  vtkSetClampMacro(StackDepth, int, 1, 100);
172  vtkGetMacro(StackDepth, int);
173 
174 protected:
175  vtkUndoStack();
176  ~vtkUndoStack() override;
178 
181 
182 private:
183  vtkUndoStack(const vtkUndoStack&) = delete;
184  void operator=(const vtkUndoStack&) = delete;
185 
186  bool InUndo;
187  bool InRedo;
188 };
189 
190 #endif
undo/redo stack.
Definition: vtkUndoStack.h:47
#define VTKPVVTKEXTENSIONSCORE_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
int CanUndo()
Returns if undo operation can be performed.
Definition: vtkUndoStack.h:97
Maintains a collection of vtkUndoElement that can be undone/redone in a single step.
Definition: vtkUndoSet.h:42
int CanRedo()
Returns if redo operation can be performed.
Definition: vtkUndoStack.h:102
static vtkObject * New()
void operator=(const vtkObjectBase &)
vtkUndoStackInternal * Internal
Definition: vtkUndoStack.h:179