pub struct MenuAcceleratorCallbackBinding {
pub key: Option<KeyRef>,
pub on_invoke: Option<Listener>,
pub has_submenu: bool,
pub child: WidgetRef,
}Expand description
An InheritedWidget that provides a descendant MenuAcceleratorLabel with
the function to invoke when the accelerator is pressed.
This is used when creating your own custom menu item for use with
MenuAnchor or MenuBar. Provided menu items such as MenuItemButton and
SubmenuButton already supply this wrapper internally.
Fields§
§key: Option<KeyRef>See Widget::key.
on_invoke: Option<Listener>The function that pressing the accelerator defined in a descendant
MenuAcceleratorLabel will invoke.
If set to null, then the accelerator won’t be enabled.
Whether or not the associated label will host its own submenu or not.
This setting determines when accelerators are active, since accelerators for menu items that open submenus shouldn’t be active when the submenu is open.
child: WidgetRefThe widget below this widget in the tree.
Implementations§
Source§impl MenuAcceleratorCallbackBinding
impl MenuAcceleratorCallbackBinding
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> MenuAcceleratorCallbackBinding
pub fn new<K>(child: impl IntoWidget<K>) -> MenuAcceleratorCallbackBinding
Create a const MenuAcceleratorCallbackBinding.
The child parameter is required.
Sourcepub fn key(self, key: KeyRef) -> MenuAcceleratorCallbackBinding
pub fn key(self, key: KeyRef) -> MenuAcceleratorCallbackBinding
Dart MenuAcceleratorCallbackBinding(key:).
Sourcepub fn on_invoke(self, on_invoke: Listener) -> MenuAcceleratorCallbackBinding
pub fn on_invoke(self, on_invoke: Listener) -> MenuAcceleratorCallbackBinding
Dart MenuAcceleratorCallbackBinding(onInvoke:).
Dart MenuAcceleratorCallbackBinding(hasSubmenu:).
Sourcepub fn maybe_of(
app: &mut App,
context: BuildContext,
) -> Option<MenuAcceleratorCallbackBinding>
pub fn maybe_of( app: &mut App, context: BuildContext, ) -> Option<MenuAcceleratorCallbackBinding>
Returns the active MenuAcceleratorCallbackBinding in the given context, if any,
and creates a dependency relationship that will rebuild the context when
on_invoke changes.
If no MenuAcceleratorCallbackBinding is found, returns null.
See also:
of, which is similar, but panics if noMenuAcceleratorCallbackBindingis found.
Sourcepub fn of(
app: &mut App,
context: BuildContext,
) -> MenuAcceleratorCallbackBinding
pub fn of( app: &mut App, context: BuildContext, ) -> MenuAcceleratorCallbackBinding
Returns the active MenuAcceleratorCallbackBinding in the given context, and
creates a dependency relationship that will rebuild the context when
on_invoke changes.
If no MenuAcceleratorCallbackBinding is found, this panics.
See also:
maybe_of, which is similar, but returns null if noMenuAcceleratorCallbackBindingis found.
Trait Implementations§
Source§impl InheritedWidget for MenuAcceleratorCallbackBinding
impl InheritedWidget for MenuAcceleratorCallbackBinding
Source§fn update_should_notify(
&self,
old_widget: &MenuAcceleratorCallbackBinding,
) -> bool
fn update_should_notify( &self, old_widget: &MenuAcceleratorCallbackBinding, ) -> bool
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn as_inherited_theme(&self) -> Option<&(dyn InheritedTheme + 'static)>
fn as_inherited_theme(&self) -> Option<&(dyn InheritedTheme + 'static)>
this is InheritedTheme: an inherited widget that is an InheritedTheme
answers with itself, which is what InheritedTheme::capture collects.Auto Trait Implementations§
impl !RefUnwindSafe for MenuAcceleratorCallbackBinding
impl !Send for MenuAcceleratorCallbackBinding
impl !Sync for MenuAcceleratorCallbackBinding
impl !UnwindSafe for MenuAcceleratorCallbackBinding
impl Forget for MenuAcceleratorCallbackBinding
impl Freeze for MenuAcceleratorCallbackBindingwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl Move for MenuAcceleratorCallbackBinding
impl Unpin for MenuAcceleratorCallbackBinding
impl UnsafeUnpin for MenuAcceleratorCallbackBindingwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<W> IntoWidget<InheritedKind> for Wwhere
W: InheritedWidget,
impl<W> IntoWidget<InheritedKind> for Wwhere
W: InheritedWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.