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
18unsafe impl NSCoding for UIBarAppearance {}
19
20unsafe impl NSCopying for UIBarAppearance {}
21
22unsafe impl CopyingHelper for UIBarAppearance {
23    type Result = Self;
24}
25
26unsafe impl NSObjectProtocol for UIBarAppearance {}
27
28unsafe impl NSSecureCoding for UIBarAppearance {}
29
30impl UIBarAppearance {
31    extern_methods!(
32        /// Constructs a new bar appearance, configured with default values and targeting the device idiom.
33        #[unsafe(method(init))]
34        #[unsafe(method_family = init)]
35        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
36
37        #[cfg(feature = "UIDevice")]
38        /// 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.
39        #[unsafe(method(initWithIdiom:))]
40        #[unsafe(method_family = init)]
41        pub unsafe fn initWithIdiom(
42            this: Allocated<Self>,
43            idiom: UIUserInterfaceIdiom,
44        ) -> Retained<Self>;
45
46        #[cfg(feature = "UIDevice")]
47        /// The idiom that this appearance object targets.
48        #[unsafe(method(idiom))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn idiom(&self) -> UIUserInterfaceIdiom;
51
52        /// 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.
53        #[unsafe(method(initWithBarAppearance:))]
54        #[unsafe(method_family = init)]
55        pub unsafe fn initWithBarAppearance(
56            this: Allocated<Self>,
57            bar_appearance: &UIBarAppearance,
58        ) -> Retained<Self>;
59
60        #[unsafe(method(initWithCoder:))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
63
64        #[unsafe(method(copy))]
65        #[unsafe(method_family = copy)]
66        pub unsafe fn copy(&self) -> Retained<Self>;
67
68        /// Reset background and shadow properties to their defaults.
69        #[unsafe(method(configureWithDefaultBackground))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn configureWithDefaultBackground(&self);
72
73        /// Reset background and shadow properties to display theme-appropriate opaque colors.
74        #[unsafe(method(configureWithOpaqueBackground))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn configureWithOpaqueBackground(&self);
77
78        /// Reset background and shadow properties to be transparent.
79        #[unsafe(method(configureWithTransparentBackground))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn configureWithTransparentBackground(&self);
82
83        #[cfg(all(feature = "UIBlurEffect", feature = "UIVisualEffect"))]
84        /// A specific blur effect to use for the bar background. This effect is composited first when constructing the bar's background.
85        #[unsafe(method(backgroundEffect))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn backgroundEffect(&self) -> Option<Retained<UIBlurEffect>>;
88
89        #[cfg(all(feature = "UIBlurEffect", feature = "UIVisualEffect"))]
90        /// Setter for [`backgroundEffect`][Self::backgroundEffect].
91        #[unsafe(method(setBackgroundEffect:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setBackgroundEffect(&self, background_effect: Option<&UIBlurEffect>);
94
95        #[cfg(feature = "UIColor")]
96        /// A color to use for the bar background. This color is composited over backgroundEffects.
97        #[unsafe(method(backgroundColor))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
100
101        #[cfg(feature = "UIColor")]
102        /// Setter for [`backgroundColor`][Self::backgroundColor].
103        #[unsafe(method(setBackgroundColor:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
106
107        #[cfg(feature = "UIImage")]
108        /// An image to use for the bar background. This image is composited over the backgroundColor, and resized per the backgroundImageContentMode.
109        #[unsafe(method(backgroundImage))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn backgroundImage(&self) -> Option<Retained<UIImage>>;
112
113        #[cfg(feature = "UIImage")]
114        /// Setter for [`backgroundImage`][Self::backgroundImage].
115        #[unsafe(method(setBackgroundImage:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setBackgroundImage(&self, background_image: Option<&UIImage>);
118
119        #[cfg(feature = "UIView")]
120        /// The content mode to use when rendering the backgroundImage. Defaults to UIViewContentModeScaleToFill. UIViewContentModeRedraw will be reinterpreted as UIViewContentModeScaleToFill.
121        #[unsafe(method(backgroundImageContentMode))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn backgroundImageContentMode(&self) -> UIViewContentMode;
124
125        #[cfg(feature = "UIView")]
126        /// Setter for [`backgroundImageContentMode`][Self::backgroundImageContentMode].
127        #[unsafe(method(setBackgroundImageContentMode:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setBackgroundImageContentMode(
130            &self,
131            background_image_content_mode: UIViewContentMode,
132        );
133
134        #[cfg(feature = "UIColor")]
135        /// 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.
136        #[unsafe(method(shadowColor))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn shadowColor(&self) -> Option<Retained<UIColor>>;
139
140        #[cfg(feature = "UIColor")]
141        /// Setter for [`shadowColor`][Self::shadowColor].
142        #[unsafe(method(setShadowColor:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setShadowColor(&self, shadow_color: Option<&UIColor>);
145
146        #[cfg(feature = "UIImage")]
147        /// Use an image for the shadow. See shadowColor for how they interact.
148        #[unsafe(method(shadowImage))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn shadowImage(&self) -> Option<Retained<UIImage>>;
151
152        #[cfg(feature = "UIImage")]
153        /// Setter for [`shadowImage`][Self::shadowImage].
154        #[unsafe(method(setShadowImage:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setShadowImage(&self, shadow_image: Option<&UIImage>);
157    );
158}
159
160/// Methods declared on superclass `NSObject`.
161impl UIBarAppearance {
162    extern_methods!(
163        #[unsafe(method(new))]
164        #[unsafe(method_family = new)]
165        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
166    );
167}