Implement default macOS menu items

- `Zed -> Hide`, bound to `cmd-h`
- `Zed -> Hide Others`, bound to `alt-cmd-h`
- `Zed -> Show All`
- `Window -> Minimize`, bound to `cmd-m`
- `Window -> Zoom`
This commit is contained in:
Antonio Scandurra 2022-08-03 15:13:30 +02:00
parent dc9df64078
commit 7cbf76ce80
8 changed files with 124 additions and 1 deletions

View file

@ -1319,6 +1319,16 @@ impl MutableAppContext {
window.show_character_palette();
}
pub fn minimize_window(&self, window_id: usize) {
let (_, window) = &self.presenters_and_platform_windows[&window_id];
window.minimize();
}
pub fn zoom_window(&self, window_id: usize) {
let (_, window) = &self.presenters_and_platform_windows[&window_id];
window.zoom();
}
fn prompt(
&self,
window_id: usize,
@ -3686,6 +3696,14 @@ impl<'a, T: View> ViewContext<'a, T> {
self.app.show_character_palette(self.window_id);
}
pub fn minimize_window(&self) {
self.app.minimize_window(self.window_id)
}
pub fn zoom_window(&self) {
self.app.zoom_window(self.window_id)
}
pub fn prompt(
&self,
level: PromptLevel,