Remove `ButtonState`

This commit is contained in:
Héctor Ramón Jiménez 2020-04-30 04:54:49 +02:00
parent e55cd9652e
commit d8b9e03481
5 changed files with 1 additions and 28 deletions

View File

@ -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,
}

View File

@ -19,7 +19,6 @@ pub mod mouse;
mod align; mod align;
mod background; mod background;
mod button_state;
mod color; mod color;
mod font; mod font;
mod length; mod length;
@ -31,7 +30,6 @@ mod vector;
pub use align::{Align, HorizontalAlignment, VerticalAlignment}; pub use align::{Align, HorizontalAlignment, VerticalAlignment};
pub use background::Background; pub use background::Background;
pub use button_state::ButtonState;
pub use color::Color; pub use color::Color;
pub use font::Font; pub use font::Font;
pub use length::Length; pub use length::Length;

View File

@ -1,5 +1,3 @@
//! Map your system events into input events that the runtime can understand. //! Map your system events into input events that the runtime can understand.
pub mod keyboard; pub mod keyboard;
pub mod mouse; pub mod mouse;
pub use iced_core::ButtonState;

View File

@ -210,6 +210,3 @@ pub use runtime::{
Length, MouseCursor, Point, Rectangle, Size, Subscription, Vector, Length, MouseCursor, Point, Rectangle, Size, Subscription, Vector,
VerticalAlignment, VerticalAlignment,
}; };
#[cfg(not(target_arch = "wasm32"))]
pub use runtime::input::ButtonState;

View File

@ -5,7 +5,7 @@
use crate::{ use crate::{
input::{ input::{
keyboard::{self, KeyCode, ModifiersState}, keyboard::{self, KeyCode, ModifiersState},
mouse, ButtonState, mouse,
}, },
window, Event, Mode, MouseCursor, window, Event, Mode, MouseCursor,
}; };
@ -157,17 +157,6 @@ pub fn mouse_button(mouse_button: winit::event::MouseButton) -> mouse::Button {
} }
} }
/// Converts an `ElementState` from [`winit`] to an [`iced_native`] button state.
///
/// [`winit`]: https://github.com/rust-windowing/winit
/// [`iced_native`]: https://github.com/hecrj/iced/tree/master/native
pub fn button_state(element_state: winit::event::ElementState) -> ButtonState {
match element_state {
winit::event::ElementState::Pressed => ButtonState::Pressed,
winit::event::ElementState::Released => ButtonState::Released,
}
}
/// Converts some `ModifiersState` from [`winit`] to an [`iced_native`] /// Converts some `ModifiersState` from [`winit`] to an [`iced_native`]
/// modifiers state. /// modifiers state.
/// ///