diff options
Diffstat (limited to 'native/src/input')
-rw-r--r-- | native/src/input/button_state.rs | 9 | ||||
-rw-r--r-- | native/src/input/keyboard.rs | 8 | ||||
-rw-r--r-- | native/src/input/keyboard/event.rs | 26 | ||||
-rw-r--r-- | native/src/input/keyboard/key_code.rs | 198 | ||||
-rw-r--r-- | native/src/input/keyboard/modifiers_state.rs | 15 | ||||
-rw-r--r-- | native/src/input/mouse.rs | 6 | ||||
-rw-r--r-- | native/src/input/mouse/button.rs | 15 | ||||
-rw-r--r-- | native/src/input/mouse/event.rs | 58 | ||||
-rw-r--r-- | native/src/input/touch.rs | 36 |
9 files changed, 0 insertions, 371 deletions
diff --git a/native/src/input/button_state.rs b/native/src/input/button_state.rs deleted file mode 100644 index 988043ba..00000000 --- a/native/src/input/button_state.rs +++ /dev/null @@ -1,9 +0,0 @@ -/// The state of a button. -#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)] -pub enum ButtonState { - /// The button is pressed. - Pressed, - - /// The button is __not__ pressed. - Released, -} diff --git a/native/src/input/keyboard.rs b/native/src/input/keyboard.rs deleted file mode 100644 index 432e75ba..00000000 --- a/native/src/input/keyboard.rs +++ /dev/null @@ -1,8 +0,0 @@ -//! Build keyboard events. -mod event; -mod key_code; -mod modifiers_state; - -pub use event::Event; -pub use key_code::KeyCode; -pub use modifiers_state::ModifiersState; diff --git a/native/src/input/keyboard/event.rs b/native/src/input/keyboard/event.rs deleted file mode 100644 index 862f30c4..00000000 --- a/native/src/input/keyboard/event.rs +++ /dev/null @@ -1,26 +0,0 @@ -use super::{KeyCode, ModifiersState}; -use crate::input::ButtonState; - -/// A keyboard event. -/// -/// _**Note:** This type is largely incomplete! If you need to track -/// additional events, feel free to [open an issue] and share your use case!_ -/// -/// [open an issue]: https://github.com/hecrj/iced/issues -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum Event { - /// A keyboard key was pressed or released. - Input { - /// The state of the key - state: ButtonState, - - /// The key identifier - key_code: KeyCode, - - /// The state of the modifier keys - modifiers: ModifiersState, - }, - - /// A unicode character was received. - CharacterReceived(char), -} diff --git a/native/src/input/keyboard/key_code.rs b/native/src/input/keyboard/key_code.rs deleted file mode 100644 index 26020a57..00000000 --- a/native/src/input/keyboard/key_code.rs +++ /dev/null @@ -1,198 +0,0 @@ -/// The symbolic name of a keyboard key. -/// -/// This is mostly the `KeyCode` type found in [`winit`]. -/// -/// [`winit`]: https://docs.rs/winit/0.20.0-alpha3/winit/ -#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)] -#[repr(u32)] -#[allow(missing_docs)] -pub enum KeyCode { - /// The '1' key over the letters. - Key1, - /// The '2' key over the letters. - Key2, - /// The '3' key over the letters. - Key3, - /// The '4' key over the letters. - Key4, - /// The '5' key over the letters. - Key5, - /// The '6' key over the letters. - Key6, - /// The '7' key over the letters. - Key7, - /// The '8' key over the letters. - Key8, - /// The '9' key over the letters. - Key9, - /// The '0' key over the 'O' and 'P' keys. - Key0, - - A, - B, - C, - D, - E, - F, - G, - H, - I, - J, - K, - L, - M, - N, - O, - P, - Q, - R, - S, - T, - U, - V, - W, - X, - Y, - Z, - - /// The Escape key, next to F1 - Escape, - - F1, - F2, - F3, - F4, - F5, - F6, - F7, - F8, - F9, - F10, - F11, - F12, - F13, - F14, - F15, - F16, - F17, - F18, - F19, - F20, - F21, - F22, - F23, - F24, - - /// Print Screen/SysRq - Snapshot, - /// Scroll Lock - Scroll, - /// Pause/Break key, next to Scroll lock - Pause, - - /// `Insert`, next to Backspace - Insert, - Home, - Delete, - End, - PageDown, - PageUp, - - Left, - Up, - Right, - Down, - - Backspace, - Enter, - Space, - - /// The "Compose" key on Linux - Compose, - - Caret, - - Numlock, - Numpad0, - Numpad1, - Numpad2, - Numpad3, - Numpad4, - Numpad5, - Numpad6, - Numpad7, - Numpad8, - Numpad9, - - AbntC1, - AbntC2, - Add, - Apostrophe, - Apps, - At, - Ax, - Backslash, - Calculator, - Capital, - Colon, - Comma, - Convert, - Decimal, - Divide, - Equals, - Grave, - Kana, - Kanji, - LAlt, - LBracket, - LControl, - LShift, - LWin, - Mail, - MediaSelect, - MediaStop, - Minus, - Multiply, - Mute, - MyComputer, - NavigateForward, // also called "Prior" - NavigateBackward, // also called "Next" - NextTrack, - NoConvert, - NumpadComma, - NumpadEnter, - NumpadEquals, - OEM102, - Period, - PlayPause, - Power, - PrevTrack, - RAlt, - RBracket, - RControl, - RShift, - RWin, - Semicolon, - Slash, - Sleep, - Stop, - Subtract, - Sysrq, - Tab, - Underline, - Unlabeled, - VolumeDown, - VolumeUp, - Wake, - WebBack, - WebFavorites, - WebForward, - WebHome, - WebRefresh, - WebSearch, - WebStop, - Yen, - Copy, - Paste, - Cut, -} diff --git a/native/src/input/keyboard/modifiers_state.rs b/native/src/input/keyboard/modifiers_state.rs deleted file mode 100644 index 4e3794b3..00000000 --- a/native/src/input/keyboard/modifiers_state.rs +++ /dev/null @@ -1,15 +0,0 @@ -/// The current state of the keyboard modifiers. -#[derive(Debug, Clone, Copy, PartialEq)] -pub struct ModifiersState { - /// Whether a shift key is pressed - pub shift: bool, - - /// Whether a control key is pressed - pub control: bool, - - /// Whether an alt key is pressed - pub alt: bool, - - /// Whether a logo key is pressed (e.g. windows key, command key...) - pub logo: bool, -} diff --git a/native/src/input/mouse.rs b/native/src/input/mouse.rs deleted file mode 100644 index 69dc6b4c..00000000 --- a/native/src/input/mouse.rs +++ /dev/null @@ -1,6 +0,0 @@ -//! Build mouse events. -mod button; -mod event; - -pub use button::Button; -pub use event::{Event, ScrollDelta}; diff --git a/native/src/input/mouse/button.rs b/native/src/input/mouse/button.rs deleted file mode 100644 index aeb8a55d..00000000 --- a/native/src/input/mouse/button.rs +++ /dev/null @@ -1,15 +0,0 @@ -/// The button of a mouse. -#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)] -pub enum Button { - /// The left mouse button. - Left, - - /// The right mouse button. - Right, - - /// The middle (wheel) button. - Middle, - - /// Some other button. - Other(u8), -} diff --git a/native/src/input/mouse/event.rs b/native/src/input/mouse/event.rs deleted file mode 100644 index 5068d634..00000000 --- a/native/src/input/mouse/event.rs +++ /dev/null @@ -1,58 +0,0 @@ -use super::Button; -use crate::{input::ButtonState, Point}; - -/// A mouse event. -/// -/// _**Note:** This type is largely incomplete! If you need to track -/// additional events, feel free to [open an issue] and share your use case!_ -/// -/// [open an issue]: https://github.com/hecrj/iced/issues -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum Event { - /// The mouse cursor entered the window. - CursorEntered, - - /// The mouse cursor left the window. - CursorLeft, - - /// The mouse cursor was moved - CursorMoved { - /// The new position of the mouse cursor - position: Point, - }, - - /// A mouse button was pressed or released. - Input { - /// The state of the button - state: ButtonState, - - /// The button identifier - button: Button, - }, - - /// The mouse wheel was scrolled. - WheelScrolled { - /// The scroll movement. - delta: ScrollDelta, - }, -} - -/// A scroll movement. -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum ScrollDelta { - /// A line-based scroll movement - Lines { - /// The number of horizontal lines scrolled - x: f32, - - /// The number of vertical lines scrolled - y: f32, - }, - /// A pixel-based scroll movement - Pixels { - /// The number of horizontal pixels scrolled - x: f32, - /// The number of vertical pixels scrolled - y: f32, - }, -} diff --git a/native/src/input/touch.rs b/native/src/input/touch.rs deleted file mode 100644 index ea879427..00000000 --- a/native/src/input/touch.rs +++ /dev/null @@ -1,36 +0,0 @@ -//! Build touch events. - -use crate::Point; - -/// A touch interaction. -#[derive(Debug, Clone, Copy, PartialEq)] -pub struct Touch { - /// The finger of the touch. - pub finger: Finger, - - /// The position of the touch. - pub position: Point, - - /// The state of the touch. - pub phase: Phase, -} - -/// A unique identifier representing a finger on a touch interaction. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct Finger(pub u64); - -/// The state of a touch interaction. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum Phase { - /// A touch interaction was started. - Started, - - /// An on-going touch interaction was moved. - Moved, - - /// A touch interaction was ended. - Ended, - - /// A touch interaction was canceled. - Canceled, -} |