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/todos/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/todos/src/main.rs') diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 6ad7b4fb..04c8f618 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -164,7 +164,7 @@ impl Application for Todos { } } Message::ToggleFullscreen(mode) => { - window::change_mode(mode) + window::change_mode(window::Id::MAIN, mode) } _ => Command::none(), }; -- cgit From 67408311f45d341509538f8cc185978da66b6ace Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 30 Nov 2023 23:40:33 +0100 Subject: Use actual floats for logical coordinates --- examples/todos/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/todos/src/main.rs') diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index a7ba69b9..4dac032c 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -8,7 +8,7 @@ use iced::widget::{ }; use iced::window; use iced::{Application, Element}; -use iced::{Color, Command, Length, Settings, Subscription}; +use iced::{Color, Command, Length, Settings, Size, Subscription}; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; @@ -22,7 +22,7 @@ pub fn main() -> iced::Result { Todos::run(Settings { window: window::Settings { - size: (500, 800), + size: Size::new(500.0, 800.0), ..window::Settings::default() }, ..Settings::default() -- cgit From e710e7694907fe320e0a849e880c51952e6e748f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 9 Jan 2024 06:44:15 +0100 Subject: Fix `size_hint` for `keyed_column` --- examples/todos/src/main.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'examples/todos/src/main.rs') diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 4dac032c..aad47c20 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -254,13 +254,7 @@ impl Application for Todos { .spacing(20) .max_width(800); - scrollable( - container(content) - .width(Length::Fill) - .padding(40) - .center_x(), - ) - .into() + scrollable(container(content).padding(40).center_x()).into() } } } @@ -472,7 +466,6 @@ fn empty_message(message: &str) -> Element<'_, Message> { .horizontal_alignment(alignment::Horizontal::Center) .style(Color::from([0.7, 0.7, 0.7])), ) - .width(Length::Fill) .height(200) .center_y() .into() -- 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/todos/src/main.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'examples/todos/src/main.rs') diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index aad47c20..3d79f087 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -260,15 +260,21 @@ impl Application for Todos { } fn subscription(&self) -> Subscription { - keyboard::on_key_press(|key_code, modifiers| { - match (key_code, modifiers) { - (keyboard::KeyCode::Tab, _) => Some(Message::TabPressed { + use keyboard::key; + + keyboard::on_key_press(|key, modifiers| { + let keyboard::Key::Named(key) = key else { + return None; + }; + + match (key, modifiers) { + (key::Named::Tab, _) => Some(Message::TabPressed { shift: modifiers.shift(), }), - (keyboard::KeyCode::Up, keyboard::Modifiers::SHIFT) => { + (key::Named::ArrowUp, keyboard::Modifiers::SHIFT) => { Some(Message::ToggleFullscreen(window::Mode::Fullscreen)) } - (keyboard::KeyCode::Down, keyboard::Modifiers::SHIFT) => { + (key::Named::ArrowDown, keyboard::Modifiers::SHIFT) => { Some(Message::ToggleFullscreen(window::Mode::Windowed)) } _ => None, -- cgit