From d53ccc857da4d4cda769904342aeb5a82a64f146 Mon Sep 17 00:00:00 2001 From: Bingus Date: Wed, 12 Jul 2023 19:21:05 -0700 Subject: refactored window storage; new helper window events (Destroyed, Created); clippy + fmt; --- examples/toast/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/toast/src/main.rs') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 4282ddcf..e28c4236 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -528,7 +528,9 @@ mod toast { clipboard: &mut dyn Clipboard, shell: &mut Shell<'_, Message>, ) -> event::Status { - if let Event::Window(window::Event::RedrawRequested(now)) = &event { + if let Event::Window(_, window::Event::RedrawRequested(now)) = + &event + { let mut next_redraw: Option = None; self.instants.iter_mut().enumerate().for_each( -- cgit From f98627a317615151681ca8b324052eb4a170b789 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 12 Nov 2023 03:40:32 +0100 Subject: Add missing `'static` lifetimes to constant slices --- examples/toast/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/toast/src/main.rs') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 20c3dd42..5b089e8a 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -210,7 +210,7 @@ mod toast { } impl Status { - pub const ALL: &[Self] = + pub const ALL: &'static [Self] = &[Self::Primary, Self::Secondary, Self::Success, Self::Danger]; } -- cgit From 89e3de7c08dc07eefbcc2617f0da63282aa1c8ef Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 21 Nov 2023 18:55:53 +0100 Subject: Fix `modal` and `toast` examples --- examples/toast/src/main.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/toast/src/main.rs') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 5b089e8a..934049d5 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -511,6 +511,7 @@ mod toast { renderer: &Renderer, bounds: Size, position: Point, + _translation: Vector, ) -> layout::Node { let limits = layout::Limits::new(Size::ZERO, bounds) .width(Length::Fill) -- cgit From e819c2390bad76e811265245bd5fab63fc30a8b2 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 15 Dec 2023 13:15:44 +0100 Subject: Update `winit` to `0.29.4` --- examples/toast/src/main.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/toast/src/main.rs') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 31b6f191..e8317589 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -95,6 +95,7 @@ impl Application for App { Message::Event(Event::Keyboard(keyboard::Event::KeyPressed { key_code: keyboard::KeyCode::Tab, modifiers, + .. })) if modifiers.shift() => widget::focus_previous(), Message::Event(Event::Keyboard(keyboard::Event::KeyPressed { key_code: keyboard::KeyCode::Tab, -- cgit From 0655a20ad119e2e9790afcc45039fd4ac0e7d432 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 16 Mar 2023 20:23:25 +0100 Subject: Make `Shrink` have priority over `Fill` in layout --- examples/toast/src/main.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'examples/toast/src/main.rs') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 31b6f191..711d8223 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -106,9 +106,7 @@ impl Application for App { fn view<'a>(&'a self) -> Element<'a, Message> { let subtitle = |title, content: Element<'a, Message>| { - column![text(title).size(14), content] - .width(Length::Fill) - .spacing(5) + column![text(title).size(14), content].spacing(5) }; let mut add_toast = button("Add Toast"); @@ -153,14 +151,11 @@ impl Application for App { Message::Timeout ) .step(1.0) - .width(Length::Fill) ] .spacing(5) .into() ), - column![add_toast] - .width(Length::Fill) - .align_items(Alignment::End) + column![add_toast].align_items(Alignment::End) ] .spacing(10) .max_width(200), @@ -513,14 +508,14 @@ mod toast { position: Point, _translation: Vector, ) -> layout::Node { - let limits = layout::Limits::new(Size::ZERO, bounds) - .width(Length::Fill) - .height(Length::Fill); + let limits = layout::Limits::new(Size::ZERO, bounds); layout::flex::resolve( layout::flex::Axis::Vertical, renderer, &limits, + Length::Fill, + Length::Fill, 10.into(), 10.0, Alignment::End, -- cgit From d278bfd21d0399009e652560afb9a4d185e92637 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 5 Jan 2024 17:46:33 +0100 Subject: Replace `width` and `height` with `Widget::size` --- examples/toast/src/main.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'examples/toast/src/main.rs') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 711d8223..300343b9 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -313,12 +313,8 @@ mod toast { } impl<'a, Message> Widget for Manager<'a, Message> { - fn width(&self) -> Length { - self.content.as_widget().width() - } - - fn height(&self) -> Length { - self.content.as_widget().height() + fn size(&self) -> Size { + self.content.as_widget().size() } fn layout( -- cgit From 64d1ce5532f55d152fa5819532a138da2dca1a39 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 16 Jan 2024 13:28:00 +0100 Subject: Refactor `KeyCode` into `Key` and `Location` --- examples/toast/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/toast/src/main.rs') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 609f9087..2e837fa3 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -1,6 +1,7 @@ use iced::event::{self, Event}; use iced::executor; use iced::keyboard; +use iced::keyboard::key; use iced::widget::{ self, button, column, container, pick_list, row, slider, text, text_input, }; @@ -93,12 +94,12 @@ impl Application for App { Command::none() } Message::Event(Event::Keyboard(keyboard::Event::KeyPressed { - key_code: keyboard::KeyCode::Tab, + key: keyboard::Key::Named(key::Named::Tab), modifiers, .. })) if modifiers.shift() => widget::focus_previous(), Message::Event(Event::Keyboard(keyboard::Event::KeyPressed { - key_code: keyboard::KeyCode::Tab, + key: keyboard::Key::Named(key::Named::Tab), .. })) => widget::focus_next(), Message::Event(_) => Command::none(), -- cgit