1 /**
2 * Undo stack observer interface
3 *
4 * Observes undo, redo, and undo log commit events.
5 *
6 * Authors:
7 * David Yip <yipdw@rose-hulman.edu>
8 *
9 * Copyright (c) 2005 Authors
10 *
11 * Released under GNU GPL, read the file 'COPYING' for more information
12 */
14 #ifndef __UNDO_COMMIT_OBSERVER_H__
15 #define __UNDO_COMMIT_OBSERVER_H__
17 namespace Inkscape {
19 namespace XML {
21 class Event;
23 }
25 /**
26 * Observes changes made to the undo and redo stacks.
27 *
28 * More specifically, an UndoStackObserver is a class that receives notifications when
29 * any of the following events occur:
30 * <ul>
31 * <li>A change is committed to the undo stack.</li>
32 * <li>An undo action is made.</li>
33 * <li>A redo action is made.</li>
34 * </ul>
35 *
36 * UndoStackObservers should not be used on their own. Instead, they should be registered
37 * with a CompositeUndoStackObserver.
38 */
39 class UndoStackObserver {
40 public:
41 UndoStackObserver() { }
42 virtual ~UndoStackObserver() { }
44 /**
45 * Triggered when the user issues an undo command.
46 *
47 * \param log Pointer to an XML::Event describing the undone event.
48 */
49 virtual void notifyUndoEvent(XML::Event* log) = 0;
51 /**
52 * Triggered when the user issues a redo command.
53 *
54 * \param log Pointer to an XML::Event describing the redone event.
55 */
56 virtual void notifyRedoEvent(XML::Event* log) = 0;
58 /**
59 * Triggered when a set of transactions is committed to the undo log.
60 *
61 * \param log Pointer to an XML::Event describing the committed events.
62 */
63 virtual void notifyUndoCommitEvent(XML::Event* log) = 0;
64 };
66 }
68 #endif