Skip to main content

UndoHistoryController

Struct UndoHistoryController 

Source
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 the UndoHistory widget and allows control of the underlying history using an UndoHistoryController.

Implementations§

Source§

impl UndoHistoryController

Source

pub fn new(app: &mut App) -> Ref<UndoHistoryController>

Creates a controller for an UndoHistory widget.

Source

pub fn from_value( app: &mut App, value: UndoHistoryValue, ) -> Ref<UndoHistoryController>

Dart UndoHistoryController(value:).

Source

pub fn value(self: Handle<Self>, app: &App) -> &UndoHistoryValue

The current undo/redo capability.

Source

pub fn set_value(self: Handle<Self>, app: &mut App, new_value: UndoHistoryValue)

Setting this notifies listeners when the value differs.

Source

pub fn on_undo(self: Handle<Self>, app: &App) -> Handle<ChangeNotifierData>

Notifies listeners that undo has been called.

Source

pub fn on_redo(self: Handle<Self>, app: &App) -> Handle<ChangeNotifierData>

Notifies listeners that redo has been called.

Source

pub fn undo(self: Handle<Self>, app: &mut App)

Reverts the value on the stack to the previous value.

Source

pub fn redo(self: Handle<Self>, app: &mut App)

Updates the value on the stack to the next value.

Source

pub fn dispose(self: Handle<Self>, app: &mut App)

Discards any resources used by the object.

Source§

impl UndoHistoryController

Source

pub fn to_string(self: Handle<Self>, app: &App) -> String

Dart’s UndoHistoryController.toString, which it inherits from ValueNotifier<UndoHistoryValue>: the identity and the value.

Trait Implementations§

Source§

impl ChangeNotifier for UndoHistoryController

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

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)

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl Debug for UndoHistoryController

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>