From bbd9355450bc2df3a2c0e37cc900ba00b26255af Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 29 Nov 2021 16:22:01 +0700 Subject: Introduce `Shell` type in `iced_native` Widgets now can invalidate the current layout of the application on demand. --- native/src/widget/checkbox.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'native/src/widget/checkbox.rs') diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs index 81611426..2af2d60c 100644 --- a/native/src/widget/checkbox.rs +++ b/native/src/widget/checkbox.rs @@ -11,7 +11,7 @@ use crate::touch; use crate::widget::{self, Row, Text}; use crate::{ Alignment, Clipboard, Color, Element, Hasher, Layout, Length, Point, - Rectangle, Widget, + Rectangle, Shell, Widget, }; pub use iced_style::checkbox::{Style, StyleSheet}; @@ -171,7 +171,7 @@ where cursor_position: Point, _renderer: &Renderer, _clipboard: &mut dyn Clipboard, - messages: &mut Vec, + shell: &mut Shell<'_, Message>, ) -> event::Status { match event { Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) @@ -179,7 +179,7 @@ where let mouse_over = layout.bounds().contains(cursor_position); if mouse_over { - messages.push((self.on_toggle)(!self.is_checked)); + shell.publish((self.on_toggle)(!self.is_checked)); return event::Status::Captured; } -- cgit