Skip to main content

ShortcutRegistry

Struct ShortcutRegistry 

Source
pub struct ShortcutRegistry { /* private fields */ }
Expand description

A class used by ShortcutRegistrar that allows adding or removing shortcut bindings by descendants of the ShortcutRegistrar.

You can reach the nearest ShortcutRegistry using of and maybe_of.

The registry may be listened to (with add_listener / remove_listener) for change notifications when the registered shortcuts change. Change notifications take place after the current frame is drawn, so that widgets that are not descendants of the registry can listen to it.

Implementations§

Source§

impl ShortcutRegistry

Source

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

Creates an instance of ShortcutRegistry.

Source

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

Discards any resources used by this object.

Source

pub fn shortcuts(self: Handle<Self>, app: &App) -> ShortcutMap

Gets the combined shortcut bindings from all contexts that are registered with this ShortcutRegistry.

Listeners will be notified when the value returned by this getter changes.

Returns a copy: modifying the returned map will have no effect.

Source

pub fn add_all( self: Handle<Self>, app: &mut App, value: ShortcutMap, ) -> Ref<ShortcutRegistryEntry>

Adds all the given shortcut bindings to this ShortcutRegistry, and returns an entry for managing those bindings.

ShortcutRegistryEntry::dispose should be called on the entry when these shortcuts are no longer needed. This will remove them from the registry, and invalidate the entry.

If two equivalent, but different, ShortcutActivators are added, all of them will be executed when triggered.

See also:

Source

pub fn of(app: &mut App, context: BuildContext) -> Handle<ShortcutRegistry>

Returns the ShortcutRegistry that belongs to the ShortcutRegistrar which most tightly encloses the given BuildContext.

If no ShortcutRegistrar widget encloses the context given, of panics.

See also:

Source

pub fn maybe_of( app: &mut App, context: BuildContext, ) -> Option<Handle<ShortcutRegistry>>

Returns the ShortcutRegistry of the ShortcutRegistrar that most tightly encloses the given BuildContext.

If no ShortcutRegistrar widget encloses the given context, maybe_of will return None.

Trait Implementations§

Source§

impl ChangeNotifier for ShortcutRegistry

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.

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>