Use Program API in todos example

This commit is contained in:
Héctor Ramón Jiménez 2024-03-17 17:57:24 +01:00
parent 80b544e548
commit 784fa80c0d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 46 additions and 42 deletions

View file

@ -32,7 +32,7 @@
use crate::application::{self, Application};
use crate::executor::{self, Executor};
use crate::window;
use crate::{Command, Element, Font, Result, Settings, Subscription};
use crate::{Command, Element, Font, Result, Settings, Size, Subscription};
use std::borrow::Cow;
@ -277,6 +277,20 @@ impl<P: Definition> Program<P> {
}
}
/// Sets the [`window::Settings::size`] of the [`Program`].
pub fn window_size(self, size: impl Into<Size>) -> Self {
Self {
settings: Settings {
window: window::Settings {
size: size.into(),
..self.settings.window
},
..self.settings
},
..self
}
}
/// Sets the [`window::Settings::transparent`] of the [`Program`].
pub fn transparent(self, transparent: bool) -> Self {
Self {