Introduce Tag and State opaque types in iced_pure::widget::tree

This commit is contained in:
Héctor Ramón Jiménez 2022-02-16 15:44:50 +07:00
parent cff891833b
commit 35e9b75e41
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
16 changed files with 101 additions and 197 deletions

View file

@ -1,4 +1,5 @@
use crate::widget::{Tree, Widget};
use crate::widget::tree::{self, Tree};
use crate::widget::Widget;
use iced_native::event::{self, Event};
use iced_native::layout::{self, Layout};
@ -6,8 +7,6 @@ use iced_native::mouse;
use iced_native::renderer;
use iced_native::{Clipboard, Hasher, Length, Point, Rectangle, Shell};
use std::any::{self, Any};
pub struct Element<'a, Message, Renderer> {
widget: Box<dyn Widget<Message, Renderer> + 'a>,
}
@ -66,22 +65,22 @@ where
A: 'a,
B: 'a,
{
fn tag(&self) -> any::TypeId {
fn tag(&self) -> tree::Tag {
self.widget.tag()
}
fn state(&self) -> Box<dyn Any> {
fn state(&self) -> tree::State {
self.widget.state()
}
fn children(&self) -> Vec<Tree> {
self.widget.children()
}
fn diff(&self, tree: &mut Tree) {
self.widget.diff(tree)
}
fn children_state(&self) -> Vec<Tree> {
self.widget.children_state()
}
fn width(&self) -> Length {
self.widget.width()
}