diff options
author | 2024-10-25 19:28:18 +0200 | |
---|---|---|
committer | 2024-11-05 23:52:58 +0100 | |
commit | dcc184b01b753dbecb500205391f6eaaa21c8683 (patch) | |
tree | 9f1854261c3b3805e28f524df65487c09c9729f7 /widget/src/checkbox.rs | |
parent | 752403d70c851ece620c4007710062b158e8dec3 (diff) | |
download | iced-dcc184b01b753dbecb500205391f6eaaa21c8683.tar.gz iced-dcc184b01b753dbecb500205391f6eaaa21c8683.tar.bz2 iced-dcc184b01b753dbecb500205391f6eaaa21c8683.zip |
Replace `event::Status` in `Widget::on_event` with `Shell::capture_event`
Diffstat (limited to 'widget/src/checkbox.rs')
-rw-r--r-- | widget/src/checkbox.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs index 6c5d7d6b..9b5f3602 100644 --- a/widget/src/checkbox.rs +++ b/widget/src/checkbox.rs @@ -31,7 +31,6 @@ //! ``` //!  use crate::core::alignment; -use crate::core::event::{self, Event}; use crate::core::layout; use crate::core::mouse; use crate::core::renderer; @@ -42,8 +41,8 @@ use crate::core::widget; use crate::core::widget::tree::{self, Tree}; use crate::core::window; use crate::core::{ - Background, Border, Clipboard, Color, Element, Layout, Length, Pixels, - Rectangle, Shell, Size, Theme, Widget, + Background, Border, Clipboard, Color, Element, Event, Layout, Length, + Pixels, Rectangle, Shell, Size, Theme, Widget, }; /// A box that can be checked. @@ -313,7 +312,7 @@ where _clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, _viewport: &Rectangle, - ) -> event::Status { + ) { match event { Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) | Event::Touch(touch::Event::FingerPressed { .. }) => { @@ -322,7 +321,7 @@ where if mouse_over { if let Some(on_toggle) = &self.on_toggle { shell.publish((on_toggle)(!self.is_checked)); - return event::Status::Captured; + shell.capture_event(); } } } @@ -351,8 +350,6 @@ where { shell.request_redraw(); } - - event::Status::Ignored } fn mouse_interaction( |