objc2_ui_kit/generated/
UIGlassEffect.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/uikit/uiglasseffectstyle?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIGlassEffectStyle(pub NSInteger);
17impl UIGlassEffectStyle {
18    /// Standard glass effect style.
19    #[doc(alias = "UIGlassEffectStyleRegular")]
20    pub const Regular: Self = Self(0);
21    /// Clear glass effect style.
22    #[doc(alias = "UIGlassEffectStyleClear")]
23    pub const Clear: Self = Self(1);
24}
25
26unsafe impl Encode for UIGlassEffectStyle {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for UIGlassEffectStyle {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// A visual effect that renders a glass material.
36    ///
37    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiglasseffect?language=objc)
38    #[unsafe(super(UIVisualEffect, NSObject))]
39    #[thread_kind = MainThreadOnly]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    #[cfg(feature = "UIVisualEffect")]
42    pub struct UIGlassEffect;
43);
44
45#[cfg(feature = "UIVisualEffect")]
46extern_conformance!(
47    unsafe impl NSCoding for UIGlassEffect {}
48);
49
50#[cfg(feature = "UIVisualEffect")]
51extern_conformance!(
52    unsafe impl NSCopying for UIGlassEffect {}
53);
54
55#[cfg(feature = "UIVisualEffect")]
56unsafe impl CopyingHelper for UIGlassEffect {
57    type Result = Self;
58}
59
60#[cfg(feature = "UIVisualEffect")]
61extern_conformance!(
62    unsafe impl NSObjectProtocol for UIGlassEffect {}
63);
64
65#[cfg(feature = "UIVisualEffect")]
66extern_conformance!(
67    unsafe impl NSSecureCoding for UIGlassEffect {}
68);
69
70#[cfg(feature = "UIVisualEffect")]
71impl UIGlassEffect {
72    extern_methods!(
73        /// Enables interactive behavior for the glass effect.
74        #[unsafe(method(isInteractive))]
75        #[unsafe(method_family = none)]
76        pub fn isInteractive(&self) -> bool;
77
78        /// Setter for [`isInteractive`][Self::isInteractive].
79        #[unsafe(method(setInteractive:))]
80        #[unsafe(method_family = none)]
81        pub fn setInteractive(&self, interactive: bool);
82
83        #[cfg(feature = "UIColor")]
84        /// A tint color applied to the glass.
85        #[unsafe(method(tintColor))]
86        #[unsafe(method_family = none)]
87        pub fn tintColor(&self) -> Option<Retained<UIColor>>;
88
89        #[cfg(feature = "UIColor")]
90        /// Setter for [`tintColor`][Self::tintColor].
91        ///
92        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
93        #[unsafe(method(setTintColor:))]
94        #[unsafe(method_family = none)]
95        pub fn setTintColor(&self, tint_color: Option<&UIColor>);
96
97        /// Creates a glass effect with the specified style.
98        #[unsafe(method(effectWithStyle:))]
99        #[unsafe(method_family = none)]
100        pub fn effectWithStyle(
101            style: UIGlassEffectStyle,
102            mtm: MainThreadMarker,
103        ) -> Retained<UIGlassEffect>;
104    );
105}
106
107/// Methods declared on superclass `NSObject`.
108#[cfg(feature = "UIVisualEffect")]
109impl UIGlassEffect {
110    extern_methods!(
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub fn init(this: Allocated<Self>) -> Retained<Self>;
114
115        #[unsafe(method(new))]
116        #[unsafe(method_family = new)]
117        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
118    );
119}
120
121extern_class!(
122    /// A `UIGlassContainerEffect` renders multiple glass elements into a combined effect.
123    ///
124    /// When using `UIGlassContainerEffect` with a `UIVisualEffectView` you can
125    /// add individual glass elements to the visual effect view's contentView by nesting `UIVisualEffectView`'s
126    /// configured with `UIGlassEffect`. In that configuration, the glass container will render all glass elements
127    /// in one combined view, behind the visual effect view's `contentView`.
128    ///
129    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiglasscontainereffect?language=objc)
130    #[unsafe(super(UIVisualEffect, NSObject))]
131    #[thread_kind = MainThreadOnly]
132    #[derive(Debug, PartialEq, Eq, Hash)]
133    #[cfg(feature = "UIVisualEffect")]
134    pub struct UIGlassContainerEffect;
135);
136
137#[cfg(feature = "UIVisualEffect")]
138extern_conformance!(
139    unsafe impl NSCoding for UIGlassContainerEffect {}
140);
141
142#[cfg(feature = "UIVisualEffect")]
143extern_conformance!(
144    unsafe impl NSCopying for UIGlassContainerEffect {}
145);
146
147#[cfg(feature = "UIVisualEffect")]
148unsafe impl CopyingHelper for UIGlassContainerEffect {
149    type Result = Self;
150}
151
152#[cfg(feature = "UIVisualEffect")]
153extern_conformance!(
154    unsafe impl NSObjectProtocol for UIGlassContainerEffect {}
155);
156
157#[cfg(feature = "UIVisualEffect")]
158extern_conformance!(
159    unsafe impl NSSecureCoding for UIGlassContainerEffect {}
160);
161
162#[cfg(feature = "UIVisualEffect")]
163impl UIGlassContainerEffect {
164    extern_methods!(
165        #[cfg(feature = "objc2-core-foundation")]
166        /// The spacing specifies the distance between elements at which they begin to merge.
167        #[unsafe(method(spacing))]
168        #[unsafe(method_family = none)]
169        pub fn spacing(&self) -> CGFloat;
170
171        #[cfg(feature = "objc2-core-foundation")]
172        /// Setter for [`spacing`][Self::spacing].
173        #[unsafe(method(setSpacing:))]
174        #[unsafe(method_family = none)]
175        pub fn setSpacing(&self, spacing: CGFloat);
176    );
177}
178
179/// Methods declared on superclass `NSObject`.
180#[cfg(feature = "UIVisualEffect")]
181impl UIGlassContainerEffect {
182    extern_methods!(
183        #[unsafe(method(init))]
184        #[unsafe(method_family = init)]
185        pub fn init(this: Allocated<Self>) -> Retained<Self>;
186
187        #[unsafe(method(new))]
188        #[unsafe(method_family = new)]
189        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
190    );
191}