diff options
author | 2024-01-16 13:28:00 +0100 | |
---|---|---|
committer | 2024-01-16 13:28:00 +0100 | |
commit | 64d1ce5532f55d152fa5819532a138da2dca1a39 (patch) | |
tree | 1a242bde122b5e715f2e980c5541353e2ae8b048 /widget/src/combo_box.rs | |
parent | 534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0 (diff) | |
download | iced-64d1ce5532f55d152fa5819532a138da2dca1a39.tar.gz iced-64d1ce5532f55d152fa5819532a138da2dca1a39.tar.bz2 iced-64d1ce5532f55d152fa5819532a138da2dca1a39.zip |
Refactor `KeyCode` into `Key` and `Location`
Diffstat (limited to 'widget/src/combo_box.rs')
-rw-r--r-- | widget/src/combo_box.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/widget/src/combo_box.rs b/widget/src/combo_box.rs index 1b2fa947..73beeac3 100644 --- a/widget/src/combo_box.rs +++ b/widget/src/combo_box.rs @@ -1,6 +1,7 @@ //! Display a dropdown list of searchable and selectable options. use crate::core::event::{self, Event}; use crate::core::keyboard; +use crate::core::keyboard::key; use crate::core::layout::{self, Layout}; use crate::core::mouse; use crate::core::overlay; @@ -436,14 +437,14 @@ where } if let Event::Keyboard(keyboard::Event::KeyPressed { - key_code, + key: keyboard::Key::Named(named_key), modifiers, .. }) = event { let shift_modifer = modifiers.shift(); - match (key_code, shift_modifer) { - (keyboard::KeyCode::Enter, _) => { + match (named_key, shift_modifer) { + (key::Named::Enter, _) => { if let Some(index) = &menu.hovered_option { if let Some(option) = state.filtered_options.options.get(*index) @@ -455,8 +456,7 @@ where event_status = event::Status::Captured; } - (keyboard::KeyCode::Up, _) - | (keyboard::KeyCode::Tab, true) => { + (key::Named::ArrowUp, _) | (key::Named::Tab, true) => { if let Some(index) = &mut menu.hovered_option { if *index == 0 { *index = state @@ -492,8 +492,8 @@ where event_status = event::Status::Captured; } - (keyboard::KeyCode::Down, _) - | (keyboard::KeyCode::Tab, false) + (key::Named::ArrowDown, _) + | (key::Named::Tab, false) if !modifiers.shift() => { if let Some(index) = &mut menu.hovered_option { |