2023-05-25 23:14:07 +02:00
|
|
|
use crate::window::{Icon, Level, Position};
|
2020-07-01 06:09:39 +02:00
|
|
|
|
2023-07-12 19:21:05 -07:00
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
|
#[path = "settings/windows.rs"]
|
|
|
|
|
mod platform;
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
#[path = "settings/macos.rs"]
|
|
|
|
|
mod platform;
|
|
|
|
|
|
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
|
#[path = "settings/wasm.rs"]
|
|
|
|
|
mod platform;
|
|
|
|
|
|
|
|
|
|
#[cfg(not(any(
|
|
|
|
|
target_os = "windows",
|
|
|
|
|
target_os = "macos",
|
|
|
|
|
target_arch = "wasm32"
|
|
|
|
|
)))]
|
|
|
|
|
#[path = "settings/other.rs"]
|
|
|
|
|
mod platform;
|
|
|
|
|
|
|
|
|
|
pub use platform::PlatformSpecific;
|
2023-02-23 14:33:53 +01:00
|
|
|
|
2020-01-16 05:54:22 +01:00
|
|
|
/// The window settings of an application.
|
2020-07-01 06:09:39 +02:00
|
|
|
#[derive(Debug, Clone)]
|
2020-01-16 05:54:22 +01:00
|
|
|
pub struct Settings {
|
2020-06-25 00:32:41 +02:00
|
|
|
/// The initial size of the window.
|
2020-01-16 05:54:22 +01:00
|
|
|
pub size: (u32, u32),
|
|
|
|
|
|
2021-06-25 17:16:44 +02:00
|
|
|
/// The initial position of the window.
|
2021-07-21 18:59:24 +07:00
|
|
|
pub position: Position,
|
2021-06-25 17:16:44 +02:00
|
|
|
|
2020-06-25 00:32:41 +02:00
|
|
|
/// The minimum size of the window.
|
|
|
|
|
pub min_size: Option<(u32, u32)>,
|
|
|
|
|
|
|
|
|
|
/// The maximum size of the window.
|
|
|
|
|
pub max_size: Option<(u32, u32)>,
|
|
|
|
|
|
2022-07-18 18:37:41 +02:00
|
|
|
/// Whether the window should be visible or not.
|
|
|
|
|
pub visible: bool,
|
|
|
|
|
|
2020-01-16 05:54:22 +01:00
|
|
|
/// Whether the window should be resizable or not.
|
|
|
|
|
pub resizable: bool,
|
|
|
|
|
|
|
|
|
|
/// Whether the window should have a border, a title bar, etc. or not.
|
|
|
|
|
pub decorations: bool,
|
2020-04-11 15:16:10 +02:00
|
|
|
|
2020-09-28 21:05:15 -07:00
|
|
|
/// Whether the window should be transparent.
|
2020-08-17 15:38:02 +07:00
|
|
|
pub transparent: bool,
|
|
|
|
|
|
2023-05-25 23:14:07 +02:00
|
|
|
/// The window [`Level`].
|
|
|
|
|
pub level: Level,
|
2020-09-28 21:05:15 -07:00
|
|
|
|
2020-07-01 06:09:39 +02:00
|
|
|
/// The icon of the window.
|
|
|
|
|
pub icon: Option<Icon>,
|
2023-02-23 14:33:53 +01:00
|
|
|
|
|
|
|
|
/// Platform specific settings.
|
2023-03-14 11:22:06 +01:00
|
|
|
pub platform_specific: PlatformSpecific,
|
2020-01-16 05:54:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Default for Settings {
|
|
|
|
|
fn default() -> Settings {
|
|
|
|
|
Settings {
|
|
|
|
|
size: (1024, 768),
|
2021-07-21 18:59:24 +07:00
|
|
|
position: Position::default(),
|
2020-06-25 00:32:41 +02:00
|
|
|
min_size: None,
|
|
|
|
|
max_size: None,
|
2022-07-18 18:37:41 +02:00
|
|
|
visible: true,
|
2020-01-16 05:54:22 +01:00
|
|
|
resizable: true,
|
|
|
|
|
decorations: true,
|
2020-08-17 15:38:02 +07:00
|
|
|
transparent: false,
|
2023-05-25 23:14:07 +02:00
|
|
|
level: Level::default(),
|
2020-04-11 15:16:10 +02:00
|
|
|
icon: None,
|
2023-02-23 14:33:53 +01:00
|
|
|
platform_specific: Default::default(),
|
2020-01-16 05:54:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|