diff options
author | 2019-12-30 12:14:26 +0100 | |
---|---|---|
committer | 2019-12-30 12:14:26 +0100 | |
commit | 8caa66be2708b1c83e20d905d69902c2567c4692 (patch) | |
tree | ee18296fc3d32f24bca90f97fc6845d97f3e4c21 /native/src/widget/button.rs | |
parent | 89a6b8a9a173e767753ec777fd83c912c1be5ea3 (diff) | |
download | iced-8caa66be2708b1c83e20d905d69902c2567c4692.tar.gz iced-8caa66be2708b1c83e20d905d69902c2567c4692.tar.bz2 iced-8caa66be2708b1c83e20d905d69902c2567c4692.zip |
Add `Renderer::Defaults` and style inheritance
Diffstat (limited to 'native/src/widget/button.rs')
-rw-r--r-- | native/src/widget/button.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index 4a7187da..75ef2693 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -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; } |