mac.rs

 1mod atlas;
 2mod dispatcher;
 3mod event;
 4mod fonts;
 5mod geometry;
 6mod image_cache;
 7mod platform;
 8mod renderer;
 9mod sprite_cache;
10mod window;
11
12use cocoa::base::{BOOL, NO, YES};
13pub use dispatcher::Dispatcher;
14pub use fonts::FontSystem;
15use platform::{MacForegroundPlatform, MacPlatform};
16pub use renderer::Surface;
17use std::{rc::Rc, sync::Arc};
18use window::Window;
19
20pub(crate) fn platform() -> Arc<dyn super::Platform> {
21    Arc::new(MacPlatform::new())
22}
23
24pub(crate) fn foreground_platform() -> Rc<dyn super::ForegroundPlatform> {
25    Rc::new(MacForegroundPlatform::default())
26}
27
28trait BoolExt {
29    fn to_objc(self) -> BOOL;
30}
31
32impl BoolExt for bool {
33    fn to_objc(self) -> BOOL {
34        if self {
35            YES
36        } else {
37            NO
38        }
39    }
40}