1////////////////////////////////////////////////////////////////////////////////
2//
3// ADOBE SYSTEMS INCORPORATED
4// Copyright 2007-2010 Adobe Systems Incorporated
5// All Rights Reserved.
6//
7// NOTICE:  Adobe permits you to use, modify, and distribute this file
8// in accordance with the terms of the license agreement accompanying it.
9//
10////////////////////////////////////////////////////////////////////////////////
11package flashx.undo
12{
13    /**
14     * IUndoManager defines the interface for managing the undo and redo stacks.
15     *
16     * <p>An undo manager maintains a stack of operations that can be undone and redone.</p>
17     *
18     * @playerversion Flash 10
19     * @playerversion AIR 1.5
20     * @langversion 3.0
21     */
22    public interface IUndoManager
23    {
24        /**
25         * Clears both the undo and the redo histories.
26         *
27         * @playerversion Flash 10
28         * @playerversion AIR 1.5
29         * @langversion 3.0
30         */
31        function clearAll():void;
32
33        /**
34         * The maximum number of undoable or redoable operations to track.
35         *
36         * <p>To disable the undo function, set this value to 0.</p>
37         *
38         * @playerversion Flash 10
39         * @playerversion AIR 1.5
40         * @langversion 3.0
41         */
42        function get undoAndRedoItemLimit():int;
43        function set undoAndRedoItemLimit(value:int):void;
44
45        /**
46         * Indicates whether there is currently an operation that can be undone.
47         *
48         * @return Boolean <code>true</code>, if there is an operation on the undo stack that can be reversed.
49         * Otherwise, <code>false</code>.
50         *
51         * @playerversion Flash 10
52         * @playerversion AIR 1.5
53         * @langversion 3.0
54         */
55        function canUndo():Boolean;
56
57        /**
58         * Returns the next operation to be undone.
59         *
60         * @return The undoable IOperation object, or <code>null</code>, if no undoable operation
61         * is on the stack.
62         *
63         * @playerversion Flash 10
64         * @playerversion AIR 1.5
65         * @langversion 3.0
66         */
67        function peekUndo():IOperation;
68
69        /**
70         * Removes the next operation to be undone from the undo stack, and returns it.
71         *
72         * @return The undoable IOperation object, or <code>null</code>, if no undoable operation
73         * is on the stack.
74         *
75         * @playerversion Flash 10
76         * @playerversion AIR 1.5
77         * @langversion 3.0
78         */
79        function popUndo():IOperation;
80
81        /**
82         * Adds an undoable operation to the undo stack.
83         *
84         * @playerversion Flash 10
85         * @playerversion AIR 1.5
86         * @langversion 3.0
87         */
88        function pushUndo(operation:IOperation):void;
89
90        /**
91         * Clears the redo stack.
92         *
93         * @playerversion Flash 10
94         * @playerversion AIR 1.5
95         * @langversion 3.0
96         */
97        function clearRedo():void;
98
99        /**
100         * Indicates whether there is currently an operation that can be redone.
101         *
102         * @return Boolean <code>true</code>, if there is an operation on the redo stack that can be redone.
103         * Otherwise, <code>false</code>.
104         *
105         * @playerversion Flash 10
106         * @playerversion AIR 1.5
107         * @langversion 3.0
108         */
109        function canRedo():Boolean;
110
111        /**
112         * Returns the next operation to be redone.
113         *
114         * @return The redoable IOperation object, or <code>null</code>, if no redoable operation
115         * is on the stack.
116         *
117         * @playerversion Flash 10
118         * @playerversion AIR 1.5
119         * @langversion 3.0
120         */
121        function peekRedo():IOperation;
122
123        /**
124         * Removes the next operation to be redone from the redo stack, and returns it.
125         *
126         * @return The redoable IOperation object, or <code>null</code>, if no redoable operation
127         * is on the stack.
128         * @playerversion Flash 10
129         * @playerversion AIR 1.5
130         * @langversion 3.0
131         */
132        function popRedo():IOperation;
133
134        /**
135         * Adds a redoable operation to the redo stack.
136         *
137         * @playerversion Flash 10
138         * @playerversion AIR 1.5
139         * @langversion 3.0
140         */
141        function pushRedo(operation:IOperation):void;
142
143        /**
144         * Removes the next IOperation object from the undo stack and calls the performUndo()
145         * function of that object.
146         *
147         * @see flashx.textLayout.edit.IEditManager#undo()
148         * @see flashx.undo.IUndoManager#canUndo()
149         * @see flashx.undo.IUndoManager#clearUndo()
150         * @see flashx.undo.IUndoManager#peekUndo()
151         * @see flashx.undo.IUndoManager#pushUndo()
152         * @see flashx.undo.IUndoManager#popUndo()
153         */
154        function undo():void;
155
156        /**
157         * Removes the next IOperation object from the redo stack and calls the performRedo()
158         * function of that object.
159         *
160         * @see flashx.textLayout.edit.IEditManager#redo()
161         * @see flashx.undo.IUndoManager#canRedo()
162         * @see flashx.undo.IUndoManager#clearRedo()
163         * @see flashx.undo.IUndoManager#peekRedo()
164         * @see flashx.undo.IUndoManager#pushRedo()
165         * @see flashx.undo.IUndoManager#popRedo()
166         */
167        function redo():void;
168    }
169}
170