1//! Configure your windows.
2#[cfg(target_os = "windows")]
3#[path = "settings/windows.rs"]
4mod platform;
56#[cfg(target_os = "macos")]
7#[path = "settings/macos.rs"]
8mod platform;
910#[cfg(target_os = "linux")]
11#[path = "settings/linux.rs"]
12mod platform;
1314#[cfg(target_arch = "wasm32")]
15#[path = "settings/wasm.rs"]
16mod platform;
1718#[cfg(not(any(
19 target_os = "windows",
20 target_os = "macos",
21 target_os = "linux",
22 target_arch = "wasm32"
23)))]
24#[path = "settings/other.rs"]
25mod platform;
2627use crate::Size;
28use crate::window::{Icon, Level, Position};
2930pub use platform::PlatformSpecific;
3132/// The window settings of an application.
33#[derive(Debug, Clone)]
34pub struct Settings {
35/// The initial logical dimensions of the window.
36pub size: Size,
3738/// Whether the window should start maximized.
39pub maximized: bool,
4041/// Whether the window should start fullscreen.
42pub fullscreen: bool,
4344/// The initial position of the window.
45pub position: Position,
4647/// The minimum size of the window.
48pub min_size: Option<Size>,
4950/// The maximum size of the window.
51pub max_size: Option<Size>,
5253/// Whether the window should be visible or not.
54pub visible: bool,
5556/// Whether the window should be resizable or not.
57pub resizable: bool,
5859/// Whether the window should have a border, a title bar, etc. or not.
60pub decorations: bool,
6162/// Whether the window should be transparent.
63pub transparent: bool,
6465/// The window [`Level`].
66pub level: Level,
6768/// The icon of the window.
69pub icon: Option<Icon>,
7071/// Platform specific settings.
72pub platform_specific: PlatformSpecific,
7374/// Whether the window will close when the user requests it, e.g. when a user presses the
75 /// close button.
76 ///
77 /// This can be useful if you want to have some behavior that executes before the window is
78 /// actually destroyed. If you disable this, you must manually close the window with the
79 /// `window::close` command.
80 ///
81 /// By default this is enabled.
82pub exit_on_close_request: bool,
83}
8485impl Default for Settings {
86fn default() -> Self {
87Self {
88 size: Size::new(1024.0, 768.0),
89 maximized: false,
90 fullscreen: false,
91 position: Position::default(),
92 min_size: None,
93 max_size: None,
94 visible: true,
95 resizable: true,
96 decorations: true,
97 transparent: false,
98 level: Level::default(),
99 icon: None,
100 exit_on_close_request: true,
101 platform_specific: PlatformSpecific::default(),
102 }
103 }
104}