Initial menu implementation
This commit is contained in:
parent
4994d34aba
commit
9fc5ad23ed
14 changed files with 487 additions and 8 deletions
|
|
@ -1,8 +1,10 @@
|
|||
//! Reuse basic keyboard types.
|
||||
mod event;
|
||||
mod hotkey;
|
||||
mod key_code;
|
||||
mod modifiers;
|
||||
|
||||
pub use event::Event;
|
||||
pub use hotkey::Hotkey;
|
||||
pub use key_code::KeyCode;
|
||||
pub use modifiers::Modifiers;
|
||||
|
|
|
|||
18
core/src/keyboard/hotkey.rs
Normal file
18
core/src/keyboard/hotkey.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use crate::keyboard::{KeyCode, Modifiers};
|
||||
|
||||
/// Representation of a hotkey, consists on the combination of a [`KeyCode`] and [`Modifiers`].
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Hotkey {
|
||||
/// The key that represents this hotkey.
|
||||
pub key: KeyCode,
|
||||
|
||||
/// The list of modifiers that represents this hotkey.
|
||||
pub modifiers: Modifiers,
|
||||
}
|
||||
|
||||
impl Hotkey {
|
||||
/// Creates a new [`Hotkey`] with the given [`Modifiers`] and [`KeyCode`].
|
||||
pub fn new(modifiers: Modifiers, key: KeyCode) -> Self {
|
||||
Self { modifiers, key }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue