mac.rs

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