Implement missing on_event and mouse_interaction for Checkbox in iced_pure
This commit is contained in:
parent
bd22cc0bc0
commit
4c61601aa3
2 changed files with 42 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[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 = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
use crate::{Element, Tree, Widget};
|
use crate::{Element, Tree, Widget};
|
||||||
|
|
||||||
|
use iced_native::event::{self, Event};
|
||||||
use iced_native::layout::{self, Layout};
|
use iced_native::layout::{self, Layout};
|
||||||
|
use iced_native::mouse;
|
||||||
use iced_native::renderer;
|
use iced_native::renderer;
|
||||||
use iced_native::text;
|
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};
|
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(
|
fn draw(
|
||||||
&self,
|
&self,
|
||||||
_tree: &Tree,
|
_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) {
|
fn hash_layout(&self, state: &mut Hasher) {
|
||||||
<Self as iced_native::Widget<Message, Renderer>>::hash_layout(
|
<Self as iced_native::Widget<Message, Renderer>>::hash_layout(
|
||||||
self, state,
|
self, state,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue