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 unsafe 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 unsafe fn initWithIdiom(
50            this: Allocated<Self>,
51            idiom: UIUserInterfaceIdiom,
52        ) -> Retained<Self>;
53
54        #[cfg(feature = "UIDevice")]
55        /// The idiom that this appearance object targets.
56        #[unsafe(method(idiom))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn idiom(&self) -> UIUserInterfaceIdiom;
59
60        /// 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.
61        #[unsafe(method(initWithBarAppearance:))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn initWithBarAppearance(
64            this: Allocated<Self>,
65            bar_appearance: &UIBarAppearance,
66        ) -> Retained<Self>;
67
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 unsafe 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 unsafe 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 unsafe fn configureWithOpaqueBackground(&self);
85
86        /// Reset background and shadow properties to be transparent.
87        #[unsafe(method(configureWithTransparentBackground))]
88        #[unsafe(method_family = none)]
89        pub unsafe 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 unsafe fn backgroundEffect(&self) -> Option<Retained<UIBlurEffect>>;
96
97        #[cfg(all(feature = "UIBlurEffect", feature = "UIVisualEffect"))]
98        /// Setter for [`backgroundEffect`][Self::backgroundEffect].
99        #[unsafe(method(setBackgroundEffect:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setBackgroundEffect(&self, background_effect: Option<&UIBlurEffect>);
102
103        #[cfg(feature = "UIColor")]
104        /// A color to use for the bar background. This color is composited over backgroundEffects.
105        #[unsafe(method(backgroundColor))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
108
109        #[cfg(feature = "UIColor")]
110        /// Setter for [`backgroundColor`][Self::backgroundColor].
111        #[unsafe(method(setBackgroundColor:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
114
115        #[cfg(feature = "UIImage")]
116        /// An image to use for the bar background. This image is composited over the backgroundColor, and resized per the backgroundImageContentMode.
117        #[unsafe(method(backgroundImage))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn backgroundImage(&self) -> Option<Retained<UIImage>>;
120
121        #[cfg(feature = "UIImage")]
122        /// Setter for [`backgroundImage`][Self::backgroundImage].
123        #[unsafe(method(setBackgroundImage:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setBackgroundImage(&self, background_image: Option<&UIImage>);
126
127        #[cfg(feature = "UIView")]
128        /// The content mode to use when rendering the backgroundImage. Defaults to UIViewContentModeScaleToFill. UIViewContentModeRedraw will be reinterpreted as UIViewContentModeScaleToFill.
129        #[unsafe(method(backgroundImageContentMode))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn backgroundImageContentMode(&self) -> UIViewContentMode;
132
133        #[cfg(feature = "UIView")]
134        /// Setter for [`backgroundImageContentMode`][Self::backgroundImageContentMode].
135        #[unsafe(method(setBackgroundImageContentMode:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setBackgroundImageContentMode(
138            &self,
139            background_image_content_mode: UIViewContentMode,
140        );
141
142        #[cfg(feature = "UIColor")]
143        /// 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.
144        #[unsafe(method(shadowColor))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn shadowColor(&self) -> Option<Retained<UIColor>>;
147
148        #[cfg(feature = "UIColor")]
149        /// Setter for [`shadowColor`][Self::shadowColor].
150        #[unsafe(method(setShadowColor:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setShadowColor(&self, shadow_color: Option<&UIColor>);
153
154        #[cfg(feature = "UIImage")]
155        /// Use an image for the shadow. See shadowColor for how they interact.
156        #[unsafe(method(shadowImage))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn shadowImage(&self) -> Option<Retained<UIImage>>;
159
160        #[cfg(feature = "UIImage")]
161        /// Setter for [`shadowImage`][Self::shadowImage].
162        #[unsafe(method(setShadowImage:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setShadowImage(&self, shadow_image: Option<&UIImage>);
165    );
166}
167
168/// Methods declared on superclass `NSObject`.
169impl UIBarAppearance {
170    extern_methods!(
171        #[unsafe(method(new))]
172        #[unsafe(method_family = new)]
173        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
174    );
175}