Create an API for assigning the menubar contents

This commit is contained in:
Max Brunsfeld
2021-04-08 16:01:36 -07:00
parent 0a12774680
commit 334de06322
9 changed files with 216 additions and 60 deletions
+8
View File
@@ -2,6 +2,7 @@ use super::{BoolExt as _, Dispatcher, FontSystem, Window};
use crate::{executor, platform};
use anyhow::Result;
use cocoa::{appkit::NSApplication, base::nil};
use objc::{msg_send, sel, sel_impl};
use std::{rc::Rc, sync::Arc};
pub struct App {
@@ -41,4 +42,11 @@ impl platform::App for App {
fn fonts(&self) -> Arc<dyn platform::FontSystem> {
self.fonts.clone()
}
fn quit(&self) {
unsafe {
let app = NSApplication::sharedApplication(nil);
let _: () = msg_send![app, terminate: nil];
}
}
}