From 3334cf670b09ee2ef0d06c9005677e024050f121 Mon Sep 17 00:00:00 2001 From: ryankopf Date: Thu, 20 Jun 2024 00:40:37 -0500 Subject: [PATCH 1/2] feat: Add methods for window settings in Application This commit adds new methods to the `Application` struct for setting various window settings such as resizable, decorations, position, and level. These methods allow for more customization and control over the appearance and behavior of the application window. --- src/application.rs | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/application.rs b/src/application.rs index edca6e79e6..7b292e23c2 100644 --- a/src/application.rs +++ b/src/application.rs @@ -256,6 +256,50 @@ impl Application

{ } } + /// Sets the [`window::Settings::resizable`] of the [`Application`]. + pub fn resizable(self, resizable: bool) -> Self { + Self { + window: window::Settings { + resizable, + ..self.window + }, + ..self + } + } + + /// Sets the [`window::Settings::decorations`] of the [`Application`]. + pub fn decorations(self, decorations: bool) -> Self { + Self { + window: window::Settings { + decorations, + ..self.window + }, + ..self + } + } + + /// Sets the [`window::Settings::position`] of the [`Application`]. + pub fn position(self, position: window::Position) -> Self { + Self { + window: window::Settings { + position, + ..self.window + }, + ..self + } + } + + /// Sets the [`window::Settings::level`] of the [`Application`]. + pub fn level(self, level: window::Level) -> Self { + Self { + window: window::Settings { + level, + ..self.window + }, + ..self + } + } + /// Sets the [`Title`] of the [`Application`]. pub(crate) fn title( self, From 0785b334e79d8f973c96b86608823f54afdf93c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Thu, 20 Jun 2024 18:35:10 +0200 Subject: [PATCH 2/2] Add `window` method to `Application` --- src/application.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/application.rs b/src/application.rs index 7b292e23c2..5d16b40f3c 100644 --- a/src/application.rs +++ b/src/application.rs @@ -212,6 +212,13 @@ impl Application

{ self } + /// Sets the [`window::Settings`] of the [`Application`]. + /// + /// Overwrites any previous [`window::Settings`]. + pub fn window(self, window: window::Settings) -> Self { + Self { window, ..self } + } + /// Sets the [`window::Settings::position`] to [`window::Position::Centered`] in the [`Application`]. pub fn centered(self) -> Self { Self { @@ -288,7 +295,7 @@ impl Application

{ ..self } } - + /// Sets the [`window::Settings::level`] of the [`Application`]. pub fn level(self, level: window::Level) -> Self { Self {