objc2_ui_kit/generated/
UIBackgroundConfiguration.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
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibackgroundconfiguration?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct UIBackgroundConfiguration;
18);
19
20extern_conformance!(
21    unsafe impl NSCoding for UIBackgroundConfiguration {}
22);
23
24extern_conformance!(
25    unsafe impl NSCopying for UIBackgroundConfiguration {}
26);
27
28unsafe impl CopyingHelper for UIBackgroundConfiguration {
29    type Result = Self;
30}
31
32extern_conformance!(
33    unsafe impl NSObjectProtocol for UIBackgroundConfiguration {}
34);
35
36extern_conformance!(
37    unsafe impl NSSecureCoding for UIBackgroundConfiguration {}
38);
39
40impl UIBackgroundConfiguration {
41    extern_methods!(
42        /// Returns a clear configuration, with no default styling.
43        #[unsafe(method(clearConfiguration))]
44        #[unsafe(method_family = none)]
45        pub fn clearConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
46
47        /// Represents a generic cell background configuration that automatically adopts the style of a containing list when updated for a
48        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
49        /// Defaults to the background configuration for a cell in a plain-style list.
50        #[unsafe(method(listCellConfiguration))]
51        #[unsafe(method_family = none)]
52        pub fn listCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
53
54        /// Represents a generic header background configuration that automatically adopts the style of a containing list when updated for a
55        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
56        /// Defaults to the background configuration for a header in a plain-style list.
57        #[unsafe(method(listHeaderConfiguration))]
58        #[unsafe(method_family = none)]
59        pub fn listHeaderConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
60
61        /// Represents a generic footer background configuration that automatically adopts the style of a containing list when updated for a
62        /// new configuration state, by reading the `listEnvironment` trait from the state's trait collection.
63        /// Defaults to the background configuration for a footer in a plain-style list.
64        #[unsafe(method(listFooterConfiguration))]
65        #[unsafe(method_family = none)]
66        pub fn listFooterConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
67
68        /// Returns the default configuration for an accompanied sidebar list cell.
69        #[unsafe(method(listAccompaniedSidebarCellConfiguration))]
70        #[unsafe(method_family = none)]
71        pub fn listAccompaniedSidebarCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
72
73        #[unsafe(method(new))]
74        #[unsafe(method_family = new)]
75        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
76
77        #[unsafe(method(init))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
80
81        #[cfg(feature = "UIConfigurationState")]
82        /// Returns a copy of the configuration updated for the specified state, by applying the configuration's default values for that state to any properties that have not been customized.
83        #[unsafe(method(updatedConfigurationForState:))]
84        #[unsafe(method_family = none)]
85        pub fn updatedConfigurationForState(
86            &self,
87            state: &ProtocolObject<dyn UIConfigurationState>,
88        ) -> Retained<Self>;
89
90        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
91        /// A custom view for the background. The custom view must have translatesAutoresizingMaskIntoConstraints
92        /// enabled, but may use auto layout constraints internally for layout of subviews.
93        #[unsafe(method(customView))]
94        #[unsafe(method_family = none)]
95        pub fn customView(&self) -> Option<Retained<UIView>>;
96
97        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
98        /// Setter for [`customView`][Self::customView].
99        #[unsafe(method(setCustomView:))]
100        #[unsafe(method_family = none)]
101        pub fn setCustomView(&self, custom_view: Option<&UIView>);
102
103        #[cfg(feature = "objc2-core-foundation")]
104        /// The preferred corner radius (using a continuous corner curve) for the background and stroke. This is also applied to the custom view. Default is 0.
105        /// If the view is too small to fit the requested radius, the corner curve and radius will be adjusted to fit.
106        #[unsafe(method(cornerRadius))]
107        #[unsafe(method_family = none)]
108        pub fn cornerRadius(&self) -> CGFloat;
109
110        #[cfg(feature = "objc2-core-foundation")]
111        /// Setter for [`cornerRadius`][Self::cornerRadius].
112        #[unsafe(method(setCornerRadius:))]
113        #[unsafe(method_family = none)]
114        pub fn setCornerRadius(&self, corner_radius: CGFloat);
115
116        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
117        /// Insets (or outsets, if negative) for the background and stroke, relative to the edges of the containing view. These also apply to the custom view. Default is NSDirectionalEdgeInsetsZero.
118        #[unsafe(method(backgroundInsets))]
119        #[unsafe(method_family = none)]
120        pub fn backgroundInsets(&self) -> NSDirectionalEdgeInsets;
121
122        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
123        /// Setter for [`backgroundInsets`][Self::backgroundInsets].
124        #[unsafe(method(setBackgroundInsets:))]
125        #[unsafe(method_family = none)]
126        pub fn setBackgroundInsets(&self, background_insets: NSDirectionalEdgeInsets);
127
128        #[cfg(feature = "UIGeometry")]
129        /// The edges on which the containing view's layout margins are added to the `backgroundInsets`, effectively making the `backgroundInsets` values relative
130        /// to the containing view's layout margins for these edges. Default is NSDirectionalRectEdgeNone.
131        #[unsafe(method(edgesAddingLayoutMarginsToBackgroundInsets))]
132        #[unsafe(method_family = none)]
133        pub fn edgesAddingLayoutMarginsToBackgroundInsets(&self) -> NSDirectionalRectEdge;
134
135        #[cfg(feature = "UIGeometry")]
136        /// Setter for [`edgesAddingLayoutMarginsToBackgroundInsets`][Self::edgesAddingLayoutMarginsToBackgroundInsets].
137        #[unsafe(method(setEdgesAddingLayoutMarginsToBackgroundInsets:))]
138        #[unsafe(method_family = none)]
139        pub fn setEdgesAddingLayoutMarginsToBackgroundInsets(
140            &self,
141            edges_adding_layout_margins_to_background_insets: NSDirectionalRectEdge,
142        );
143
144        #[cfg(feature = "UIColor")]
145        /// Configures the color of the background. A nil value uses the view's tint color; use `clearColor` for no color (transparent).
146        #[unsafe(method(backgroundColor))]
147        #[unsafe(method_family = none)]
148        pub fn backgroundColor(&self) -> Option<Retained<UIColor>>;
149
150        #[cfg(feature = "UIColor")]
151        /// Setter for [`backgroundColor`][Self::backgroundColor].
152        #[unsafe(method(setBackgroundColor:))]
153        #[unsafe(method_family = none)]
154        pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
155
156        #[cfg(all(
157            feature = "UIColor",
158            feature = "UIConfigurationColorTransformer",
159            feature = "block2"
160        ))]
161        /// Optional color transformer that is used to resolve the background color. A nil value means the `backgroundColor` is used as-is.
162        ///
163        /// # Safety
164        ///
165        /// The returned block's argument must be a valid pointer.
166        #[unsafe(method(backgroundColorTransformer))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn backgroundColorTransformer(&self) -> UIConfigurationColorTransformer;
169
170        #[cfg(all(
171            feature = "UIColor",
172            feature = "UIConfigurationColorTransformer",
173            feature = "block2"
174        ))]
175        /// Setter for [`backgroundColorTransformer`][Self::backgroundColorTransformer].
176        ///
177        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
178        ///
179        /// # Safety
180        ///
181        /// `background_color_transformer` must be a valid pointer or null.
182        #[unsafe(method(setBackgroundColorTransformer:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setBackgroundColorTransformer(
185            &self,
186            background_color_transformer: UIConfigurationColorTransformer,
187        );
188
189        #[cfg(feature = "UIColor")]
190        /// Returns the resolved background color for the specified tint color, based on the `backgroundColor` and `backgroundColorTransformer`.
191        #[unsafe(method(resolvedBackgroundColorForTintColor:))]
192        #[unsafe(method_family = none)]
193        pub fn resolvedBackgroundColorForTintColor(
194            &self,
195            tint_color: &UIColor,
196        ) -> Retained<UIColor>;
197
198        #[cfg(feature = "UIVisualEffect")]
199        /// The visual effect to apply to the background. Default is nil.
200        #[unsafe(method(visualEffect))]
201        #[unsafe(method_family = none)]
202        pub fn visualEffect(&self) -> Option<Retained<UIVisualEffect>>;
203
204        #[cfg(feature = "UIVisualEffect")]
205        /// Setter for [`visualEffect`][Self::visualEffect].
206        ///
207        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
208        #[unsafe(method(setVisualEffect:))]
209        #[unsafe(method_family = none)]
210        pub fn setVisualEffect(&self, visual_effect: Option<&UIVisualEffect>);
211
212        #[cfg(feature = "UIImage")]
213        /// The image to use. Default is nil.
214        #[unsafe(method(image))]
215        #[unsafe(method_family = none)]
216        pub fn image(&self) -> Option<Retained<UIImage>>;
217
218        #[cfg(feature = "UIImage")]
219        /// Setter for [`image`][Self::image].
220        #[unsafe(method(setImage:))]
221        #[unsafe(method_family = none)]
222        pub fn setImage(&self, image: Option<&UIImage>);
223
224        #[cfg(feature = "UIView")]
225        /// The content mode to use when rendering the image. Default is UIViewContentModeScaleToFill.
226        #[unsafe(method(imageContentMode))]
227        #[unsafe(method_family = none)]
228        pub fn imageContentMode(&self) -> UIViewContentMode;
229
230        #[cfg(feature = "UIView")]
231        /// Setter for [`imageContentMode`][Self::imageContentMode].
232        #[unsafe(method(setImageContentMode:))]
233        #[unsafe(method_family = none)]
234        pub fn setImageContentMode(&self, image_content_mode: UIViewContentMode);
235
236        #[cfg(feature = "UIColor")]
237        /// Configures the color of the stroke. A nil value uses the view's tint color; use `clearColor` for no color (transparent).
238        #[unsafe(method(strokeColor))]
239        #[unsafe(method_family = none)]
240        pub fn strokeColor(&self) -> Option<Retained<UIColor>>;
241
242        #[cfg(feature = "UIColor")]
243        /// Setter for [`strokeColor`][Self::strokeColor].
244        #[unsafe(method(setStrokeColor:))]
245        #[unsafe(method_family = none)]
246        pub fn setStrokeColor(&self, stroke_color: Option<&UIColor>);
247
248        #[cfg(all(
249            feature = "UIColor",
250            feature = "UIConfigurationColorTransformer",
251            feature = "block2"
252        ))]
253        /// Optional color transformer that is used to resolve the stroke color. A nil value means the `strokeColor` is used as-is.
254        ///
255        /// # Safety
256        ///
257        /// The returned block's argument must be a valid pointer.
258        #[unsafe(method(strokeColorTransformer))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn strokeColorTransformer(&self) -> UIConfigurationColorTransformer;
261
262        #[cfg(all(
263            feature = "UIColor",
264            feature = "UIConfigurationColorTransformer",
265            feature = "block2"
266        ))]
267        /// Setter for [`strokeColorTransformer`][Self::strokeColorTransformer].
268        ///
269        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
270        ///
271        /// # Safety
272        ///
273        /// `stroke_color_transformer` must be a valid pointer or null.
274        #[unsafe(method(setStrokeColorTransformer:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn setStrokeColorTransformer(
277            &self,
278            stroke_color_transformer: UIConfigurationColorTransformer,
279        );
280
281        #[cfg(feature = "UIColor")]
282        /// Returns the resolved stroke color for the specified tint color, based on the `strokeColor` and `strokeColorTransformer`.
283        #[unsafe(method(resolvedStrokeColorForTintColor:))]
284        #[unsafe(method_family = none)]
285        pub fn resolvedStrokeColorForTintColor(&self, tint_color: &UIColor) -> Retained<UIColor>;
286
287        #[cfg(feature = "objc2-core-foundation")]
288        /// The width of the stroke. Default is 0.
289        #[unsafe(method(strokeWidth))]
290        #[unsafe(method_family = none)]
291        pub fn strokeWidth(&self) -> CGFloat;
292
293        #[cfg(feature = "objc2-core-foundation")]
294        /// Setter for [`strokeWidth`][Self::strokeWidth].
295        #[unsafe(method(setStrokeWidth:))]
296        #[unsafe(method_family = none)]
297        pub fn setStrokeWidth(&self, stroke_width: CGFloat);
298
299        #[cfg(feature = "objc2-core-foundation")]
300        /// Outset (or inset, if negative) for the stroke, relative to the background (including any backgroundInsets). Default is 0.
301        /// The corner radius of the stroke is adjusted for any outset to remain concentric with the background.
302        #[unsafe(method(strokeOutset))]
303        #[unsafe(method_family = none)]
304        pub fn strokeOutset(&self) -> CGFloat;
305
306        #[cfg(feature = "objc2-core-foundation")]
307        /// Setter for [`strokeOutset`][Self::strokeOutset].
308        #[unsafe(method(setStrokeOutset:))]
309        #[unsafe(method_family = none)]
310        pub fn setStrokeOutset(&self, stroke_outset: CGFloat);
311
312        #[cfg(feature = "UIShadowProperties")]
313        /// Describes a shadow applied by the background.
314        /// Defaults to no shadow (i.e. a shadow with an opacity of 0.0).
315        #[unsafe(method(shadowProperties))]
316        #[unsafe(method_family = none)]
317        pub fn shadowProperties(&self) -> Retained<UIShadowProperties>;
318
319        /// Returns the default configuration for a plain list cell.
320        #[deprecated]
321        #[unsafe(method(listPlainCellConfiguration))]
322        #[unsafe(method_family = none)]
323        pub fn listPlainCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
324
325        /// Returns the default configuration for a grouped list cell.
326        #[deprecated]
327        #[unsafe(method(listGroupedCellConfiguration))]
328        #[unsafe(method_family = none)]
329        pub fn listGroupedCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
330
331        /// Returns the default configuration for a sidebar list cell.
332        #[deprecated]
333        #[unsafe(method(listSidebarCellConfiguration))]
334        #[unsafe(method_family = none)]
335        pub fn listSidebarCellConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
336
337        /// Returns the default configuration for a plain list header or footer.
338        #[deprecated = "Use +listHeaderConfiguration or +listFooterConfiguration"]
339        #[unsafe(method(listPlainHeaderFooterConfiguration))]
340        #[unsafe(method_family = none)]
341        pub fn listPlainHeaderFooterConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
342
343        /// Returns the default configuration for a grouped list header or footer.
344        #[deprecated = "Use +listHeaderConfiguration or +listFooterConfiguration"]
345        #[unsafe(method(listGroupedHeaderFooterConfiguration))]
346        #[unsafe(method_family = none)]
347        pub fn listGroupedHeaderFooterConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
348
349        /// Returns the default configuration for a sidebar list header.
350        #[deprecated = "Use +listHeaderConfiguration or +listFooterConfiguration"]
351        #[unsafe(method(listSidebarHeaderConfiguration))]
352        #[unsafe(method_family = none)]
353        pub fn listSidebarHeaderConfiguration(mtm: MainThreadMarker) -> Retained<Self>;
354    );
355}