Add Renderer::Defaults and style inheritance

This commit is contained in:
Héctor Ramón Jiménez 2019-12-30 12:14:26 +01:00
parent 89a6b8a9a1
commit 8caa66be27
32 changed files with 224 additions and 150 deletions

View file

@ -216,21 +216,19 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
let content = self.content.draw(
renderer,
layout.children().next().unwrap(),
cursor_position,
);
renderer.draw(
defaults,
layout.bounds(),
cursor_position,
self.on_press.is_none(),
self.state.is_pressed,
&self.style,
content,
&self.content,
layout.children().next().unwrap(),
)
}
@ -253,13 +251,16 @@ pub trait Renderer: crate::Renderer + Sized {
/// Draws a [`Button`].
///
/// [`Button`]: struct.Button.html
fn draw(
fn draw<Message>(
&mut self,
defaults: &Self::Defaults,
bounds: Rectangle,
cursor_position: Point,
is_disabled: bool,
is_pressed: bool,
style: &Self::Style,
content: Self::Output,
content: &Element<'_, Message, Self>,
content_layout: Layout<'_>,
) -> Self::Output;
}