Skip to main content

UndoSupport

Trait UndoSupport 

Source
pub trait UndoSupport {
    // Required methods
    fn undo_widget_id(&self) -> UndoWidgetId;
    fn create_snapshot(&self) -> Box<dyn Any + Send>;
    fn restore_snapshot(&mut self, snapshot: &dyn Any) -> bool;
}
Expand description

Trait for widgets that support undo operations.

Widgets implement this trait to provide undo/redo functionality. The trait provides a standardized way to:

  1. Track widget identity for command association
  2. Create undo commands for state changes
  3. Restore state from undo/redo operations

Required Methods§

Source

fn undo_widget_id(&self) -> UndoWidgetId

Get the widget’s unique ID for undo tracking.

Source

fn create_snapshot(&self) -> Box<dyn Any + Send>

Create a snapshot of the current state for undo purposes.

This is used to create “before” state for operations.

Source

fn restore_snapshot(&mut self, snapshot: &dyn Any) -> bool

Restore state from a snapshot.

Returns true if the restore was successful.

Implementors§