mac.rs

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