Initial menu implementation

This commit is contained in:
Richard 2021-07-05 16:23:44 -03:00
parent 4994d34aba
commit 9fc5ad23ed
14 changed files with 487 additions and 8 deletions

View file

@ -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;

View 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 }
}
}