zed/crates/gpui/src/platform/mac.rs

41 lines
769 B
Rust
Raw Normal View History

mod atlas;
2022-08-29 16:00:51 +00:00
pub mod dispatcher;
mod event;
mod fonts;
2021-02-20 23:05:36 +00:00
mod geometry;
mod image_cache;
mod platform;
mod renderer;
mod sprite_cache;
2021-02-20 23:05:36 +00:00
mod window;
use cocoa::base::{BOOL, NO, YES};
pub use dispatcher::Dispatcher;
pub use fonts::FontSystem;
use platform::{MacForegroundPlatform, MacPlatform};
pub use renderer::Surface;
use std::{rc::Rc, sync::Arc};
2021-02-20 23:05:36 +00:00
use window::Window;
pub(crate) fn platform() -> Arc<dyn super::Platform> {
Arc::new(MacPlatform::new())
2021-02-20 23:05:36 +00:00
}
2021-04-02 21:26:53 +00:00
pub(crate) fn foreground_platform() -> Rc<dyn super::ForegroundPlatform> {
Rc::new(MacForegroundPlatform::default())
}
2021-02-20 23:05:36 +00:00
trait BoolExt {
fn to_objc(self) -> BOOL;
}
2021-02-20 23:05:36 +00:00
impl BoolExt for bool {
fn to_objc(self) -> BOOL {
if self {
YES
} else {
NO
}
}
}