Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
vtkUndoStack Class Reference

undo/redo stack. More...

#include <vtkUndoStack.h>

Inheritance diagram for vtkUndoStack:
Inheritance graph
[legend]
Collaboration diagram for vtkUndoStack:
Collaboration graph
[legend]

Public Types

enum  EventIds { UndoSetRemovedEvent = 1989, UndoSetClearedEvent = 1990 }
 
typedef vtkObject Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
virtual void Push (const char *label, vtkUndoSet *changeSet)
 Push an undo set on the Undo stack. More...
 
const char * GetUndoSetLabel (unsigned int position)
 Returns the label for the set at the given Undo position. More...
 
const char * GetRedoSetLabel (unsigned int position)
 Returns the label for the set at the given Redo position. More...
 
unsigned int GetNumberOfUndoSets ()
 Returns the number of sets on the undo stack. More...
 
unsigned int GetNumberOfRedoSets ()
 Returns the number of sets on the undo stack. More...
 
int CanUndo ()
 Returns if undo operation can be performed. More...
 
int CanRedo ()
 Returns if redo operation can be performed. More...
 
virtual vtkUndoSetGetNextUndoSet ()
 Get the UndoSet on the top of the Undo stack, if any. More...
 
virtual vtkUndoSetGetNextRedoSet ()
 Get the UndoSet on the top of the Redo stack, if any. More...
 
virtual int Undo ()
 Performs an Undo using the set on the top of the undo stack. More...
 
virtual int Redo ()
 Performs a Redo using the set on the top of the redo stack. More...
 
void PopUndoStack ()
 Pop the undo stack. More...
 
void PopRedoStack ()
 Pop the redo stack. More...
 
void Clear ()
 Clears all the undo/redo elements from the stack. More...
 
virtual bool GetInUndo ()
 Returns if the stack is currently being undone. More...
 
virtual bool GetInRedo ()
 Returns if the stack is currently being redone. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual vtkMTimeType GetMTime ()
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 

Static Public Member Functions

static vtkUndoStackNew ()
 
static int IsTypeOf (const char *type)
 
static vtkUndoStackSafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 
static vtkObjectBaseNew ()
 

Protected Attributes

vtkUndoStackInternalInternal
 
int StackDepth
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 
virtual void SetStackDepth (int)
 Get set the maximum stack depth. More...
 
virtual int GetStackDepth ()
 Get set the maximum stack depth. More...
 
 vtkUndoStack ()
 Get set the maximum stack depth. More...
 
 ~vtkUndoStack () override
 Get set the maximum stack depth. More...
 

Additional Inherited Members

- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Detailed Description

undo/redo stack.

This an undo stack. Each undo/redo-able operation is a vtkUndoSet object. This class fires a vtkCommand::ModifiedEvent when the undo/redo stack changes.

On Undo, vtkUndoSet::Undo is called on the vtkUndoSet at the top of the undo stack and the set is pushed onto the top of the redo stack. On Redo, vtkUndoSet::Redo is called on the vtkUndoSet at the top of the redo stack and the set is pushed onto the top of the undo stack. When a vtkUndoSet is pushed on the undo stack, the redo stack is cleared.

Each undo set are assigned user-readable labels providing information about the operation(s) that will be undone/redone.

vtkUndoElement, vtkUndoSet and vtkUndoStack form the undo/redo framework core.

See also
vtkUndoSet vtkUndoElement

Definition at line 47 of file vtkUndoStack.h.

Member Typedef Documentation

◆ Superclass

Definition at line 57 of file vtkUndoStack.h.

Member Enumeration Documentation

◆ EventIds

Enumerator
UndoSetRemovedEvent 
UndoSetClearedEvent 

Definition at line 50 of file vtkUndoStack.h.

Constructor & Destructor Documentation

◆ vtkUndoStack()

vtkUndoStack::vtkUndoStack ( )
protected

Get set the maximum stack depth.

As more entries are pushed on the stack, if its size exceeds this limit then old entries will be removed. Default is 10.

◆ ~vtkUndoStack()

vtkUndoStack::~vtkUndoStack ( )
overrideprotected

Get set the maximum stack depth.

As more entries are pushed on the stack, if its size exceeds this limit then old entries will be removed. Default is 10.

Member Function Documentation

◆ New()

static vtkUndoStack* vtkUndoStack::New ( )
static

◆ GetClassName()

virtual const char* vtkUndoStack::GetClassName ( )
virtual

Reimplemented in vtkSMUndoStack.

◆ IsTypeOf()

static int vtkUndoStack::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual int vtkUndoStack::IsA ( const char *  type)
virtual

Reimplemented from vtkObjectBase.

