mac.rs

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