diff options
-rw-r--r-- | examples/pure/todos/Cargo.toml | 2 | ||||
-rw-r--r-- | pure/src/widget/checkbox.rs | 42 |
2 files changed, 42 insertions, 2 deletions
diff --git a/examples/pure/todos/Cargo.toml b/examples/pure/todos/Cargo.toml index fa14ff6a..217179e8 100644 --- a/examples/pure/todos/Cargo.toml +++ b/examples/pure/todos/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" publish = false [dependencies] -iced = { path = "../../..", features = ["async-std", "debug", "pure"] } +iced = { path = "../../..", features = ["async-std", "debug", "default_system_font", "pure"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/pure/src/widget/checkbox.rs b/pure/src/widget/checkbox.rs index 1cfe89a8..5352fad3 100644 --- a/pure/src/widget/checkbox.rs +++ b/pure/src/widget/checkbox.rs @@ -1,9 +1,11 @@ use crate::{Element, Tree, Widget}; +use iced_native::event::{self, Event}; use iced_native::layout::{self, Layout}; +use iced_native::mouse; use iced_native::renderer; use iced_native::text; -use iced_native::{Hasher, Length, Point, Rectangle}; +use iced_native::{Clipboard, Hasher, Length, Point, Rectangle, Shell}; use std::any::{self, Any}; @@ -46,6 +48,27 @@ where ) } + fn on_event( + &mut self, + _state: &mut Tree, + event: Event, + layout: Layout<'_>, + cursor_position: Point, + renderer: &Renderer, + clipboard: &mut dyn Clipboard, + shell: &mut Shell<'_, Message>, + ) -> event::Status { + <Self as iced_native::Widget<Message, Renderer>>::on_event( + self, + event, + layout, + cursor_position, + renderer, + clipboard, + shell, + ) + } + fn draw( &self, _tree: &Tree, @@ -65,6 +88,23 @@ where ) } + fn mouse_interaction( + &self, + _state: &Tree, + layout: Layout<'_>, + cursor_position: Point, + viewport: &Rectangle, + renderer: &Renderer, + ) -> mouse::Interaction { + <Self as iced_native::Widget<Message, Renderer>>::mouse_interaction( + self, + layout, + cursor_position, + viewport, + renderer, + ) + } + fn hash_layout(&self, state: &mut Hasher) { <Self as iced_native::Widget<Message, Renderer>>::hash_layout( self, state, |