use crate::core::types::Rect;
use crate::input::PlatformEvent;
pub use crate::platform::types::{CornerStyle, RgbaIcon, ResizeDirection};
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct WindowKey(pub String);
impl WindowKey {
pub fn new(s: impl Into<String>) -> Self { Self(s.into()) }
pub fn as_str(&self) -> &str { &self.0 }
}
impl From<&str> for WindowKey { fn from(s: &str) -> Self { Self(s.to_string()) } }
impl From<String> for WindowKey { fn from(s: String) -> Self { Self(s) } }
pub trait SoftwarePresenter: Send {
fn present(&mut self, pixels: &[u8], width: u32, height: u32);
fn resize(&mut self, width: u32, height: u32);
}
pub enum RawHandle {
RawWindowHandle(Box<dyn std::any::Any + Send + Sync>),
Canvas(Box<dyn std::any::Any + Send + Sync>),
CALayer(Box<dyn std::any::Any + Send + Sync>),
}
pub trait WindowProvider {
fn poll_events(&mut self) -> Vec<PlatformEvent>;
fn window_rect(&self) -> Rect;
fn scale_factor(&self) -> f64;
fn request_redraw(&mut self);
fn should_close(&self) -> bool;
fn raw_window_handle(&self) -> Option<RawHandle>;
fn drag_window(&mut self) {}
fn drag_resize_window(&mut self, _direction: ResizeDirection) {}
fn set_minimized(&mut self, _on: bool) {}
fn set_maximized(&mut self, _on: bool) {}
fn is_maximized(&self) -> bool { false }
fn request_close(&mut self) {}
fn set_window_icon(&mut self, _rgba: Option<RgbaIcon>) {}
fn set_title(&mut self, _title: &str) {}
fn set_visible(&mut self, _visible: bool) {}
fn create_software_presenter(&self) -> Option<Box<dyn SoftwarePresenter>> {
None
}
fn push_platform_event(&mut self, _ev: PlatformEvent) {}
}
pub trait WindowDecorations {
fn set_corner_style(&mut self, _style: CornerStyle) {}
fn set_border_color(&mut self, _color: Option<u32>) {}
fn set_shadow(&mut self, _on: bool) {}
}