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>

Collaboration diagram for wxSFCanvasHistory:

List of all members.

Public Types

enum  MODE { histUSE_SERIALIZATION, histUSE_CLONING }

Public Member Functions

 wxSFCanvasHistory (MODE hmode=histUSE_SERIALIZATION)
 Default constructor.
 wxSFCanvasHistory (wxSFShapeCanvas *canvas, MODE hmode=histUSE_SERIALIZATION)
 User constructor.
 ~wxSFCanvasHistory (void)
 Destructor.
void SetMode (MODE hmode)
 Set history working mode.
void SetHistoryDepth (size_t depth)
 Set total number of stored canvas states.
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.
MODE GetMode ()
 Get currently used working mode.
size_t GetHistoryDepth ()
 Get total number of canvas states which can be stored at the same time.
void SaveCanvasState ()
 Save current canvas state.
void RestoreOlderState ()
 Perform the 'Undo' operation.
void RestoreNewerState ()
 Perform the 'Redo' operation.
void Clear ()
 Clear all canvas history.
bool CanUndo ()
 The function gives information whether the 'Undo' operation is available (exists any stored canvas state older than the current one.
bool CanRedo ()
 The function gives information whether the 'Redo' operation is available (exists any stored canvas state newer than the current one.

Protected Attributes

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

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

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

Default constructor.

Parameters:
hmodeWorking mode (see MODE enumeration for more details)

User constructor.

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

Destructor.


Member Function Documentation

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

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 all canvas history.

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

Get currently used working mode.

Perform the 'Redo' operation.

Perform the 'Undo' operation.

Save current canvas state.

void wxSFCanvasHistory::SetHistoryDepth ( size_t  depth) [inline]

Set total number of stored canvas states.

Parameters:
depthNumber of stored canvas states
See also:
GetHistoryDepth

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

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

StateList wxSFCanvasHistory::m_lstCanvasStates [protected]

List of stored canvas state instances.

See also:
wxSFCanvasState

Total allowed amount of stored canvas states.

Canvas history mode.

Auxilary pointer to current canvas state.

Pointer to the parent canvas.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines