diff options
Diffstat (limited to 'examples/pane_grid')
| -rw-r--r-- | examples/pane_grid/src/main.rs | 47 | 
1 files changed, 31 insertions, 16 deletions
| diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs index 8225e9e7..59e5f3f9 100644 --- a/examples/pane_grid/src/main.rs +++ b/examples/pane_grid/src/main.rs @@ -1,7 +1,13 @@ +use iced::alignment::{self, Alignment}; +use iced::button::{self, Button}; +use iced::executor; +use iced::keyboard; +use iced::pane_grid::{self, PaneGrid}; +use iced::responsive::{self, Responsive}; +use iced::scrollable::{self, Scrollable};  use iced::{ -    alignment, button, executor, keyboard, pane_grid, scrollable, Alignment, -    Application, Button, Color, Column, Command, Container, Element, Length, -    PaneGrid, Row, Scrollable, Settings, Subscription, Text, +    Application, Color, Column, Command, Container, Element, Length, Row, +    Settings, Size, Subscription, Text,  };  use iced_native::{event, subscription, Event}; @@ -154,17 +160,24 @@ impl Application for Example {          let pane_grid = PaneGrid::new(&mut self.panes, |id, pane| {              let is_focused = focus == Some(id); -            let text = if pane.is_pinned { "Unpin" } else { "Pin" }; -            let pin_button = -                Button::new(&mut pane.pin_button, Text::new(text).size(14)) -                    .on_press(Message::TogglePin(id)) -                    .style(style::Button::Pin) -                    .padding(3); +            let Pane { +                responsive, +                pin_button, +                is_pinned, +                content, +                .. +            } = pane; + +            let text = if *is_pinned { "Unpin" } else { "Pin" }; +            let pin_button = Button::new(pin_button, Text::new(text).size(14)) +                .on_press(Message::TogglePin(id)) +                .style(style::Button::Pin) +                .padding(3);              let title = Row::with_children(vec