pub struct UndoHistoryController { /* private fields */ }Expand description
A controller for the undo history, for example for an editable text field.
Whenever a change happens to the underlying value that the UndoHistory widget tracks,
that widget updates the value and the controller notifies its listeners.
Listeners can then read the can_undo and
can_redo properties of the value to discover whether
undo or redo are possible.
The controller also has undo and redo methods to modify
the undo history.
See also:
EditableText, which uses theUndoHistorywidget and allows control of the underlying history using anUndoHistoryController.
Implementations§
Source§impl UndoHistoryController
impl UndoHistoryController
Sourcepub fn new(app: &mut App) -> Ref<UndoHistoryController>
pub fn new(app: &mut App) -> Ref<UndoHistoryController>
Creates a controller for an UndoHistory widget.
Sourcepub fn from_value(
app: &mut App,
value: UndoHistoryValue,
) -> Ref<UndoHistoryController>
pub fn from_value( app: &mut App, value: UndoHistoryValue, ) -> Ref<UndoHistoryController>
Dart UndoHistoryController(value:).
Sourcepub fn value(self: Handle<Self>, app: &App) -> &UndoHistoryValue
pub fn value(self: Handle<Self>, app: &App) -> &UndoHistoryValue
The current undo/redo capability.
Sourcepub fn set_value(self: Handle<Self>, app: &mut App, new_value: UndoHistoryValue)
pub fn set_value(self: Handle<Self>, app: &mut App, new_value: UndoHistoryValue)
Setting this notifies listeners when the value differs.
Sourcepub fn on_undo(self: Handle<Self>, app: &App) -> Handle<ChangeNotifierData>
pub fn on_undo(self: Handle<Self>, app: &App) -> Handle<ChangeNotifierData>
Notifies listeners that undo has been called.
Sourcepub fn on_redo(self: Handle<Self>, app: &App) -> Handle<ChangeNotifierData>
pub fn on_redo(self: Handle<Self>, app: &App) -> Handle<ChangeNotifierData>
Notifies listeners that redo has been called.
Sourcepub fn undo(self: Handle<Self>, app: &mut App)
pub fn undo(self: Handle<Self>, app: &mut App)
Reverts the value on the stack to the previous value.
Trait Implementations§
Source§impl ChangeNotifier for UndoHistoryController
impl ChangeNotifier for UndoHistoryController
fn change_notifier_data(&self) -> &ChangeNotifierData
fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData
Source§fn will_add_listener(self: Handle<Self>, app: &mut App)
fn will_add_listener(self: Handle<Self>, app: &mut App)
Runs before the listener is stored. Dart overrides of
addListener that
work before super.addListener go here.Source§fn did_remove_listener(self: Handle<Self>, app: &mut App)
fn did_remove_listener(self: Handle<Self>, app: &mut App)
Runs after the listener is removed. Dart overrides of
removeListener that
work after super.removeListener go here.Auto Trait Implementations§
impl !RefUnwindSafe for UndoHistoryController
impl !Send for UndoHistoryController
impl !Sync for UndoHistoryController
impl !UnwindSafe for UndoHistoryController
impl Forget for UndoHistoryController
impl Freeze for UndoHistoryControllerwhere
*const u8 is !null: Freeze,
PhantomData<Option<Listener>>: Freeze,
*const RcInner<Cell<usize>> is !null: Freeze,
PhantomData<RcInner<Cell<usize>>>: Freeze,
NonZero<u32>: Freeze,
PhantomData<fn() -> ChangeNotifierData>: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
impl Move for UndoHistoryController
impl Unpin for UndoHistoryController
impl UnsafeUnpin for UndoHistoryControllerwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Option<Listener>>: UnsafeUnpin,
*const RcInner<Cell<usize>> is !null: UnsafeUnpin,
PhantomData<RcInner<Cell<usize>>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
PhantomData<fn() -> ChangeNotifierData>: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more