PapersView.UndoHandler¶
- Implementations:
Methods¶
|
|
|
Virtual Methods¶
|
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class PapersView.UndoHandler¶
- Bases:
- Structure:
This interface is implemented by objects (e.g. the annotation context) that aim to register actions that may be undone. Such actions must be registered into the undo context so as they are added to the undo stack with
pps_undo_context_add_action. Then, when an action must be undone (e.g. the user pressed Ctrl+Z), thepps_undo_handler_undointerface method is called on the object. An action is represented by an arbitrary pointer. The object must free such pointers when thepps_undo_handler_free_actioninterface method is called.For instance, the annotation context implements
PpsUndoHandler. When an annotation is added, the annotation context creates a custom struct that represents this action, it contains (among other things) a pointer to the addedPpsAnnotation. This action is added to the undo stack of the undo context. Then, if the user uses Ctrl+Z, thepps_undo_context_undomethod is called, the addition action is taken from the undo stack andpps_undo_handler_undois called on the annotation context and the addition action. Then, the implementation of this interface in the annotation context removes the annotation from the document. This removal entails that the annotation context adds a new action to the undo context (a struct that represents the removal of the annotation), and the undo context adds this action to the redo stack since this happens while undoing.