use super::{ColorsLinear, ThemeDraw, ThemeSize};
use crate::autoimpl;
use crate::config::{Config, WindowConfig};
use crate::draw::{DrawIface, DrawSharedImpl, color};
use crate::event::EventState;
use std::any::Any;
use std::cell::RefCell;
#[allow(unused)] use crate::event::EventCx;
#[autoimpl(for<T: trait + ?Sized> Box<T>)]
pub trait Theme<DS: DrawSharedImpl> {
type Window: Window;
type Draw<'a>: ThemeDraw
where
DS: 'a,
Self: 'a;
fn init(&mut self, config: &RefCell<Config>);
fn new_window(&mut self, config: &WindowConfig) -> Self::Window;
fn update_window(&mut self, window: &mut Self::Window, config: &WindowConfig) -> bool;
fn draw<'a>(
&'a self,
draw: DrawIface<'a, DS>,
ev: &'a mut EventState,
window: &'a mut Self::Window,
) -> Self::Draw<'a>;
fn draw_upcast<'a>(
draw: DrawIface<'a, DS>,
ev: &'a mut EventState,
w: &'a mut Self::Window,
cols: &'a ColorsLinear,
) -> Self::Draw<'a>;
fn clear_color(&self) -> color::Rgba;
}
#[autoimpl(for<T: trait + ?Sized> Box<T>)]
pub trait Window: 'static {
fn size(&self) -> &dyn ThemeSize;
fn as_any_mut(&mut self) -> &mut dyn Any;
}