objc2_app_kit/generated/
NSVisualEffectView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// The main material that this view displays.  Materials are dynamic, and their exact look depends on the view's effectiveAppearance, blendingMode, state, emphasized, and possibly other factors.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsvisualeffectmaterial?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSVisualEffectMaterial(pub NSInteger);
17impl NSVisualEffectMaterial {
18    /// The material used by window titlebars.
19    #[doc(alias = "NSVisualEffectMaterialTitlebar")]
20    pub const Titlebar: Self = Self(3);
21    /// The material used in some table views, menus, etc., to indicate selection.
22    #[doc(alias = "NSVisualEffectMaterialSelection")]
23    pub const Selection: Self = Self(4);
24    /// The material used by menus.
25    #[doc(alias = "NSVisualEffectMaterialMenu")]
26    pub const Menu: Self = Self(5);
27    /// The material used in the background of NSPopover windows.
28    #[doc(alias = "NSVisualEffectMaterialPopover")]
29    pub const Popover: Self = Self(6);
30    /// The material used in the background of window sidebars.
31    #[doc(alias = "NSVisualEffectMaterialSidebar")]
32    pub const Sidebar: Self = Self(7);
33    /// The material used in various in-line header or footer views (e.g., by NSTableView).
34    #[doc(alias = "NSVisualEffectMaterialHeaderView")]
35    pub const HeaderView: Self = Self(10);
36    /// The material used as the background of sheet windows.
37    #[doc(alias = "NSVisualEffectMaterialSheet")]
38    pub const Sheet: Self = Self(11);
39    /// The material used by opaque window backgrounds.
40    #[doc(alias = "NSVisualEffectMaterialWindowBackground")]
41    pub const WindowBackground: Self = Self(12);
42    /// The material used as the background of heads-up display (HUD) windows.
43    #[doc(alias = "NSVisualEffectMaterialHUDWindow")]
44    pub const HUDWindow: Self = Self(13);
45    /// The material used as the background of full-screen modal UI.
46    #[doc(alias = "NSVisualEffectMaterialFullScreenUI")]
47    pub const FullScreenUI: Self = Self(15);
48    /// The material used as the background of tool tips.
49    #[doc(alias = "NSVisualEffectMaterialToolTip")]
50    pub const ToolTip: Self = Self(17);
51    /// The material used as the opaque background of content (e.g., by NSScrollView, NSTableView, NSCollectionView, etc.).
52    #[doc(alias = "NSVisualEffectMaterialContentBackground")]
53    pub const ContentBackground: Self = Self(18);
54    /// The material used under window backgrounds.
55    #[doc(alias = "NSVisualEffectMaterialUnderWindowBackground")]
56    pub const UnderWindowBackground: Self = Self(21);
57    /// The material used as the background behind document pages.
58    #[doc(alias = "NSVisualEffectMaterialUnderPageBackground")]
59    pub const UnderPageBackground: Self = Self(22);
60    /// A default material appropriate for the view's effectiveAppearance.  You should instead choose an appropriate semantic material.
61    #[deprecated = "Use a specific semantic material instead."]
62    #[doc(alias = "NSVisualEffectMaterialAppearanceBased")]
63    pub const AppearanceBased: Self = Self(0);
64    /// A default material appropriate for the view's effectiveAppearance.  You should instead choose an appropriate semantic material.
65    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
66    #[doc(alias = "NSVisualEffectMaterialLight")]
67    pub const Light: Self = Self(1);
68    /// A default material appropriate for the view's effectiveAppearance.  You should instead choose an appropriate semantic material.
69    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
70    #[doc(alias = "NSVisualEffectMaterialDark")]
71    pub const Dark: Self = Self(2);
72    /// A default material appropriate for the view's effectiveAppearance.  You should instead choose an appropriate semantic material.
73    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
74    #[doc(alias = "NSVisualEffectMaterialMediumLight")]
75    pub const MediumLight: Self = Self(8);
76    /// A default material appropriate for the view's effectiveAppearance.  You should instead choose an appropriate semantic material.
77    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
78    #[doc(alias = "NSVisualEffectMaterialUltraDark")]
79    pub const UltraDark: Self = Self(9);
80}
81
82unsafe impl Encode for NSVisualEffectMaterial {
83    const ENCODING: Encoding = NSInteger::ENCODING;
84}
85
86unsafe impl RefEncode for NSVisualEffectMaterial {
87    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
88}
89
90/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsvisualeffectblendingmode?language=objc)
91// NS_ENUM
92#[repr(transparent)]
93#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
94pub struct NSVisualEffectBlendingMode(pub NSInteger);
95impl NSVisualEffectBlendingMode {
96    /// Blend with the area behind the window (such as the Desktop or other windows).
97    #[doc(alias = "NSVisualEffectBlendingModeBehindWindow")]
98    pub const BehindWindow: Self = Self(0);
99    /// Blend with the area behind the view in the window.
100    #[doc(alias = "NSVisualEffectBlendingModeWithinWindow")]
101    pub const WithinWindow: Self = Self(1);
102}
103
104unsafe impl Encode for NSVisualEffectBlendingMode {
105    const ENCODING: Encoding = NSInteger::ENCODING;
106}
107
108unsafe impl RefEncode for NSVisualEffectBlendingMode {
109    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
110}
111
112/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsvisualeffectstate?language=objc)
113// NS_ENUM
114#[repr(transparent)]
115#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
116pub struct NSVisualEffectState(pub NSInteger);
117impl NSVisualEffectState {
118    /// Use the active look only when the containing window is active.
119    #[doc(alias = "NSVisualEffectStateFollowsWindowActiveState")]
120    pub const FollowsWindowActiveState: Self = Self(0);
121    /// Use the active look always.
122    #[doc(alias = "NSVisualEffectStateActive")]
123    pub const Active: Self = Self(1);
124    /// Use the inactive look always.
125    #[doc(alias = "NSVisualEffectStateInactive")]
126    pub const Inactive: Self = Self(2);
127}
128
129unsafe impl Encode for NSVisualEffectState {
130    const ENCODING: Encoding = NSInteger::ENCODING;
131}
132
133unsafe impl RefEncode for NSVisualEffectState {
134    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
135}
136
137extern_class!(
138    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsvisualeffectview?language=objc)
139    #[unsafe(super(NSView, NSResponder, NSObject))]
140    #[derive(Debug, PartialEq, Eq, Hash)]
141    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
142    pub struct NSVisualEffectView;
143);
144
145#[cfg(all(
146    feature = "NSAccessibilityProtocols",
147    feature = "NSResponder",
148    feature = "NSView"
149))]
150unsafe impl NSAccessibility for NSVisualEffectView {}
151
152#[cfg(all(
153    feature = "NSAccessibilityProtocols",
154    feature = "NSResponder",
155    feature = "NSView"
156))]
157unsafe impl NSAccessibilityElementProtocol for NSVisualEffectView {}
158
159#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
160unsafe impl NSAnimatablePropertyContainer for NSVisualEffectView {}
161
162#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
163unsafe impl NSAppearanceCustomization for NSVisualEffectView {}
164
165#[cfg(all(feature = "NSResponder", feature = "NSView"))]
166unsafe impl NSCoding for NSVisualEffectView {}
167
168#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
169unsafe impl NSDraggingDestination for NSVisualEffectView {}
170
171#[cfg(all(feature = "NSResponder", feature = "NSView"))]
172unsafe impl NSObjectProtocol for NSVisualEffectView {}
173
174#[cfg(all(
175    feature = "NSResponder",
176    feature = "NSUserInterfaceItemIdentification",
177    feature = "NSView"
178))]
179unsafe impl NSUserInterfaceItemIdentification for NSVisualEffectView {}
180
181#[cfg(all(feature = "NSResponder", feature = "NSView"))]
182impl NSVisualEffectView {
183    extern_methods!(
184        /// A value indicating which material is shown by the NSVisualEffectView.  See the comments on NSVisualEffectMaterial.  Defaults to NSVisualEffectMaterialAppearanceBased.  You should instead specify an appropriate semantic material value.  See the comments on NSVisualEffectMaterial.
185        #[unsafe(method(material))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn material(&self) -> NSVisualEffectMaterial;
188
189        /// Setter for [`material`][Self::material].
190        #[unsafe(method(setMaterial:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setMaterial(&self, material: NSVisualEffectMaterial);
193
194        #[cfg(feature = "NSCell")]
195        /// An NSBackgroundStyle value that most closely matches the look of the material shown by the NSVisualEffectView.
196        #[unsafe(method(interiorBackgroundStyle))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn interiorBackgroundStyle(&self) -> NSBackgroundStyle;
199
200        /// A value controlling how the NSVisualEffectView generates its material.  See the comments on NSVisualEffectBlendingMode.  Not all materials support both blending modes, so NSVisualEffectView may fall back to a more appropriate blending mode as needed.  Defaults to NSVisualEffectBlendingModeBehindWindow.
201        #[unsafe(method(blendingMode))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn blendingMode(&self) -> NSVisualEffectBlendingMode;
204
205        /// Setter for [`blendingMode`][Self::blendingMode].
206        #[unsafe(method(setBlendingMode:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setBlendingMode(&self, blending_mode: NSVisualEffectBlendingMode);
209
210        /// A value controlling when the NSVisualEffectView takes on the active look.  See the comments on NSVisualEffectState.  Defaults to NSVisualEffectStateFollowsWindowActiveState.
211        #[unsafe(method(state))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn state(&self) -> NSVisualEffectState;
214
215        /// Setter for [`state`][Self::state].
216        #[unsafe(method(setState:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn setState(&self, state: NSVisualEffectState);
219
220        #[cfg(feature = "NSImage")]
221        /// An image whose alpha channel is used to mask the material generated by the NSVisualEffectView.  (It does not also mask subviews.)  Defaults to nil.  It is best to set this to the smallest mask image possible and properly set the image's capInsets property to stretch it.  Setting the maskImage on an NSVisualEffectView that is the contentView of a window will correctly influence the window's shadow.
222        #[unsafe(method(maskImage))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn maskImage(&self) -> Option<Retained<NSImage>>;
225
226        #[cfg(feature = "NSImage")]
227        /// Setter for [`maskImage`][Self::maskImage].
228        #[unsafe(method(setMaskImage:))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn setMaskImage(&self, mask_image: Option<&NSImage>);
231
232        /// When YES, the material takes on the emphasized look.  Defaults to NO.  Some, but not all, materials change their look when emphasized.  This is used to indicate that an associated view has firstResponder status.
233        #[unsafe(method(isEmphasized))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn isEmphasized(&self) -> bool;
236
237        /// Setter for [`isEmphasized`][Self::isEmphasized].
238        #[unsafe(method(setEmphasized:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setEmphasized(&self, emphasized: bool);
241
242        #[unsafe(method(viewDidMoveToWindow))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn viewDidMoveToWindow(&self);
245
246        #[cfg(feature = "NSWindow")]
247        #[unsafe(method(viewWillMoveToWindow:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn viewWillMoveToWindow(&self, new_window: Option<&NSWindow>);
250    );
251}
252
253/// Methods declared on superclass `NSView`.
254#[cfg(all(feature = "NSResponder", feature = "NSView"))]
255impl NSVisualEffectView {
256    extern_methods!(
257        #[unsafe(method(initWithFrame:))]
258        #[unsafe(method_family = init)]
259        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
260
261        #[unsafe(method(initWithCoder:))]
262        #[unsafe(method_family = init)]
263        pub unsafe fn initWithCoder(
264            this: Allocated<Self>,
265            coder: &NSCoder,
266        ) -> Option<Retained<Self>>;
267    );
268}
269
270/// Methods declared on superclass `NSResponder`.
271#[cfg(all(feature = "NSResponder", feature = "NSView"))]
272impl NSVisualEffectView {
273    extern_methods!(
274        #[unsafe(method(init))]
275        #[unsafe(method_family = init)]
276        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
277    );
278}
279
280/// Methods declared on superclass `NSObject`.
281#[cfg(all(feature = "NSResponder", feature = "NSView"))]
282impl NSVisualEffectView {
283    extern_methods!(
284        #[unsafe(method(new))]
285        #[unsafe(method_family = new)]
286        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
287    );
288}