mac.rs

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