From 7ab6ed7ef912011318e07533e40fc98f4a846511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 10 Jan 2020 01:28:45 +0100 Subject: [PATCH] Add `window::Event::Resized` to `iced_native` --- native/src/event.rs | 8 +++++++- native/src/lib.rs | 1 + native/src/window.rs | 4 ++++ native/src/window/event.rs | 12 ++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 native/src/window.rs create mode 100644 native/src/window/event.rs diff --git a/native/src/event.rs b/native/src/event.rs index 71f06006..1d28aa7b 100644 --- a/native/src/event.rs +++ b/native/src/event.rs @@ -1,4 +1,7 @@ -use crate::input::{keyboard, mouse}; +use crate::{ + input::{keyboard, mouse}, + window, +}; /// A user interface event. /// @@ -13,4 +16,7 @@ pub enum Event { /// A mouse event Mouse(mouse::Event), + + /// A window event + Window(window::Event), } diff --git a/native/src/lib.rs b/native/src/lib.rs index 8dcacb2b..e65c6596 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -44,6 +44,7 @@ pub mod layout; pub mod renderer; pub mod subscription; pub mod widget; +pub mod window; mod clipboard; mod element; diff --git a/native/src/window.rs b/native/src/window.rs new file mode 100644 index 00000000..220bb3be --- /dev/null +++ b/native/src/window.rs @@ -0,0 +1,4 @@ +//! Build window-based GUI applications. +mod event; + +pub use event::Event; diff --git a/native/src/window/event.rs b/native/src/window/event.rs new file mode 100644 index 00000000..89ec0a0c --- /dev/null +++ b/native/src/window/event.rs @@ -0,0 +1,12 @@ +/// A window-related event. +#[derive(PartialEq, Clone, Copy, Debug)] +pub enum Event { + /// A window was resized + Resized { + /// The new width of the window (in units) + width: u32, + + /// The new height of the window (in units) + height: u32, + }, +}