From 6820eea9cee75922f33ce7050e0e868f0749c83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Thu, 9 Jul 2020 06:29:54 +0200 Subject: [PATCH] Simplify style of `pane_grid` example --- examples/pane_grid/src/main.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs index cc4a45af..09c33613 100644 --- a/examples/pane_grid/src/main.rs +++ b/examples/pane_grid/src/main.rs @@ -97,16 +97,15 @@ impl Sandbox for Example { let pane_grid = PaneGrid::new(&mut self.panes, |pane, content, focus| { + let is_focused = focus.is_some(); let title_bar = pane_grid::TitleBar::new(format!("Pane {}", content.id)) .padding(10) - .style(style::TitleBar { focus }); + .style(style::TitleBar { is_focused }); pane_grid::Content::new(content.view(pane, total_panes)) .title_bar(title_bar) - .style(style::Pane { - is_focused: focus.is_some(), - }) + .style(style::Pane { is_focused }) }) .width(Length::Fill) .height(Length::Fill) @@ -229,7 +228,7 @@ impl Content { } mod style { - use iced::{button, container, pane_grid, Background, Color, Vector}; + use iced::{button, container, Background, Color, Vector}; const SURFACE: Color = Color::from_rgb( 0xF2 as f32 / 255.0, @@ -250,13 +249,13 @@ mod style { ); pub struct TitleBar { - pub focus: Option, + pub is_focused: bool, } impl container::StyleSheet for TitleBar { fn style(&self) -> container::Style { let pane = Pane { - is_focused: self.focus.is_some(), + is_focused: self.is_focused, } .style();