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    #[doc(alias = "NSVisualEffectMaterialAppearanceBased")]
62    #[deprecated = "Use a specific semantic material instead."]
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    #[doc(alias = "NSVisualEffectMaterialLight")]
66    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
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    #[doc(alias = "NSVisualEffectMaterialDark")]
70    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
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    #[doc(alias = "NSVisualEffectMaterialMediumLight")]
74    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
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    #[doc(alias = "NSVisualEffectMaterialUltraDark")]
78    #[deprecated = "Use a semantic material instead.  To force the appearance of a view hierarchy, set the `appearance` property to an appropriate NSAppearance value."]
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))]
150extern_conformance!(
151    unsafe impl NSAccessibility for NSVisualEffectView {}
152);
153
154#[cfg(all(
155    feature = "NSAccessibilityProtocols",
156    feature = "NSResponder",
157    feature = "NSView"
158))]
159extern_conformance!(
160    unsafe impl NSAccessibilityElementProtocol for NSVisualEffectView {}
161);
162
163#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
164extern_conformance!(
165    unsafe impl NSAnimatablePropertyContainer for NSVisualEffectView {}
166);
167
168#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
169extern_conformance!(
170    unsafe impl NSAppearanceCustomization for NSVisualEffectView {}
171);
172
173#[cfg(all(feature = "NSResponder", feature = "NSView"))]
174extern_conformance!(
175    unsafe impl NSCoding for NSVisualEffectView {}
176);
177
178#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
179extern_conformance!(
180    unsafe impl NSDraggingDestination for NSVisualEffectView {}
181);
182
183#[cfg(all(feature = "NSResponder", feature = "NSView"))]
184extern_conformance!(
185    unsafe impl NSObjectProtocol for NSVisualEffectView {}
186);
187
188#[cfg(all(
189    feature = "NSResponder",
190    feature = "NSUserInterfaceItemIdentification",
191    feature = "NSView"
192))]
193extern_conformance!(
194    unsafe impl NSUserInterfaceItemIdentification for NSVisualEffectView {}
195);
196
197#[cfg(all(feature = "NSResponder", feature = "NSView"))]
198impl NSVisualEffectView {
199    extern_methods!(
200        /// 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.
201        #[unsafe(method(material))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn material(&self) -> NSVisualEffectMaterial;
204
205        /// Setter for [`material`][Self::material].
206        #[unsafe(method(setMaterial:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setMaterial(&self, material: NSVisualEffectMaterial);
209
210        #[cfg(feature = "NSCell")]
211        /// An NSBackgroundStyle value that most closely matches the look of the material shown by the NSVisualEffectView.
212        #[unsafe(method(interiorBackgroundStyle))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn interiorBackgroundStyle(&self) -> NSBackgroundStyle;
215
216        /// 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.
217        #[unsafe(method(blendingMode))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn blendingMode(&self) -> NSVisualEffectBlendingMode;
220
221        /// Setter for [`blendingMode`][Self::blendingMode].
222        #[unsafe(method(setBlendingMode:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn setBlendingMode(&self, blending_mode: NSVisualEffectBlendingMode);
225
226        /// A value controlling when the NSVisualEffectView takes on the active look.  See the comments on NSVisualEffectState.  Defaults to NSVisualEffectStateFollowsWindowActiveState.
227        #[unsafe(method(state))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn state(&self) -> NSVisualEffectState;
230
231        /// Setter for [`state`][Self::state].
232        #[unsafe(method(setState:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setState(&self, state: NSVisualEffectState);
235
236        #[cfg(feature = "NSImage")]
237        /// 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.
238        #[unsafe(method(maskImage))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn maskImage(&self) -> Option<Retained<NSImage>>;
241
242        #[cfg(feature = "NSImage")]
243        /// Setter for [`maskImage`][Self::maskImage].
244        #[unsafe(method(setMaskImage:))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn setMaskImage(&self, mask_image: Option<&NSImage>);
247
248        /// 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.
249        #[unsafe(method(isEmphasized))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn isEmphasized(&self) -> bool;
252
253        /// Setter for [`isEmphasized`][Self::isEmphasized].
254        #[unsafe(method(setEmphasized:))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn setEmphasized(&self, emphasized: bool);
257
258        #[unsafe(method(viewDidMoveToWindow))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn viewDidMoveToWindow(&self);
261
262        #[cfg(feature = "NSWindow")]
263        #[unsafe(method(viewWillMoveToWindow:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn viewWillMoveToWindow(&self, new_window: Option<&NSWindow>);
266    );
267}
268
269/// Methods declared on superclass `NSView`.
270#[cfg(all(feature = "NSResponder", feature = "NSView"))]
271impl NSVisualEffectView {
272    extern_methods!(
273        #[unsafe(method(initWithFrame:))]
274        #[unsafe(method_family = init)]
275        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
276
277        #[unsafe(method(initWithCoder:))]
278        #[unsafe(method_family = init)]
279        pub unsafe fn initWithCoder(
280            this: Allocated<Self>,
281            coder: &NSCoder,
282        ) -> Option<Retained<Self>>;
283    );
284}
285
286/// Methods declared on superclass `NSResponder`.
287#[cfg(all(feature = "NSResponder", feature = "NSView"))]
288impl NSVisualEffectView {
289    extern_methods!(
290        #[unsafe(method(init))]
291        #[unsafe(method_family = init)]
292        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
293    );
294}
295
296/// Methods declared on superclass `NSObject`.
297#[cfg(all(feature = "NSResponder", feature = "NSView"))]
298impl NSVisualEffectView {
299    extern_methods!(
300        #[unsafe(method(new))]
301        #[unsafe(method_family = new)]
302        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
303    );
304}