Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IActionStack.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections.Generic;
5 
6 namespace SiliconStudio.ActionStack
7 {
8  /// <summary>
9  /// Base interface to for an action stack.
10  /// </summary>
11  public interface IActionStack
12  {
13  /// <summary>
14  /// Gets the action items currently stored in the action stack, including undone items that have not been disbranched.
15  /// </summary>
16  IEnumerable<IActionItem> ActionItems { get; }
17 
18  /// <summary>
19  /// Raised whenever action items are added to the stack.
20  /// </summary>
21  event EventHandler<ActionItemsEventArgs<IActionItem>> ActionItemsAdded;
22 
23  /// <summary>
24  /// Raised whenever the action stack is cleared.
25  /// </summary>
26  event EventHandler ActionItemsCleared;
27 
28  /// <summary>
29  /// Raised whenever action items are discarded from the stack.
30  /// </summary>
31  event EventHandler<DiscardedActionItemsEventArgs<IActionItem>> ActionItemsDiscarded;
32 
33  /// <summary>
34  /// Raised when an action item is undone.
35  /// </summary>
36  event EventHandler<ActionItemsEventArgs<IActionItem>> Undone;
37 
38  /// <summary>
39  /// Raised when an action item is redone.
40  /// </summary>
41  event EventHandler<ActionItemsEventArgs<IActionItem>> Redone;
42 
43  /// <summary>
44  /// Adds an action item to the stack. Discards any action item that is currently undone.
45  /// </summary>
46  /// <param name="item">The action item to add to the stack.</param>
47  void Add(IActionItem item);
48 
49  /// <summary>
50  /// Adds multiple action items on the stack. Discards any action item that is currently undone.
51  /// </summary>
52  /// <param name="items">The action items to add on the stack.</param>
53  void AddRange(IEnumerable<IActionItem> items);
54 
55  /// <summary>
56  /// Clears the action stack.
57  /// </summary>
58  void Clear();
59 
60  /// <summary>
61  /// Creates a save point at the current index of the action stack.
62  /// </summary>
63  /// <param name="markActionsAsSaved">Indicate whether to set the <see cref="IActionItem.IsSaved"/> of all preceding action items to true.</param>
64  /// <returns>A <see cref="SavePoint"/> object corresponding to the created save point.</returns>
65  SavePoint CreateSavePoint(bool markActionsAsSaved);
66 
67  /// <summary>
68  /// Undoes the last action item that is currently done.
69  /// </summary>
70  /// <returns><c>True</c> if an action could be undone, <c>False</c> otherwise.</returns>
71  bool Undo();
72 
73  /// <summary>
74  /// Redoes the first action item that is currently undone.
75  /// </summary>
76  /// <returns><c>True</c> if an action could be redone, <c>False</c> otherwise.</returns>
77  bool Redo();
78  }
79 }
EventHandler< ActionItemsEventArgs< IActionItem > > Undone
Raised when an action item is undone.
Definition: IActionStack.cs:36
Represents a save point marker in the undo/redo action items stack.
Definition: SavePoint.cs:11
EventHandler< ActionItemsEventArgs< IActionItem > > ActionItemsAdded
Raised whenever action items are added to the stack.
Definition: IActionStack.cs:21
Base interface for action items.
Definition: IActionItem.cs:10
Base interface to for an action stack.
Definition: IActionStack.cs:11
EventHandler< DiscardedActionItemsEventArgs< IActionItem > > ActionItemsDiscarded
Raised whenever action items are discarded from the stack.
Definition: IActionStack.cs:31
EventHandler< ActionItemsEventArgs< IActionItem > > Redone
Raised when an action item is redone.
Definition: IActionStack.cs:41
EventHandler ActionItemsCleared
Raised whenever the action stack is cleared.
Definition: IActionStack.cs:26