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:
- Track widget identity for command association
- Create undo commands for state changes
- Restore state from undo/redo operations
Required Methods§
Sourcefn undo_widget_id(&self) -> UndoWidgetId
fn undo_widget_id(&self) -> UndoWidgetId
Get the widget’s unique ID for undo tracking.
Sourcefn create_snapshot(&self) -> Box<dyn Any + Send>
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.
Sourcefn restore_snapshot(&mut self, snapshot: &dyn Any) -> bool
fn restore_snapshot(&mut self, snapshot: &dyn Any) -> bool
Restore state from a snapshot.
Returns true if the restore was successful.