wxShapeFramework  1.13.0 beta
wxSFCanvasHistory Class Reference

Container class that manages stored canvas states (canvas snapshots) and implements basic Undo/Redo functionality. More...

#include <CanvasHistory.h>

Inheritance diagram for wxSFCanvasHistory:
Collaboration diagram for wxSFCanvasHistory:

Public Types

enum  MODE { histUSE_SERIALIZATION , histUSE_CLONING }
 

Public Member Functions

 wxSFCanvasHistory (MODE hmode=histUSE_SERIALIZATION)
 Default constructor. More...
 
 wxSFCanvasHistory (wxSFShapeCanvas *canvas, MODE hmode=histUSE_SERIALIZATION)
 User constructor. More...
 
 ~wxSFCanvasHistory (void)
 Destructor. More...
 
void SetMode (MODE hmode)
 Set history working mode. More...
 
void SetHistoryDepth (size_t depth)
 Set total number of stored canvas states. More...
 
void SetParentCanvas (wxSFShapeCanvas *canvas)
 Set pointer to the parent shapes canvas. All Undo/Redo operation defined by this class will be performed on this shape canvas instance. More...
 
MODE GetMode ()
 Get currently used working mode. More...
 
size_t GetHistoryDepth ()
 Get total number of canvas states which can be stored at the same time. More...
 
void SaveCanvasState ()
 Save current canvas state. More...
 
void RestoreOlderState ()
 Perform the 'Undo' operation. More...
 
void RestoreNewerState ()
 Perform the 'Redo' operation. More...
 
void Clear ()
 Clear all canvas history. More...
 
bool CanUndo ()
 The function gives information whether the 'Undo' operation is available (exists any stored canvas state older than the current one. More...
 
bool CanRedo ()
 The function gives information whether the 'Redo' operation is available (exists any stored canvas state newer than the current one. More...
 

Protected Attributes

wxSFShapeCanvasm_pParentCanvas
 Pointer to the parent canvas. More...
 
StateList m_lstCanvasStates
 List of stored canvas state instances. More...
 
wxSFCanvasStatem_pCurrentCanvasState
 Auxilary pointer to current canvas state. More...
 
MODE m_nWorkingMode
 Canvas history mode. More...
 
size_t m_nHistoryDepth
 Total allowed amount of stored canvas states. More...
 

Detailed Description

Container class that manages stored canvas states (canvas snapshots) and implements basic Undo/Redo functionality.

Two different working modes are available: 'histUSE_SERIALIZATION' mode uses basic serialization functionality encapsulated by a diagram manager for storing of current canvas content, but in the 'histUSE_CLONING' mode full copy of diagram manager content is done via its copy constructor. The first mode is slower than the second one, but do not require implementation of xsSerializable::Clone() virtual function in all classes derived from xsSerializable like the second posible working mode.

See also
wxSFCanvasState, wxSFCanvasHistory::MODE, xsSerializable::Clone, wxXmlSerializer::CopyItems

Member Enumeration Documentation

◆ MODE

Enumerator
histUSE_SERIALIZATION 

Use serialization for storing of a canvas content.

histUSE_CLONING 

Use diagram manager's copy constructor for storing of a canvas content.

Constructor & Destructor Documentation

◆ wxSFCanvasHistory() [1/2]

wxSFCanvasHistory::wxSFCanvasHistory ( MODE  hmode = histUSE_SERIALIZATION)

Default constructor.

Parameters
hmodeWorking mode (see MODE enumeration for more details)

◆ wxSFCanvasHistory() [2/2]

wxSFCanvasHistory::wxSFCanvasHistory ( wxSFShapeCanvas canvas,
MODE  hmode = histUSE_SERIALIZATION 
)

User constructor.

Parameters
canvasPointer to managed canvas
hmodeWorking mode (see MODE enumeration for more details)
See also
MODE

◆ ~wxSFCanvasHistory()

wxSFCanvasHistory::~wxSFCanvasHistory ( void  )

Destructor.

Member Function Documentation

◆ CanRedo()

bool wxSFCanvasHistory::CanRedo ( )

The function gives information whether the 'Redo' operation is available (exists any stored canvas state newer than the current one.

Returns
TRUE if the 'Undo' operation can be performed, otherwise FALSE

◆ CanUndo()

bool wxSFCanvasHistory::CanUndo ( )

The function gives information whether the 'Undo' operation is available (exists any stored canvas state older than the current one.

Returns
TRUE if the 'Undo' operation can be performed, otherwise FALSE

◆ Clear()

void wxSFCanvasHistory::Clear ( )

Clear all canvas history.

◆ GetHistoryDepth()

size_t wxSFCanvasHistory::GetHistoryDepth ( )
inline

Get total number of canvas states which can be stored at the same time.

Returns
Number of allowed concuretly stored canvas states
See also
SetHistoryDepth

◆ GetMode()

MODE wxSFCanvasHistory::GetMode ( )
inline

Get currently used working mode.

◆ RestoreNewerState()

void wxSFCanvasHistory::RestoreNewerState ( )

Perform the 'Redo' operation.

◆ RestoreOlderState()

void wxSFCanvasHistory::RestoreOlderState ( )

Perform the 'Undo' operation.

◆ SaveCanvasState()

void wxSFCanvasHistory::SaveCanvasState ( )

Save current canvas state.

◆ SetHistoryDepth()

void wxSFCanvasHistory::SetHistoryDepth ( size_t  depth)
inline

Set total number of stored canvas states.

Parameters
depthNumber of stored canvas states
See also
GetHistoryDepth

◆ SetMode()

void wxSFCanvasHistory::SetMode ( MODE  hmode)

Set history working mode.

For more details about available working modes see the wxSFCanvasHistory class
description. Note that all stored canvas history will be cleared after
usage of this function.
Parameters
hmodeWorking mode
See also
MODE

◆ SetParentCanvas()

void wxSFCanvasHistory::SetParentCanvas ( wxSFShapeCanvas canvas)
inline

Set pointer to the parent shapes canvas. All Undo/Redo operation defined by this class will be performed on this shape canvas instance.

Parameters
canvasPointer to parent shape canvas

Member Data Documentation

◆ m_lstCanvasStates

StateList wxSFCanvasHistory::m_lstCanvasStates
protected

List of stored canvas state instances.

See also
wxSFCanvasState

◆ m_nHistoryDepth

size_t wxSFCanvasHistory::m_nHistoryDepth
protected

Total allowed amount of stored canvas states.

◆ m_nWorkingMode

MODE wxSFCanvasHistory::m_nWorkingMode
protected

Canvas history mode.

◆ m_pCurrentCanvasState

wxSFCanvasState* wxSFCanvasHistory::m_pCurrentCanvasState
protected

Auxilary pointer to current canvas state.

◆ m_pParentCanvas

wxSFShapeCanvas* wxSFCanvasHistory::m_pParentCanvas
protected

Pointer to the parent canvas.


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