xloop_types/
lib.rs

1pub extern crate raw_window_handle as raw;
2
3pub use xloop_event::*;
4
5mod win;
6pub use win::*;
7mod app;
8pub use app::*;
9mod evt;
10pub use evt::*;
11
12pub mod prelude {
13	pub use super::AppDelegate as _;
14	pub use super::AppHandle as _;
15	pub use super::AppProxy as _;
16	pub use super::AppRef as _;
17	pub use super::IntoEvt as _;
18	pub use super::Platform as _;
19	pub use super::WinDelegate as _;
20	pub use super::WinHandle as _;
21	pub use super::WinRef as _;
22}
23
24pub trait Platform: Sized + 'static {
25	type Error: std::error::Error;
26	type AppRef<'a>: AppRef<Self> + Copy;
27	type AppHandle: AppHandle<Self>;
28	type AppProxy: AppProxy;
29	type WinRef<'a>: WinRef<Self> + Copy;
30	type WinHandle: WinHandle<Self>;
31	type WinRaw: raw::HasWindowHandle + raw::HasDisplayHandle + Send + Sync;
32	type EvtMouse<'a>: IntoEvt<Self, EvtMouse>;
33	type EvtWheel<'a>: IntoEvt<Self, EvtWheel>;
34	type EvtKey<'a>: IntoEvt<Self, EvtKey>;
35	type EvtTouch<'a>: IntoEvt<Self, EvtTouch>;
36	type EvtCommit<'a>: IntoEvt<Self, EvtCommit>;
37	fn run(delegate: impl AppDelegate<Self>) -> Result<Option<Self::AppHandle>, Self::Error>;
38	fn win(key: impl AsRef<str>, delegate: impl WinDelegate<Self>) -> Result<Self::WinHandle, Self::Error>;
39	fn log(level: log::LevelFilter);
40	fn read(path: impl AsRef<std::path::Path>) -> impl std::future::Future<Output = Option<Vec<u8>>>;
41	// TODO 配置信息
42	// TODO delay 屏幕,菜单
43}