summaryrefslogtreecommitdiffstats
path: root/src/undo-stack-observer.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /src/undo-stack-observer.h
parentInitial commit. (diff)
downloadinkscape-upstream.tar.xz
inkscape-upstream.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/undo-stack-observer.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/undo-stack-observer.h b/src/undo-stack-observer.h
new file mode 100644
index 0000000..0d27780
--- /dev/null
+++ b/src/undo-stack-observer.h
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Authors:
+ * David Yip <yipdw@rose-hulman.edu>
+ *
+ * Copyright (c) 2005 Authors
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#ifndef SEEN_UNDO_COMMIT_OBSERVER_H
+#define SEEN_UNDO_COMMIT_OBSERVER_H
+
+#include "inkgc/gc-managed.h"
+
+namespace Inkscape {
+
+struct Event;
+
+/**
+ * Observes changes made to the undo and redo stacks.
+ *
+ * More specifically, an UndoStackObserver is a class that receives notifications when
+ * any of the following events occur:
+ * <ul>
+ * <li>A change is committed to the undo stack.</li>
+ * <li>An undo action is made.</li>
+ * <li>A redo action is made.</li>
+ * </ul>
+ *
+ * UndoStackObservers should not be used on their own. Instead, they should be registered
+ * with a CompositeUndoStackObserver.
+ */
+class UndoStackObserver : public GC::Managed<> {
+public:
+ UndoStackObserver() = default;
+ virtual ~UndoStackObserver() = default;
+
+ /**
+ * Triggered when the user issues an undo command.
+ *
+ * \param log Pointer to an Event describing the undone event.
+ */
+ virtual void notifyUndoEvent(Event* log) = 0;
+
+ /**
+ * Triggered when the user issues a redo command.
+ *
+ * \param log Pointer to an Event describing the redone event.
+ */
+ virtual void notifyRedoEvent(Event* log) = 0;
+
+ /**
+ * Triggered when a set of transactions is committed to the undo log.
+ *
+ * \param log Pointer to an Event describing the committed events.
+ */
+ virtual void notifyUndoCommitEvent(Event* log) = 0;
+
+ /**
+ * Triggered when the undo log is cleared.
+ */
+ virtual void notifyClearUndoEvent() = 0;
+
+ /**
+ * Triggered when the redo log is cleared.
+ */
+ virtual void notifyClearRedoEvent() = 0;
+
+};
+
+}
+
+#endif // SEEN_UNDO_COMMIT_OBSERVER_H