diff options
author | 2021-07-05 16:23:44 -0300 | |
---|---|---|
committer | 2021-07-05 16:24:10 -0300 | |
commit | 9fc5ad23edca93553137100d167de7b69e88f785 (patch) | |
tree | b9244861c70ff0f1718aabd5fa6e9b835b3857d9 /core | |
parent | 4994d34abab3222f9a8fd7a9a3e63f969ca97ffc (diff) | |
download | iced-9fc5ad23edca93553137100d167de7b69e88f785.tar.gz iced-9fc5ad23edca93553137100d167de7b69e88f785.tar.bz2 iced-9fc5ad23edca93553137100d167de7b69e88f785.zip |
Initial menu implementation
Diffstat (limited to 'core')
-rw-r--r-- | core/src/keyboard.rs | 2 | ||||
-rw-r--r-- | core/src/keyboard/hotkey.rs | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/src/keyboard.rs b/core/src/keyboard.rs index 61e017ad..cb64701a 100644 --- a/core/src/keyboard.rs +++ b/core/src/keyboard.rs @@ -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; diff --git a/core/src/keyboard/hotkey.rs b/core/src/keyboard/hotkey.rs new file mode 100644 index 00000000..310ef286 --- /dev/null +++ b/core/src/keyboard/hotkey.rs @@ -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 } + } +} |