window_vibrancy/macos/
mod.rs

1// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
2// SPDX-License-Identifier: Apache-2.0
3// SPDX-License-Identifier: MIT
4
5// The use of NSVisualEffectView comes from https://github.com/joboet/winit/tree/macos_blurred_background
6// with a bit of rewrite by @youngsing to make it more like cocoa::appkit style.
7/// <https://developer.apple.com/documentation/appkit/nsvisualeffectview/material>
8#[repr(u64)]
9#[derive(Clone, Copy, Debug, PartialEq)]
10pub enum NSVisualEffectMaterial {
11    #[deprecated(
12        since = "macOS 10.14",
13        note = "A default material appropriate for the view's effectiveAppearance.  You should instead choose an appropriate semantic material."
14    )]
15    AppearanceBased = 0,
16    #[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
17    Light = 1,
18    #[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
19    Dark = 2,
20    #[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
21    MediumLight = 8,
22    #[deprecated(since = "macOS 10.14", note = "Use a semantic material instead.")]
23    UltraDark = 9,
24
25    /// macOS 10.10+
26    Titlebar = 3,
27    /// macOS 10.10+
28    Selection = 4,
29
30    /// macOS 10.11+
31    Menu = 5,
32    /// macOS 10.11+
33    Popover = 6,
34    /// macOS 10.11+
35    Sidebar = 7,
36
37    /// macOS 10.14+
38    HeaderView = 10,
39    /// macOS 10.14+
40    Sheet = 11,
41    /// macOS 10.14+
42    WindowBackground = 12,
43    /// macOS 10.14+
44    HudWindow = 13,
45    /// macOS 10.14+
46    FullScreenUI = 15,
47    /// macOS 10.14+
48    Tooltip = 17,
49    /// macOS 10.14+
50    ContentBackground = 18,
51    /// macOS 10.14+
52    UnderWindowBackground = 21,
53    /// macOS 10.14+
54    UnderPageBackground = 22,
55}
56
57/// <https://developer.apple.com/documentation/appkit/nsvisualeffectview/state>
58#[allow(dead_code)]
59#[repr(u64)]
60#[derive(Clone, Copy, Debug, PartialEq)]
61pub enum NSVisualEffectState {
62    /// Make window vibrancy state follow the window's active state
63    FollowsWindowActiveState = 0,
64    /// Make window vibrancy state always active
65    Active = 1,
66    /// Make window vibrancy state always inactive
67    Inactive = 2,
68}
69
70#[cfg(target_os = "macos")]
71mod internal;
72
73#[cfg(target_os = "macos")]
74pub use internal::apply_vibrancy;
75
76#[cfg(target_os = "macos")]
77pub use internal::clear_vibrancy;
78
79#[cfg(target_os = "macos")]
80mod ns_visual_effect_view_tagged;
81
82#[cfg(target_os = "macos")]
83pub use ns_visual_effect_view_tagged::NSVisualEffectViewTagged;