Add Renderer and Primitive concepts
This commit is contained in:
parent
5204cc8c8b
commit
a7d1194403
15 changed files with 227 additions and 126 deletions
|
|
@ -2,7 +2,7 @@
|
|||
use std::hash::Hash;
|
||||
|
||||
use crate::input::{mouse, ButtonState};
|
||||
use crate::{Element, Event, Hasher, Layout, MouseCursor, Node, Point, Widget};
|
||||
use crate::{Element, Event, Hasher, Layout, Node, Point, Widget};
|
||||
|
||||
pub use iced_core::Checkbox;
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ where
|
|||
renderer: &mut Renderer,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
) -> MouseCursor {
|
||||
) -> Renderer::Primitive {
|
||||
renderer.draw(&self, layout, cursor_position)
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ where
|
|||
///
|
||||
/// [`Checkbox`]: struct.Checkbox.html
|
||||
/// [renderer]: ../../renderer/index.html
|
||||
pub trait Renderer {
|
||||
pub trait Renderer: crate::Renderer {
|
||||
/// Creates a [`Node`] for the provided [`Checkbox`].
|
||||
///
|
||||
/// [`Node`]: ../../struct.Node.html
|
||||
|
|
@ -80,7 +80,7 @@ pub trait Renderer {
|
|||
checkbox: &Checkbox<Message>,
|
||||
layout: Layout<'_>,
|
||||
cursor_position: Point,
|
||||
) -> MouseCursor;
|
||||
) -> Self::Primitive;
|
||||
}
|
||||
|
||||
impl<'a, Message, Renderer> From<Checkbox<Message>>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue