wxShapeFramework
1.13.0 beta
|
Container class that manages stored canvas states (canvas snapshots) and implements basic Undo/Redo functionality. More...
#include <CanvasHistory.h>
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 | |
wxSFShapeCanvas * | m_pParentCanvas |
Pointer to the parent canvas. | |
StateList | m_lstCanvasStates |
List of stored canvas state instances. | |
wxSFCanvasState * | m_pCurrentCanvasState |
Auxilary pointer to current canvas state. | |
MODE | m_nWorkingMode |
Canvas history mode. | |
size_t | m_nHistoryDepth |
Total allowed amount of stored canvas states. |
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.
Default constructor.
hmode | Working mode (see MODE enumeration for more details) |
wxSFCanvasHistory::wxSFCanvasHistory | ( | wxSFShapeCanvas * | canvas, |
MODE | hmode = histUSE_SERIALIZATION |
||
) |
User constructor.
canvas | Pointer to managed canvas |
hmode | Working mode (see MODE enumeration for more details) |
Destructor.
bool wxSFCanvasHistory::CanRedo | ( | ) |
The function gives information whether the 'Redo' operation is available (exists any stored canvas state newer than the current one.
bool wxSFCanvasHistory::CanUndo | ( | ) |
The function gives information whether the 'Undo' operation is available (exists any stored canvas state older than the current one.
void wxSFCanvasHistory::Clear | ( | ) |
Clear all canvas history.
size_t wxSFCanvasHistory::GetHistoryDepth | ( | ) | [inline] |
Get total number of canvas states which can be stored at the same time.
MODE wxSFCanvasHistory::GetMode | ( | ) | [inline] |
Get currently used working mode.
void wxSFCanvasHistory::RestoreNewerState | ( | ) |
Perform the 'Redo' operation.
void wxSFCanvasHistory::RestoreOlderState | ( | ) |
Perform the 'Undo' operation.
void wxSFCanvasHistory::SaveCanvasState | ( | ) |
Save current canvas state.
void wxSFCanvasHistory::SetHistoryDepth | ( | size_t | depth | ) | [inline] |
Set total number of stored canvas states.
depth | Number of stored canvas states |
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.
hmode | Working mode |
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.
canvas | Pointer to parent shape canvas |
StateList wxSFCanvasHistory::m_lstCanvasStates [protected] |
List of stored canvas state instances.
size_t wxSFCanvasHistory::m_nHistoryDepth [protected] |
Total allowed amount of stored canvas states.
MODE wxSFCanvasHistory::m_nWorkingMode [protected] |
Canvas history mode.
wxSFCanvasState* wxSFCanvasHistory::m_pCurrentCanvasState [protected] |
Auxilary pointer to current canvas state.
wxSFShapeCanvas* wxSFCanvasHistory::m_pParentCanvas [protected] |
Pointer to the parent canvas.