mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 05:18:11 +08:00
Desktop: Mac native menu bar (#3301)
* macos native menu bar * fix nix build * Add shortcut symbols to menu * fix fmt * fix vendoring * cleanup intercept frontend message * accept into editor message in queue function
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
use winit::event_loop::ActiveEventLoop;
|
||||
use winit::window::{Window, WindowAttributes};
|
||||
|
||||
use super::NativeWindow;
|
||||
use crate::consts::APP_NAME;
|
||||
use crate::event::AppEventScheduler;
|
||||
use crate::wrapper::messages::MenuItem;
|
||||
|
||||
pub(super) struct NativeWindowImpl {}
|
||||
pub(super) struct NativeWindowImpl {
|
||||
menu: menu::Menu,
|
||||
}
|
||||
|
||||
impl NativeWindow for NativeWindowImpl {
|
||||
impl super::NativeWindow for NativeWindowImpl {
|
||||
fn configure(attributes: WindowAttributes, _event_loop: &dyn ActiveEventLoop) -> WindowAttributes {
|
||||
let mac_window = winit::platform::macos::WindowAttributesMacOS::default()
|
||||
.with_titlebar_transparent(true)
|
||||
@@ -14,7 +18,15 @@ impl NativeWindow for NativeWindowImpl {
|
||||
attributes.with_platform_attributes(Box::new(mac_window))
|
||||
}
|
||||
|
||||
fn new(_window: &dyn Window) -> Self {
|
||||
NativeWindowImpl {}
|
||||
fn new(_window: &dyn Window, app_event_scheduler: AppEventScheduler) -> Self {
|
||||
let menu = menu::Menu::new(app_event_scheduler, APP_NAME);
|
||||
|
||||
NativeWindowImpl { menu }
|
||||
}
|
||||
|
||||
fn update_menu(&self, entries: Vec<MenuItem>) {
|
||||
self.menu.update(entries);
|
||||
}
|
||||
}
|
||||
|
||||
mod menu;
|
||||
|
||||
Reference in New Issue
Block a user