Struct undo::UndoGroup
[−]
[src]
pub struct UndoGroup<'a> { /* fields omitted */ }
A collection of UndoStack
s.
An UndoGroup
is useful when working with multiple UndoStack
s and only one of them should
be active at a given time, eg. a text editor with multiple documents opened. However, if only
a single stack is needed, it is easier to just use the UndoStack
directly.
Methods
impl<'a> UndoGroup<'a>
[src]
fn new() -> Self
Creates a new UndoGroup
.
fn with_capacity(capacity: usize) -> Self
Creates a new UndoGroup
with the specified capacity.
fn capacity(&self) -> usize
Returns the capacity of the UndoGroup
.
fn shrink_to_fit(&mut self)
Shrinks the capacity of the UndoGroup
as much as possible.
fn add(&mut self, stack: UndoStack<'a>) -> Uid
Adds an UndoStack
to the group and returns an unique id for this stack.
fn remove(&mut self, Uid: Uid) -> Option<UndoStack<'a>>
Removes the UndoStack
with the specified id and returns the stack.
Returns None
if the stack was not found.
fn set_active(&mut self, Uid: &Uid)
Sets the UndoStack
with the specified id as the current active one.
fn clear_active(&mut self)
Clears the current active UndoStack
.
fn is_clean(&self) -> Option<bool>
Calls is_clean
on the active UndoStack
, if there is one.
Returns None
if there is no active stack.
fn is_dirty(&self) -> Option<bool>
Calls is_dirty
on the active UndoStack
, if there is one.
Returns None
if there is no active stack.
fn push<T>(&mut self, cmd: T) where T: UndoCmd + 'a
Calls push
on the active UndoStack
, if there is one.
Does nothing if there is no active stack.
fn redo(&mut self)
Calls redo
on the active UndoStack
, if there is one.
Does nothing if there is no active stack.
fn undo(&mut self)
Calls undo
on the active UndoStack
, if there is one.
Does nothing if there is no active stack.