aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Editors/IUndoRedoStatesProvider.cs
blob: 9735a94a86275eba1175fd2793dffcd5e6b6fdb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Editors
{
    /// <summary>
    /// Represents an undo/redo state provider.
    /// </summary>
    public interface IUndoRedoStatesProvider
    {
        /// <summary>
        /// Occurs when an Undo/Redo state was executed.
        /// </summary>
        event EventHandler<UndoRedoStateExecutedEventArgs> StateExecuted;

        /// <summary>
        /// Gets the undo states.
        /// </summary>
        Stack<IUndoRedoState> UndoStates { get; }

        /// <summary>
        /// Gets the redo states.
        /// </summary>
        Stack<IUndoRedoState> RedoStates { get; }

        /// <summary>
        /// Gets a value indicating whether this instance can undo.
        /// </summary>
        bool CanUndo { get; }

        /// <summary>
        /// Gets a value indicating whether this instance can redo.
        /// </summary>
        bool CanRedo { get; }

        /// <summary>
        /// Prepares the state of the undo.
        /// </summary>
        void PrepareUndoState();

        /// <summary>
        /// Creates the a new undo/redo state.
        /// </summary>
        /// <returns></returns>
        IUndoRedoState CreateUndoRedoState();

        /// <summary>
        /// Executes the an undo/redo state.
        /// </summary>
        /// <param name="state">The state.</param>
        void ExecuteState(IUndoRedoState state);

        /// <summary>
        /// Commits the state created by <see cref="PrepareUndoState"/>.
        /// </summary>
        void CommitUndoState();

        /// <summary>
        /// Performs an undo operation.
        /// </summary>
        void Undo();

        /// <summary>
        /// Performs a redo operation.
        /// </summary>
        void Redo();

        /// <summary>
        /// Resets undo and redo states.
        /// </summary>
        void Reset();
    }
}