Struct undo::UndoStack [] [src]

pub struct UndoStack<'a> { /* fields omitted */ }

UndoStack maintains a stack of UndoCmds that can be undone and redone by using methods on the UndoStack.

UndoStack will notice when it's state changes to either dirty or clean, and the user can set methods that should be called for either state change. This is useful for example if you want to automatically enable or disable undo or redo buttons based on there are any more actions that can be undone or redone.

Note: An empty UndoStack is clean, so the first push will not trigger the on_clean method.

Methods

impl<'a> UndoStack<'a>
[src]

Creates a new UndoStack.

Creates a new UndoStack with the specified capacity.

Returns the capacity of the UndoStack.

Shrinks the capacity of the UndoStack as much as possible.

Returns the number of UndCmds in the UndoStack.

Returns true if the UndoStack contains no UndoCmds.

Sets what should happen if the state changes from dirty to clean. By default the UndoStack does nothing when the state changes.

Consumes the UndoStack so this method should be called when creating the UndoStack.

Sets what should happen if the state changes from clean to dirty. By default the UndoStack does nothing when the state changes.

Consumes the UndoStack so this method should be called when creating the UndoStack.

Returns true if the state of UndoStack is clean.

Returns true if the state of UndoStack is dirty.

Pushes a UndoCmd to the top of the UndoStack and executes its redo method. This pops off all UndoCmds that is above the active command from the UndoStack.

Calls the redo method for the active UndoCmd and sets the next UndoCmd as the new active one.

Calling this method when the state is clean does nothing.

Calls the undo method for the active UndoCmd and sets the previous UndoCmd as the new active one.

Calling this method when there are no more commands to undo does nothing.