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
impl ShortcutRegistry
Sourcepub fn new(app: &mut App) -> Ref<ShortcutRegistry>
pub fn new(app: &mut App) -> Ref<ShortcutRegistry>
Creates an instance of ShortcutRegistry.
Sourcepub fn shortcuts(self: Handle<Self>, app: &App) -> ShortcutMap
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.
Sourcepub fn add_all(
self: Handle<Self>,
app: &mut App,
value: ShortcutMap,
) -> Ref<ShortcutRegistryEntry>
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:
ShortcutRegistryEntry::replace_all, a function used to replace the set of shortcuts associated with a particular entry.ShortcutRegistryEntry::dispose, a function used to remove the set of shortcuts associated with a particular entry.
Sourcepub fn of(app: &mut App, context: BuildContext) -> Handle<ShortcutRegistry>
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:
maybe_of, which is similar to this function, but will returnNoneif it doesn’t find aShortcutRegistrarancestor.
Sourcepub fn maybe_of(
app: &mut App,
context: BuildContext,
) -> Option<Handle<ShortcutRegistry>>
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
impl ChangeNotifier for ShortcutRegistry
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)
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)
removeListener that
work after super.removeListener go here.