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 #include "gc-managed.h"
19 namespace Inkscape {
21 class Event;
23 /**
24 * Observes changes made to the undo and redo stacks.
25 *
26 * More specifically, an UndoStackObserver is a class that receives notifications when
27 * any of the following events occur:
28 * <ul>
29 * <li>A change is committed to the undo stack.</li>
30 * <li>An undo action is made.</li>
31 * <li>A redo action is made.</li>
32 * </ul>
33 *
34 * UndoStackObservers should not be used on their own. Instead, they should be registered
35 * with a CompositeUndoStackObserver.
36 */
37 class UndoStackObserver : public GC::Managed<> {
38 public:
39 UndoStackObserver() { }
40 virtual ~UndoStackObserver() { }
42 /**
43 * Triggered when the user issues an undo command.
44 *
45 * \param log Pointer to an Event describing the undone event.
46 */
47 virtual void notifyUndoEvent(Event* log) = 0;
49 /**
50 * Triggered when the user issues a redo command.
51 *
52 * \param log Pointer to an Event describing the redone event.
53 */
54 virtual void notifyRedoEvent(Event* log) = 0;
56 /**
57 * Triggered when a set of transactions is committed to the undo log.
58 *
59 * \param log Pointer to an Event describing the committed events.
60 */
61 virtual void notifyUndoCommitEvent(Event* log) = 0;
63 /**
64 * Triggered when the undo log is cleared.
65 */
66 virtual void notifyClearUndoEvent() = 0;
68 /**
69 * Triggered when the redo log is cleared.
70 */
71 virtual void notifyClearRedoEvent() = 0;
73 };
75 }
77 #endif