druid_shell/platform/
mac.rs

1// Copyright 2021 The Druid Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! macOS specific extensions.
16
17/// macOS specific extensions to [`Application`]
18///
19/// [`Application`]: crate::Application
20pub trait ApplicationExt {
21    /// Hide the application this window belongs to. (cmd+H)
22    fn hide(&self);
23
24    /// Hide all other applications. (cmd+opt+H)
25    fn hide_others(&self);
26
27    /// Sets the global application menu, on platforms where there is one.
28    ///
29    /// On platforms with no global application menu, this has no effect.
30    fn set_menu(&self, menu: crate::Menu);
31}
32
33#[cfg(test)]
34mod test {
35    use crate::Application;
36
37    use super::*;
38    use static_assertions as sa;
39    sa::assert_impl_all!(Application: ApplicationExt);
40}