Trait egui_keybind::Bind
source · pub trait Bind: Clone {
// Required methods
fn set(
&mut self,
keyboard: Option<KeyboardShortcut>,
pointer: Option<PointerButton>
);
fn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String;
fn pressed(&self, input: &mut InputState) -> bool;
}
Expand description
Required Methods§
sourcefn set(
&mut self,
keyboard: Option<KeyboardShortcut>,
pointer: Option<PointerButton>
)
fn set( &mut self, keyboard: Option<KeyboardShortcut>, pointer: Option<PointerButton> )
Set the keybind with a given KeyboardShortcut and/or PointerButton.
§Arguments
keyboard
- The keyboard shortcut to set (KeyboardShortcut), or None.pointer
- The pointer button to set (PointerButton), or None.
sourcefn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String
fn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String
Format the current keybind as a String.
§Arguments
names
- The ModifierNames to use.is_mac
- Whether to use MacOS symbols.
§Returns
The formatted keybind as a String.
sourcefn pressed(&self, input: &mut InputState) -> bool
fn pressed(&self, input: &mut InputState) -> bool
Check if the keybind is pressed.
§Arguments
input
- The InputState to check with.
§Returns
Whether the keybind is pressed.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl Bind for Option<PointerButton>
impl Bind for Option<PointerButton>
fn set( &mut self, _keyboard: Option<KeyboardShortcut>, pointer: Option<PointerButton> )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
source§impl Bind for Option<Key>
impl Bind for Option<Key>
fn set( &mut self, keyboard: Option<KeyboardShortcut>, _pointer: Option<PointerButton> )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
source§impl Bind for Option<KeyboardShortcut>
impl Bind for Option<KeyboardShortcut>
fn set( &mut self, keyboard: Option<KeyboardShortcut>, _pointer: Option<PointerButton> )
fn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
source§impl Bind for PointerButton
impl Bind for PointerButton
A Bind implementation for egui’s PointerButton. Ignores keys and modifiers.
fn set( &mut self, _keyboard: Option<KeyboardShortcut>, pointer: Option<PointerButton> )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
source§impl Bind for Key
impl Bind for Key
fn set( &mut self, keyboard: Option<KeyboardShortcut>, _pointer: Option<PointerButton> )
fn format(&self, _names: &ModifierNames<'_>, _is_mac: bool) -> String
fn pressed(&self, input: &mut InputState) -> bool
source§impl Bind for KeyboardShortcut
impl Bind for KeyboardShortcut
A Bind implementation for egui’s KeyboardShortcut.