Trait hookmap::interface::SelectHandleTarget [−][src]
pub trait SelectHandleTarget {
fn bind(&self, button: impl Into<ButtonSet>) -> ButtonEventHandlerEntry;
fn bind_all(&self) -> ButtonEventHandlerEntry;
fn remap(&self, button: impl Into<ButtonSet>) -> RemapEntry;
fn bind_mouse_wheel(&self) -> MouseWheelHotkeyEntry;
fn bind_mouse_cursor(&self) -> MouseCursorHotKeyEntry;
fn add_modifiers(
&self,
modifiers: (&[ButtonSet], &[ButtonSet])
) -> ConditionalHotkey;
}
Expand description
Selecting the target of the hook.
Required methods
fn bind(&self, button: impl Into<ButtonSet>) -> ButtonEventHandlerEntry
fn bind(&self, button: impl Into<ButtonSet>) -> ButtonEventHandlerEntry
Returns a ButtonEventHandlerEntry
for registering a hook to the button.
Example
use hookmap::*;
let hotkey = Hotkey::new();
hotkey.bind(Button::A)
.on_press(|_| println!("The A key has been pressed"));
fn bind_all(&self) -> ButtonEventHandlerEntry
fn bind_all(&self) -> ButtonEventHandlerEntry
Returns a ButtonEventHandlerEntry
for registering a hook to the every button.
Example
use hookmap::*;
let hotkey = Hotkey::new();
hotkey.bind_all()
.on_press(|_| println!("The A key has been pressed"));
fn remap(&self, button: impl Into<ButtonSet>) -> RemapEntry
fn remap(&self, button: impl Into<ButtonSet>) -> RemapEntry
Remap keys.
Example
use hookmap::*;
let hotkey = Hotkey::new();
hotkey.remap(Button::A).to(Button::B);
fn bind_mouse_wheel(&self) -> MouseWheelHotkeyEntry
fn bind_mouse_wheel(&self) -> MouseWheelHotkeyEntry
Returns a MouseWheelHotkeyEntry
for registering a hook to the mouse wheel.
Example
use hookmap::*;
let hotkey = Hotkey::new();
hotkey.bind_mouse_wheel()
.on_rotate(|e| println!("The mouse wheel rotated."));
fn bind_mouse_cursor(&self) -> MouseCursorHotKeyEntry
fn bind_mouse_cursor(&self) -> MouseCursorHotKeyEntry
Returns a MouseCursorHotKeyEntry
for registering a hook to the mouse wheel.
Example
use hookmap::*;
let hotkey = Hotkey::new();
hotkey.bind_mouse_cursor()
.on_move(|_| println!("The mouse cursor has moved"));
Add a modifier button to the hotkey to be registered.
Example
use hookmap::*;
let hotkey = Hotkey::new();
let modifier_shift = hotkey.add_modifiers((&[Button::LShift.into()], &[]));
modifier_shift.bind(Button::A)
.on_press(|_| println!("Pressed the A key while holding down the Shift key."));