objc2_app_kit/generated/
NSGlassEffectView.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglasseffectviewstyle?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSGlassEffectViewStyle(pub NSInteger);
17impl NSGlassEffectViewStyle {
18    /// Standard glass effect style.
19    #[doc(alias = "NSGlassEffectViewStyleRegular")]
20    pub const Regular: Self = Self(0);
21    /// Clear glass effect style.
22    #[doc(alias = "NSGlassEffectViewStyleClear")]
23    pub const Clear: Self = Self(1);
24}
25
26unsafe impl Encode for NSGlassEffectViewStyle {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSGlassEffectViewStyle {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// A view that embeds its content view in a dynamic glass effect.
36    ///
37    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglasseffectview?language=objc)
38    #[unsafe(super(NSView, NSResponder, NSObject))]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
41    pub struct NSGlassEffectView;
42);
43
44#[cfg(all(
45    feature = "NSAccessibilityProtocols",
46    feature = "NSResponder",
47    feature = "NSView"
48))]
49extern_conformance!(
50    unsafe impl NSAccessibility for NSGlassEffectView {}
51);
52
53#[cfg(all(
54    feature = "NSAccessibilityProtocols",
55    feature = "NSResponder",
56    feature = "NSView"
57))]
58extern_conformance!(
59    unsafe impl NSAccessibilityElementProtocol for NSGlassEffectView {}
60);
61
62#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
63extern_conformance!(
64    unsafe impl NSAnimatablePropertyContainer for NSGlassEffectView {}
65);
66
67#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
68extern_conformance!(
69    unsafe impl NSAppearanceCustomization for NSGlassEffectView {}
70);
71
72#[cfg(all(feature = "NSResponder", feature = "NSView"))]
73extern_conformance!(
74    unsafe impl NSCoding for NSGlassEffectView {}
75);
76
77#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
78extern_conformance!(
79    unsafe impl NSDraggingDestination for NSGlassEffectView {}
80);
81
82#[cfg(all(feature = "NSResponder", feature = "NSView"))]
83extern_conformance!(
84    unsafe impl NSObjectProtocol for NSGlassEffectView {}
85);
86
87#[cfg(all(
88    feature = "NSResponder",
89    feature = "NSUserInterfaceItemIdentification",
90    feature = "NSView"
91))]
92extern_conformance!(
93    unsafe impl NSUserInterfaceItemIdentification for NSGlassEffectView {}
94);
95
96#[cfg(all(feature = "NSResponder", feature = "NSView"))]
97impl NSGlassEffectView {
98    extern_methods!(
99        /// The view to embed in glass.
100        ///
101        /// - Important: `NSGlassEffectView` only guarantees the `contentView` will be placed inside the glass effect; arbitrary subviews aren't guaranteed specific behavior with regard to z-order in relation to the content view or glass effect.
102        #[unsafe(method(contentView))]
103        #[unsafe(method_family = none)]
104        pub fn contentView(&self) -> Option<Retained<NSView>>;
105
106        /// Setter for [`contentView`][Self::contentView].
107        #[unsafe(method(setContentView:))]
108        #[unsafe(method_family = none)]
109        pub fn setContentView(&self, content_view: Option<&NSView>);
110
111        #[cfg(feature = "objc2-core-foundation")]
112        /// The amount of curvature for all corners of the glass.
113        #[unsafe(method(cornerRadius))]
114        #[unsafe(method_family = none)]
115        pub fn cornerRadius(&self) -> CGFloat;
116
117        #[cfg(feature = "objc2-core-foundation")]
118        /// Setter for [`cornerRadius`][Self::cornerRadius].
119        #[unsafe(method(setCornerRadius:))]
120        #[unsafe(method_family = none)]
121        pub fn setCornerRadius(&self, corner_radius: CGFloat);
122
123        #[cfg(feature = "NSColor")]
124        /// The color the glass effect view uses to tint the background and glass effect toward.
125        #[unsafe(method(tintColor))]
126        #[unsafe(method_family = none)]
127        pub fn tintColor(&self) -> Option<Retained<NSColor>>;
128
129        #[cfg(feature = "NSColor")]
130        /// Setter for [`tintColor`][Self::tintColor].
131        ///
132        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
133        #[unsafe(method(setTintColor:))]
134        #[unsafe(method_family = none)]
135        pub fn setTintColor(&self, tint_color: Option<&NSColor>);
136
137        /// The style of glass this view uses.
138        #[unsafe(method(style))]
139        #[unsafe(method_family = none)]
140        pub fn style(&self) -> NSGlassEffectViewStyle;
141
142        /// Setter for [`style`][Self::style].
143        #[unsafe(method(setStyle:))]
144        #[unsafe(method_family = none)]
145        pub fn setStyle(&self, style: NSGlassEffectViewStyle);
146    );
147}
148
149/// Methods declared on superclass `NSView`.
150#[cfg(all(feature = "NSResponder", feature = "NSView"))]
151impl NSGlassEffectView {
152    extern_methods!(
153        #[unsafe(method(initWithFrame:))]
154        #[unsafe(method_family = init)]
155        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
156
157        /// # Safety
158        ///
159        /// `coder` possibly has further requirements.
160        #[unsafe(method(initWithCoder:))]
161        #[unsafe(method_family = init)]
162        pub unsafe fn initWithCoder(
163            this: Allocated<Self>,
164            coder: &NSCoder,
165        ) -> Option<Retained<Self>>;
166    );
167}
168
169/// Methods declared on superclass `NSResponder`.
170#[cfg(all(feature = "NSResponder", feature = "NSView"))]
171impl NSGlassEffectView {
172    extern_methods!(
173        #[unsafe(method(init))]
174        #[unsafe(method_family = init)]
175        pub fn init(this: Allocated<Self>) -> Retained<Self>;
176    );
177}
178
179/// Methods declared on superclass `NSObject`.
180#[cfg(all(feature = "NSResponder", feature = "NSView"))]
181impl NSGlassEffectView {
182    extern_methods!(
183        #[unsafe(method(new))]
184        #[unsafe(method_family = new)]
185        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
186    );
187}
188
189extern_class!(
190    /// A view that efficiently merges descendant glass effect views together when they are within a specified proximity to each other.
191    ///
192    /// - Tip: Using a glass effect container view can improve performance by reducing the number of passes required to render similar glass effect views.
193    ///
194    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglasseffectcontainerview?language=objc)
195    #[unsafe(super(NSView, NSResponder, NSObject))]
196    #[derive(Debug, PartialEq, Eq, Hash)]
197    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
198    pub struct NSGlassEffectContainerView;
199);
200
201#[cfg(all(
202    feature = "NSAccessibilityProtocols",
203    feature = "NSResponder",
204    feature = "NSView"
205))]
206extern_conformance!(
207    unsafe impl NSAccessibility for NSGlassEffectContainerView {}
208);
209
210#[cfg(all(
211    feature = "NSAccessibilityProtocols",
212    feature = "NSResponder",
213    feature = "NSView"
214))]
215extern_conformance!(
216    unsafe impl NSAccessibilityElementProtocol for NSGlassEffectContainerView {}
217);
218
219#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
220extern_conformance!(
221    unsafe impl NSAnimatablePropertyContainer for NSGlassEffectContainerView {}
222);
223
224#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
225extern_conformance!(
226    unsafe impl NSAppearanceCustomization for NSGlassEffectContainerView {}
227);
228
229#[cfg(all(feature = "NSResponder", feature = "NSView"))]
230extern_conformance!(
231    unsafe impl NSCoding for NSGlassEffectContainerView {}
232);
233
234#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
235extern_conformance!(
236    unsafe impl NSDraggingDestination for NSGlassEffectContainerView {}
237);
238
239#[cfg(all(feature = "NSResponder", feature = "NSView"))]
240extern_conformance!(
241    unsafe impl NSObjectProtocol for NSGlassEffectContainerView {}
242);
243
244#[cfg(all(
245    feature = "NSResponder",
246    feature = "NSUserInterfaceItemIdentification",
247    feature = "NSView"
248))]
249extern_conformance!(
250    unsafe impl NSUserInterfaceItemIdentification for NSGlassEffectContainerView {}
251);
252
253#[cfg(all(feature = "NSResponder", feature = "NSView"))]
254impl NSGlassEffectContainerView {
255    extern_methods!(
256        /// The view that contains descendant views to merge together when in proximity to each other.
257        ///
258        /// The glass effect container view does the following:
259        /// 1. Elevates the z-order of descendants of `contentView` to position them above the `contentView`.
260        /// 2. Merges descendants together if the views are sufficiently similar and within the proximity specified in ``spacing``.
261        /// 3. Processes similar glass effect views as a batch to improve performance.
262        #[unsafe(method(contentView))]
263        #[unsafe(method_family = none)]
264        pub fn contentView(&self) -> Option<Retained<NSView>>;
265
266        /// Setter for [`contentView`][Self::contentView].
267        #[unsafe(method(setContentView:))]
268        #[unsafe(method_family = none)]
269        pub fn setContentView(&self, content_view: Option<&NSView>);
270
271        #[cfg(feature = "objc2-core-foundation")]
272        /// The proximity at which the glass effect container view begins merging eligible descendent glass effect views.
273        ///
274        /// The default value, zero, is sufficient for batch processing eligible glass effect views, while avoiding distortion and merging effects for other views in close proximity.
275        #[unsafe(method(spacing))]
276        #[unsafe(method_family = none)]
277        pub fn spacing(&self) -> CGFloat;
278
279        #[cfg(feature = "objc2-core-foundation")]
280        /// Setter for [`spacing`][Self::spacing].
281        #[unsafe(method(setSpacing:))]
282        #[unsafe(method_family = none)]
283        pub fn setSpacing(&self, spacing: CGFloat);
284    );
285}
286
287/// Methods declared on superclass `NSView`.
288#[cfg(all(feature = "NSResponder", feature = "NSView"))]
289impl NSGlassEffectContainerView {
290    extern_methods!(
291        #[unsafe(method(initWithFrame:))]
292        #[unsafe(method_family = init)]
293        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
294
295        /// # Safety
296        ///
297        /// `coder` possibly has further requirements.
298        #[unsafe(method(initWithCoder:))]
299        #[unsafe(method_family = init)]
300        pub unsafe fn initWithCoder(
301            this: Allocated<Self>,
302            coder: &NSCoder,
303        ) -> Option<Retained<Self>>;
304    );
305}
306
307/// Methods declared on superclass `NSResponder`.
308#[cfg(all(feature = "NSResponder", feature = "NSView"))]
309impl NSGlassEffectContainerView {
310    extern_methods!(
311        #[unsafe(method(init))]
312        #[unsafe(method_family = init)]
313        pub fn init(this: Allocated<Self>) -> Retained<Self>;
314    );
315}
316
317/// Methods declared on superclass `NSObject`.
318#[cfg(all(feature = "NSResponder", feature = "NSView"))]
319impl NSGlassEffectContainerView {
320    extern_methods!(
321        #[unsafe(method(new))]
322        #[unsafe(method_family = new)]
323        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
324    );
325}