From 1db11ba69a3183924a1f4cae91031f4c5051b6dc Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 11 Nov 2020 23:54:59 +0100 Subject: Introduce `event::Status` in `iced_native` --- native/src/event.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'native/src/event.rs') diff --git a/native/src/event.rs b/native/src/event.rs index 606a71d6..160b5ce7 100644 --- a/native/src/event.rs +++ b/native/src/event.rs @@ -1,3 +1,4 @@ +//! Handle events of a user interface. use crate::{keyboard, mouse, window}; /// A user interface event. @@ -6,7 +7,7 @@ use crate::{keyboard, mouse, window}; /// additional events, feel free to [open an issue] and share your use case!_ /// /// [open an issue]: https://github.com/hecrj/iced/issues -#[derive(PartialEq, Clone, Debug)] +#[derive(Debug, Clone, PartialEq)] pub enum Event { /// A keyboard event Keyboard(keyboard::Event), @@ -17,3 +18,23 @@ pub enum Event { /// A window event Window(window::Event), } + +/// The status of an [`Event`] after being processed by a [`UserInterface`]. +/// +/// [`Event`]: enum.Event.html +/// [`UserInterface`]: ../struct.UserInterface.html +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Status { + /// The [`Event`] was _NOT_ handled by any widget in the [`UserInterface`]. + /// + /// [`Event`]: enum.Event.html + /// [`UserInterface`]: ../struct.UserInterface.html + Ignored, + + /// The [`Event`] was handled and processed by a widget in the + /// [`UserInterface`]. + /// + /// [`Event`]: enum.Event.html + /// [`UserInterface`]: ../struct.UserInterface.html + Captured, +} -- cgit