Reimplemented in vtkSMUndoStack.

◆ SafeDownCast()

static vtkUndoStack* vtkUndoStack::SafeDownCast ( vtkObject o)
static

◆ PrintSelf()

void vtkUndoStack::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Reimplemented from vtkObject.

◆ Push()

virtual void vtkUndoStack::Push ( const char *  label,
vtkUndoSet changeSet 
)
virtual

Push an undo set on the Undo stack.

This will clear any sets in the Redo stack.

Reimplemented in vtkSMUndoStack.

◆ GetUndoSetLabel()

const char* vtkUndoStack::GetUndoSetLabel ( unsigned int  position)

Returns the label for the set at the given Undo position.

0 is the current undo set, 1 is the one preceding to the current one and so on.

Returns
nullptr is no set exists at the given index, otherwise the label for the change set.

◆ GetRedoSetLabel()

const char* vtkUndoStack::GetRedoSetLabel ( unsigned int  position)

Returns the label for the set at the given Redo position.

0 is the next set to redo, 1 is the one after the next one and so on.

Returns
nullptr is no set exists at the given index, otherwise the label for the change set.

◆ GetNumberOfUndoSets()

unsigned int vtkUndoStack::GetNumberOfUndoSets ( )

Returns the number of sets on the undo stack.

◆ GetNumberOfRedoSets()

unsigned int vtkUndoStack::GetNumberOfRedoSets ( )

Returns the number of sets on the undo stack.

◆ CanUndo()

int vtkUndoStack::CanUndo ( )
inline

Returns if undo operation can be performed.

Definition at line 97 of file vtkUndoStack.h.

◆ CanRedo()

int vtkUndoStack::CanRedo ( )
inline

Returns if redo operation can be performed.

Definition at line 102 of file vtkUndoStack.h.

◆ GetNextUndoSet()

virtual vtkUndoSet* vtkUndoStack::GetNextUndoSet ( )
virtual

Get the UndoSet on the top of the Undo stack, if any.

◆ GetNextRedoSet()

virtual vtkUndoSet* vtkUndoStack::GetNextRedoSet ( )
virtual

Get the UndoSet on the top of the Redo stack, if any.

◆ Undo()

virtual int vtkUndoStack::Undo ( )
virtual

Performs an Undo using the set on the top of the undo stack.

The set is poped from the undo stack and pushed at the top of the redo stack. Before undo begins, it fires vtkCommand::StartEvent and when undo completes, it fires vtkCommand::EndEvent.

Returns
the status of the operation.

Reimplemented in vtkSMUndoStack.

◆ Redo()

virtual int vtkUndoStack::Redo ( )
virtual

Performs a Redo using the set on the top of the redo stack.

The set is poped from the redo stack and pushed at the top of the undo stack. Before redo begins, it fires vtkCommand::StartEvent and when redo completes, it fires vtkCommand::EndEvent.

Returns
the status of the operation.

Reimplemented in vtkSMUndoStack.

◆ PopUndoStack()

void vtkUndoStack::PopUndoStack ( )

Pop the undo stack.

The UndoElement on the top of the undo stack is popped from the undo stack and pushed on the redo stack. This is same as Undo() except that the vtkUndoElement::Undo() is not invoked.

◆ PopRedoStack()

void vtkUndoStack::PopRedoStack ( )

Pop the redo stack.

The UndoElement on the top of the redo stack is popped and then pushed on the undo stack. This is same as Redo() except that vtkUndoElement::Redo() is not invoked.

◆ Clear()

void vtkUndoStack::Clear ( )

Clears all the undo/redo elements from the stack.

◆ GetInUndo()

virtual bool vtkUndoStack::GetInUndo ( )
virtual

Returns if the stack is currently being undone.

◆ GetInRedo()

virtual bool vtkUndoStack::GetInRedo ( )
virtual

Returns if the stack is currently being redone.

◆ SetStackDepth()

virtual void vtkUndoStack::SetStackDepth ( int  )
virtual

Get set the maximum stack depth.

As more entries are pushed on the stack, if its size exceeds this limit then old entries will be removed. Default is 10.

◆ GetStackDepth()

virtual int vtkUndoStack::GetStackDepth ( )
virtual

Get set the maximum stack depth.

As more entries are pushed on the stack, if its size exceeds this limit then old entries will be removed. Default is 10.

Member Data Documentation

◆ Internal

vtkUndoStackInternal* vtkUndoStack::Internal
protected

Definition at line 179 of file vtkUndoStack.h.

◆ StackDepth

int vtkUndoStack::StackDepth
protected

Definition at line 180 of file vtkUndoStack.h.


The documentation for this class was generated from the following file: