Interface
PapersViewUndoHandler
Description [src]
interface PapersView.UndoHandler : GObject.Object
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), the
pps_undo_handler_undo
interface method is called on the object.
An action is represented by an arbitrary pointer. The object must free
such pointers when the pps_undo_handler_free_action
interface 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 added PpsAnnotation
.
This action is added to the undo stack of the undo context. Then, if the user uses
Ctrl+Z, the pps_undo_context_undo
method is called, the addition action is taken
from the undo stack and pps_undo_handler_undo
is 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.
Prerequisite
In order to implement UndoHandler, your type must inherit fromGObject
.
Interface structure
struct PapersViewUndoHandlerInterface {
GTypeInterface parent_iface;
void (* undo) (
PpsUndoHandler* self,
gpointer data
);
void (* free_action) (
gpointer data
);
}
No description available.
Interface members
parent_iface |
|
No description available. |
|
undo |
|
No description available. |
|
free_action |
|
No description available. |