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::window::{Icon, Level, Position};
28use crate::Size;
2930pub use platform::PlatformSpecific;
31/// The window settings of an application.
32#[derive(Debug, Clone)]
33pub struct Settings {
34/// The initial logical dimensions of the window.
35pub size: Size,
3637/// The border area for the drag resize handle.
38pub resize_border: u32,
3940/// The initial position of the window.
41pub position: Position,
4243/// The minimum size of the window.
44pub min_size: Option<Size>,
4546/// The maximum size of the window.
47pub max_size: Option<Size>,
4849/// Whether the window should be visible or not.
50pub visible: bool,
5152/// Whether the window should be resizable or not.
53pub resizable: bool,
5455/// Whether the window should have a border, a title bar, etc. or not.
56pub decorations: bool,
5758/// Whether the window should be transparent.
59pub transparent: bool,
6061/// The window [`Level`].
62pub level: Level,
6364/// The icon of the window.
65pub icon: Option<Icon>,
6667/// Platform specific settings.
68pub platform_specific: PlatformSpecific,
6970/// Whether the window will close when the user requests it, e.g. when a user presses the
71 /// close button.
72 ///
73 /// This can be useful if you want to have some behavior that executes before the window is
74 /// actually destroyed. If you disable this, you must manually close the window with the
75 /// `window::close` command.
76 ///
77 /// By default this is enabled.
78pub exit_on_close_request: bool,
79}
8081impl Default for Settings {
82fn default() -> Settings {
83 Settings {
84 size: Size::new(1024.0, 768.0),
85 resize_border: 8,
86 position: Position::default(),
87 min_size: None,
88 max_size: None,
89 visible: true,
90 resizable: true,
91 decorations: true,
92 transparent: false,
93 level: Level::default(),
94 icon: None,
95 exit_on_close_request: true,
96 platform_specific: PlatformSpecific::default(),
97 }
98 }
99}