diff options
author | 2021-11-29 16:22:01 +0700 | |
---|---|---|
committer | 2021-11-29 16:22:01 +0700 | |
commit | bbd9355450bc2df3a2c0e37cc900ba00b26255af (patch) | |
tree | a6cf758c934638e3dd9586781dfb62e1cf028572 /native/src/widget/button.rs | |
parent | f7792d89d64c39cdde9da030bec80fb6f461a0e3 (diff) | |
download | iced-bbd9355450bc2df3a2c0e37cc900ba00b26255af.tar.gz iced-bbd9355450bc2df3a2c0e37cc900ba00b26255af.tar.bz2 iced-bbd9355450bc2df3a2c0e37cc900ba00b26255af.zip |
Introduce `Shell` type in `iced_native`
Widgets now can invalidate the current layout of the application on demand.
Diffstat (limited to 'native/src/widget/button.rs')
-rw-r--r-- | native/src/widget/button.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index 1d785f35..686289e4 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -9,7 +9,7 @@ use crate::renderer; use crate::touch; use crate::{ Background, Clipboard, Color, Element, Hasher, Layout, Length, Padding, - Point, Rectangle, Vector, Widget, + Point, Rectangle, Shell, Vector, Widget, }; use std::hash::Hash; @@ -197,7 +197,7 @@ where cursor_position: Point, renderer: &Renderer, clipboard: &mut dyn Clipboard, - messages: &mut Vec<Message>, + shell: &mut Shell<'_, Message>, ) -> event::Status { if let event::Status::Captured = self.content.on_event( event.clone(), @@ -205,7 +205,7 @@ where cursor_position, renderer, clipboard, - messages, + shell, ) { return event::Status::Captured; } @@ -232,7 +232,7 @@ where self.state.is_pressed = false; if bounds.contains(cursor_position) { - messages.push(on_press); + shell.publish(on_press); } return event::Status::Captured; |