use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct WindowConfig {
pub title: String,
pub icon: Option<PathBuf>,
pub size: (f64, f64),
pub min_size: Option<(f64, f64)>,
pub max_size: Option<(f64, f64)>,
pub resizable: bool,
pub decorations: bool,
pub always_on_top: bool,
pub position: Option<(i32, i32)>,
}
impl Default for WindowConfig {
fn default() -> Self {
Self {
title: "LieUI".to_string(),
icon: None,
size: (800.0, 600.0),
min_size: None,
max_size: None,
resizable: true,
decorations: true,
always_on_top: false,
position: None,
}
}
}
impl WindowConfig {
pub fn new() -> Self {
Self::default()
}
pub fn title(mut self, t: impl Into<String>) -> Self {
self.title = t.into();
self
}
pub fn icon(mut self, path: impl Into<PathBuf>) -> Self {
self.icon = Some(path.into());
self
}
pub fn size(mut self, w: f64, h: f64) -> Self {
self.size = (w, h);
self
}
pub fn min_size(mut self, w: f64, h: f64) -> Self {
self.min_size = Some((w, h));
self
}
pub fn max_size(mut self, w: f64, h: f64) -> Self {
self.max_size = Some((w, h));
self
}
pub fn resizable(mut self, v: bool) -> Self {
self.resizable = v;
self
}
pub fn decorations(mut self, v: bool) -> Self {
self.decorations = v;
self
}
pub fn always_on_top(mut self, v: bool) -> Self {
self.always_on_top = v;
self
}
pub fn position(mut self, x: i32, y: i32) -> Self {
self.position = Some((x, y));
self
}
}