xloop_types 0.1.2

core types for xloop.
Documentation
use super::Platform;
pub trait WinDelegate<P: Platform>: 'static {
	fn on_create(&self, _: P::WinRef<'_>) {}
	fn on_start(&self, _: P::WinRef<'_>) {} // visible
	fn on_resume(&self, _: P::WinRef<'_>) {} // gain focus

	fn on_pause(&self, _: P::WinRef<'_>) {} // covered by another lost focus
	fn on_stop(&self, _: P::WinRef<'_>) {} // no longer visible
	fn on_destroy(&self, _: P::WinRef<'_>) {}

	fn on_proxy(&self, _: P::WinRef<'_>, _: i64) {}

	fn on_resize(&self, _: P::WinRef<'_>, _size: (u32, u32)) {}

	fn on_mouse(&self, _: P::WinRef<'_>, _evt: P::EvtMouse<'_>) -> bool {
		false
	}
	fn on_touch(&self, _: P::WinRef<'_>, _evt: P::EvtTouch<'_>) -> bool {
		false
	}
	fn on_wheel(&self, _: P::WinRef<'_>, _evt: P::EvtWheel<'_>) -> bool {
		false
	}
	fn on_key(&self, _: P::WinRef<'_>, _evt: P::EvtKey<'_>) -> bool {
		false
	}
	fn on_commit(&self, _: P::WinRef<'_>, _evt: P::EvtCommit<'_>) -> bool {
		false
	}

	fn req_close(&self, _: P::WinRef<'_>) -> bool {
		true
	}
	fn req_draw(&self, _: P::WinRef<'_>, _nanos: i64) {}
}
pub trait WinRef<P: Platform> {
	fn raw(&self) -> Option<P::WinRaw>;
	fn size(&self) -> (u32, u32);
	fn density(&self) -> f32;
	fn fresh(&self, _: &str);
	fn close(&self);
	fn show(&self);
}
pub trait WinHandle<P: Platform>: Sized {
	fn with(&self, _: impl FnMut(P::WinRef<'_>));
}