Struct ambient_ui_native::Hotkey
source · pub struct Hotkey {
pub hotkey: VirtualKeyCode,
pub hotkey_modifier: ModifiersState,
pub on_is_pressed_changed: Option<Arc<CbDebuggable<dyn Fn(bool) + Sync + Send + 'static>>>,
pub on_invoke: Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>,
pub content: Element,
}
Expand description
An element that will invoke a callback when a hotkey is pressed.
Fields§
§hotkey: VirtualKeyCode
The hotkey that will invoke the callback.
hotkey_modifier: ModifiersState
The keyboard modifiers for the hotkey.
on_is_pressed_changed: Option<Arc<CbDebuggable<dyn Fn(bool) + Sync + Send + 'static>>>
The callback that is invoked when the current state of the hotkey changes.
on_invoke: Arc<CbDebuggable<dyn Fn(&mut World) + Sync + Send + 'static>>
The callback that is invoked when the hotkey is pressed.
content: Element
What to render for this element.
Implementations§
source§impl Hotkey
impl Hotkey
sourcepub fn new(
hotkey: VirtualKeyCode,
on_invoke: impl Fn(&mut World) + Sync + Send + 'static,
content: Element
) -> Hotkey
pub fn new( hotkey: VirtualKeyCode, on_invoke: impl Fn(&mut World) + Sync + Send + 'static, content: Element ) -> Hotkey
Create a new Hotkey with the given content and callback.
sourcepub fn hotkey_modifier(self, hotkey_modifier: ModifiersState) -> Hotkey
pub fn hotkey_modifier(self, hotkey_modifier: ModifiersState) -> Hotkey
Set the keyboard modifiers for the hotkey.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Hotkey
impl Send for Hotkey
impl Sync for Hotkey
impl Unpin for Hotkey
impl !UnwindSafe for Hotkey
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
source§impl<T> ComponentValueBase for Twhere
T: Send + Sync + 'static,
impl<T> ComponentValueBase for Twhere T: Send + Sync + 'static,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> ElementComponentExt for Twhere
T: ElementComponent + 'static,
impl<T> ElementComponentExt for Twhere T: ElementComponent + 'static,
source§impl<T> ElementComponentName for T
impl<T> ElementComponentName for T
source§fn element_component_name(&self) -> &'static str
fn element_component_name(&self) -> &'static str
Returns the name of the type implementing ElementComponent.