objc2_ui_kit/generated/
UIBarAppearance.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
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibarappearance?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct UIBarAppearance;
16);
17
18extern_conformance!(
19    unsafe impl NSCoding for UIBarAppearance {}
20);
21
22extern_conformance!(
23    unsafe impl NSCopying for UIBarAppearance {}
24);
25
26unsafe impl CopyingHelper for UIBarAppearance {
27    type Result = Self;
28}
29
30extern_conformance!(
31    unsafe impl NSObjectProtocol for UIBarAppearance {}
32);
33
34extern_conformance!(
35    unsafe impl NSSecureCoding for UIBarAppearance {}
36);
37
38impl UIBarAppearance {
39    extern_methods!(
40        /// Constructs a new bar appearance, configured with default values and targeting the device idiom.
41        #[unsafe(method(init))]
42        #[unsafe(method_family = init)]
43        pub fn init(this: Allocated<Self>) -> Retained<Self>;
44
45        #[cfg(feature = "UIDevice")]
46        /// Constructs a new bar appearance, targeting the passed-in idiom as a hint. Not all platforms support all available idioms. See the idiom property to determine the resolved idiom.
47        #[unsafe(method(initWithIdiom:))]
48        #[unsafe(method_family = init)]
49        pub fn initWithIdiom(this: Allocated<Self>, idiom: UIUserInterfaceIdiom) -> Retained<Self>;
50
51        #[cfg(feature = "UIDevice")]
52        /// The idiom that this appearance object targets.
53        #[unsafe(method(idiom))]
54        #[unsafe(method_family = none)]
55        pub fn idiom(&self) -> UIUserInterfaceIdiom;
56
57        /// Constructs a new bar appearance, copying all relevant properties from the given appearance object. This initializer is useful for migrating configuration between UIBarAppearance subclasses. For example, you can initialize a UINavigationBarAppearance with a UIToolbarAppearance instance, and shared attributes will be identical between the two.
58        #[unsafe(method(initWithBarAppearance:))]
59        #[unsafe(method_family = init)]
60        pub fn initWithBarAppearance(
61            this: Allocated<Self>,
62            bar_appearance: &UIBarAppearance,
63        ) -> Retained<Self>;
64
65        /// # Safety
66        ///
67        /// `coder` possibly has further requirements.
68        #[unsafe(method(initWithCoder:))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
71
72        #[unsafe(method(copy))]
73        #[unsafe(method_family = copy)]
74        pub fn copy(&self) -> Retained<Self>;
75
76        /// Reset background and shadow properties to their defaults.
77        #[unsafe(method(configureWithDefaultBackground))]
78        #[unsafe(method_family = none)]
79        pub fn configureWithDefaultBackground(&self);
80
81        /// Reset background and shadow properties to display theme-appropriate opaque colors.
82        #[unsafe(method(configureWithOpaqueBackground))]
83        #[unsafe(method_family = none)]
84        pub fn configureWithOpaqueBackground(&self);
85
86        /// Reset background and shadow properties to be transparent.
87        #[unsafe(method(configureWithTransparentBackground))]
88        #[unsafe(method_family = none)]
89        pub fn configureWithTransparentBackground(&self);
90
91        #[cfg(all(feature = "UIBlurEffect", feature = "UIVisualEffect"))]
92        /// A specific blur effect to use for the bar background. This effect is composited first when constructing the bar's background.
93        #[unsafe(method(backgroundEffect))]
94        #[unsafe(method_family = none)]
95        pub fn backgroundEffect(&self) -> Option<Retained<UIBlurEffect>>;
96
97        #[cfg(all(feature = "UIBlurEffect", feature = "UIVisualEffect"))]
98        /// Setter for [`backgroundEffect`][Self::backgroundEffect].
99        ///
100        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
101        #[unsafe(method(setBackgroundEffect:))]
102        #[unsafe(method_family = none)]
103        pub fn setBackgroundEffect(&self, background_effect: Option<&UIBlurEffect>);
104
105        #[cfg(feature = "UIColor")]
106        /// A color to use for the bar background. This color is composited over backgroundEffects.
107        #[unsafe(method(backgroundColor))]
108        #[unsafe(method_family = none)]
109        pub fn backgroundColor(&self) -> Option<Retained<UIColor>>;
110
111        #[cfg(feature = "UIColor")]
112        /// Setter for [`backgroundColor`][Self::backgroundColor].
113        ///
114        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
115        #[unsafe(method(setBackgroundColor:))]
116        #[unsafe(method_family = none)]
117        pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
118
119        #[cfg(feature = "UIImage")]
120        /// An image to use for the bar background. This image is composited over the backgroundColor, and resized per the backgroundImageContentMode.
121        #[unsafe(method(backgroundImage))]
122        #[unsafe(method_family = none)]
123        pub fn backgroundImage(&self) -> Option<Retained<UIImage>>;
124
125        #[cfg(feature = "UIImage")]
126        /// Setter for [`backgroundImage`][Self::backgroundImage].
127        #[unsafe(method(setBackgroundImage:))]
128        #[unsafe(method_family = none)]
129        pub fn setBackgroundImage(&self, background_image: Option<&UIImage>);
130
131        #[cfg(feature = "UIView")]
132        /// The content mode to use when rendering the backgroundImage. Defaults to UIViewContentModeScaleToFill. UIViewContentModeRedraw will be reinterpreted as UIViewContentModeScaleToFill.
133        #[unsafe(method(backgroundImageContentMode))]
134        #[unsafe(method_family = none)]
135        pub fn backgroundImageContentMode(&self) -> UIViewContentMode;
136
137        #[cfg(feature = "UIView")]
138        /// Setter for [`backgroundImageContentMode`][Self::backgroundImageContentMode].
139        #[unsafe(method(setBackgroundImageContentMode:))]
140        #[unsafe(method_family = none)]
141        pub fn setBackgroundImageContentMode(
142            &self,
143            background_image_content_mode: UIViewContentMode,
144        );
145
146        #[cfg(feature = "UIColor")]
147        /// A color to use for the shadow. Its specific behavior depends on the value of shadowImage. If shadowImage is nil, then the shadowColor is used to color the bar's default shadow; a nil or clearColor shadowColor will result in no shadow. If shadowImage is a template image, then the shadowColor is used to tint the image; a nil or clearColor shadowColor will also result in no shadow. If the shadowImage is not a template image, then it will be rendered regardless of the value of shadowColor.
148        #[unsafe(method(shadowColor))]
149        #[unsafe(method_family = none)]
150        pub fn shadowColor(&self) -> Option<Retained<UIColor>>;
151
152        #[cfg(feature = "UIColor")]
153        /// Setter for [`shadowColor`][Self::shadowColor].
154        ///
155        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
156        #[unsafe(method(setShadowColor:))]
157        #[unsafe(method_family = none)]
158        pub fn setShadowColor(&self, shadow_color: Option<&UIColor>);
159
160        #[cfg(feature = "UIImage")]
161        /// Use an image for the shadow. See shadowColor for how they interact.
162        #[unsafe(method(shadowImage))]
163        #[unsafe(method_family = none)]
164        pub fn shadowImage(&self) -> Option<Retained<UIImage>>;
165
166        #[cfg(feature = "UIImage")]
167        /// Setter for [`shadowImage`][Self::shadowImage].
168        #[unsafe(method(setShadowImage:))]
169        #[unsafe(method_family = none)]
170        pub fn setShadowImage(&self, shadow_image: Option<&UIImage>);
171    );
172}
173
174/// Methods declared on superclass `NSObject`.
175impl UIBarAppearance {
176    extern_methods!(
177        #[unsafe(method(new))]
178        #[unsafe(method_family = new)]
179        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
180    );
181}