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};
16use std::{rc::Rc, sync::Arc};
17use window::Window;
18
19pub(crate) fn platform() -> Arc<dyn super::Platform> {
20    Arc::new(MacPlatform::new())
21}
22
23pub(crate) fn foreground_platform() -> Rc<dyn super::ForegroundPlatform> {
24    Rc::new(MacForegroundPlatform::default())
25}
26
27trait BoolExt {
28    fn to_objc(self) -> BOOL;
29}
30
31impl BoolExt for bool {
32    fn to_objc(self) -> BOOL {
33        if self {
34            YES
35        } else {
36            NO
37        }
38    }
39}