1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
mod button_event_handler_entry;
mod conditional_hook;
mod hotkey;
mod hotkey_info;
mod mouse_event_handler_entry;
pub use button_event_handler_entry::ButtonEventHandlerEntry;
pub use conditional_hook::ConditionalHotkey;
pub use hotkey::Hotkey;
pub use mouse_event_handler_entry::{MouseCursorHotKeyEntry, MouseWheelHotkeyEntry};
use crate::button::ButtonSet;
/// Selecting the target of the hook.
pub trait SelectHandleTarget {
/// 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(&self, button: impl Into<ButtonSet>) -> ButtonEventHandlerEntry;
/// 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_wheel(&self) -> MouseWheelHotkeyEntry;
/// 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"));
/// ```
///
fn bind_mouse_cursor(&self) -> MouseCursorHotKeyEntry;
/// 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."));
/// ```
fn add_modifiers(&self, modifiers: (&[ButtonSet], &[ButtonSet])) -> ConditionalHotkey;
}
/// Set whether the hook blocks events.
pub trait SetEventBlock {
/// Blocks the input event when the hook to be registered is enable.
///
/// # Example
///
/// ```
/// use hookmap::*;
/// let hotkey = Hotkey::new();
/// hotkey.block()
/// .bind(Button::A)
/// .on_press(|e| println!("{:?}", e));
/// ```
///
fn block(&self) -> ConditionalHotkey;
/// Do not block the input event when the hook to be registered is enable.
///
/// If any other enabled hook blocks the event, this function will be ignored.
///
/// # Example
///
/// ```
/// use hookmap::*;
/// let hotkey = Hotkey::new();
/// hotkey.unblock()
/// .bind(Button::A)
/// .on_press(|e| println!("{:?}", e));
/// ```
///
fn unblock(&self) -> ConditionalHotkey;
}