objc2_ui_kit/generated/
UITabBarAppearance.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/uitabbaritemstateappearance?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct UITabBarItemStateAppearance;
18);
19
20extern_conformance!(
21    unsafe impl NSObjectProtocol for UITabBarItemStateAppearance {}
22);
23
24impl UITabBarItemStateAppearance {
25    extern_methods!(
26        #[unsafe(method(init))]
27        #[unsafe(method_family = init)]
28        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
29
30        #[unsafe(method(new))]
31        #[unsafe(method_family = new)]
32        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
33
34        /// Text attributes to be used for rendering title text. If the font or color are unspecified, appropriate defaults are supplied.
35        #[unsafe(method(titleTextAttributes))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn titleTextAttributes(
38            &self,
39        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
40
41        /// Setter for [`titleTextAttributes`][Self::titleTextAttributes].
42        #[unsafe(method(setTitleTextAttributes:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn setTitleTextAttributes(
45            &self,
46            title_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
47        );
48
49        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
50        /// An offset to apply to the UITabBarItem's title position
51        #[unsafe(method(titlePositionAdjustment))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn titlePositionAdjustment(&self) -> UIOffset;
54
55        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
56        /// Setter for [`titlePositionAdjustment`][Self::titlePositionAdjustment].
57        #[unsafe(method(setTitlePositionAdjustment:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setTitlePositionAdjustment(&self, title_position_adjustment: UIOffset);
60
61        #[cfg(feature = "UIColor")]
62        /// The color to use for item icons. If not specified, a suitable color will be derived.
63        #[unsafe(method(iconColor))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn iconColor(&self) -> Option<Retained<UIColor>>;
66
67        #[cfg(feature = "UIColor")]
68        /// Setter for [`iconColor`][Self::iconColor].
69        #[unsafe(method(setIconColor:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setIconColor(&self, icon_color: Option<&UIColor>);
72
73        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
74        /// An offset to apply to the badge's position
75        #[unsafe(method(badgePositionAdjustment))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn badgePositionAdjustment(&self) -> UIOffset;
78
79        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
80        /// Setter for [`badgePositionAdjustment`][Self::badgePositionAdjustment].
81        #[unsafe(method(setBadgePositionAdjustment:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn setBadgePositionAdjustment(&self, badge_position_adjustment: UIOffset);
84
85        #[cfg(feature = "UIColor")]
86        /// The color to use for the badge background
87        #[unsafe(method(badgeBackgroundColor))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn badgeBackgroundColor(&self) -> Option<Retained<UIColor>>;
90
91        #[cfg(feature = "UIColor")]
92        /// Setter for [`badgeBackgroundColor`][Self::badgeBackgroundColor].
93        #[unsafe(method(setBadgeBackgroundColor:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setBadgeBackgroundColor(&self, badge_background_color: Option<&UIColor>);
96
97        /// Text attributes to be used for rendering badge text. If the font and color are unspecified, appropriate defaults are supplied.
98        #[unsafe(method(badgeTextAttributes))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn badgeTextAttributes(
101            &self,
102        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
103
104        /// Setter for [`badgeTextAttributes`][Self::badgeTextAttributes].
105        #[unsafe(method(setBadgeTextAttributes:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setBadgeTextAttributes(
108            &self,
109            badge_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
110        );
111
112        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
113        /// An offset to apply to the badge's title position
114        #[unsafe(method(badgeTitlePositionAdjustment))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn badgeTitlePositionAdjustment(&self) -> UIOffset;
117
118        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
119        /// Setter for [`badgeTitlePositionAdjustment`][Self::badgeTitlePositionAdjustment].
120        #[unsafe(method(setBadgeTitlePositionAdjustment:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setBadgeTitlePositionAdjustment(
123            &self,
124            badge_title_position_adjustment: UIOffset,
125        );
126    );
127}
128
129/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbaritemappearancestyle?language=objc)
130// NS_ENUM
131#[repr(transparent)]
132#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
133pub struct UITabBarItemAppearanceStyle(pub NSInteger);
134impl UITabBarItemAppearanceStyle {
135    #[doc(alias = "UITabBarItemAppearanceStyleStacked")]
136    pub const Stacked: Self = Self(0);
137    #[doc(alias = "UITabBarItemAppearanceStyleInline")]
138    pub const Inline: Self = Self(1);
139    #[doc(alias = "UITabBarItemAppearanceStyleCompactInline")]
140    pub const CompactInline: Self = Self(2);
141}
142
143unsafe impl Encode for UITabBarItemAppearanceStyle {
144    const ENCODING: Encoding = NSInteger::ENCODING;
145}
146
147unsafe impl RefEncode for UITabBarItemAppearanceStyle {
148    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
149}
150
151extern_class!(
152    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbaritemappearance?language=objc)
153    #[unsafe(super(NSObject))]
154    #[thread_kind = MainThreadOnly]
155    #[derive(Debug, PartialEq, Eq, Hash)]
156    pub struct UITabBarItemAppearance;
157);
158
159extern_conformance!(
160    unsafe impl NSCoding for UITabBarItemAppearance {}
161);
162
163extern_conformance!(
164    unsafe impl NSCopying for UITabBarItemAppearance {}
165);
166
167unsafe impl CopyingHelper for UITabBarItemAppearance {
168    type Result = Self;
169}
170
171extern_conformance!(
172    unsafe impl NSObjectProtocol for UITabBarItemAppearance {}
173);
174
175extern_conformance!(
176    unsafe impl NSSecureCoding for UITabBarItemAppearance {}
177);
178
179impl UITabBarItemAppearance {
180    extern_methods!(
181        /// Construct an appearance with default values for the stacked layout.
182        #[unsafe(method(init))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
185
186        /// Construct an appearance with default values for the given layout.
187        #[unsafe(method(initWithStyle:))]
188        #[unsafe(method_family = init)]
189        pub unsafe fn initWithStyle(
190            this: Allocated<Self>,
191            style: UITabBarItemAppearanceStyle,
192        ) -> Retained<Self>;
193
194        #[unsafe(method(initWithCoder:))]
195        #[unsafe(method_family = init)]
196        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
197
198        #[unsafe(method(copy))]
199        #[unsafe(method_family = copy)]
200        pub unsafe fn copy(&self) -> Retained<Self>;
201
202        /// Reset this appearance to that of the given layout.
203        #[unsafe(method(configureWithDefaultForStyle:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn configureWithDefaultForStyle(&self, style: UITabBarItemAppearanceStyle);
206
207        /// The appearance when the tab bar item is in the normal state
208        #[unsafe(method(normal))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn normal(&self) -> Retained<UITabBarItemStateAppearance>;
211
212        /// The appearance when the tab bar item is in the selected state
213        #[unsafe(method(selected))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn selected(&self) -> Retained<UITabBarItemStateAppearance>;
216
217        /// The appearance when the tab bar item is in the disabled state
218        #[unsafe(method(disabled))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn disabled(&self) -> Retained<UITabBarItemStateAppearance>;
221
222        /// The appearance when the tab bar item is in the focused state
223        #[unsafe(method(focused))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn focused(&self) -> Retained<UITabBarItemStateAppearance>;
226    );
227}
228
229/// Methods declared on superclass `NSObject`.
230impl UITabBarItemAppearance {
231    extern_methods!(
232        #[unsafe(method(new))]
233        #[unsafe(method_family = new)]
234        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
235    );
236}
237
238extern_class!(
239    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbarappearance?language=objc)
240    #[unsafe(super(UIBarAppearance, NSObject))]
241    #[thread_kind = MainThreadOnly]
242    #[derive(Debug, PartialEq, Eq, Hash)]
243    #[cfg(feature = "UIBarAppearance")]
244    pub struct UITabBarAppearance;
245);
246
247#[cfg(feature = "UIBarAppearance")]
248extern_conformance!(
249    unsafe impl NSCoding for UITabBarAppearance {}
250);
251
252#[cfg(feature = "UIBarAppearance")]
253extern_conformance!(
254    unsafe impl NSCopying for UITabBarAppearance {}
255);
256
257#[cfg(feature = "UIBarAppearance")]
258unsafe impl CopyingHelper for UITabBarAppearance {
259    type Result = Self;
260}
261
262#[cfg(feature = "UIBarAppearance")]
263extern_conformance!(
264    unsafe impl NSObjectProtocol for UITabBarAppearance {}
265);
266
267#[cfg(feature = "UIBarAppearance")]
268extern_conformance!(
269    unsafe impl NSSecureCoding for UITabBarAppearance {}
270);
271
272#[cfg(feature = "UIBarAppearance")]
273impl UITabBarAppearance {
274    extern_methods!(
275        /// The appearance for the stacked tab bar item layout
276        #[unsafe(method(stackedLayoutAppearance))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn stackedLayoutAppearance(&self) -> Retained<UITabBarItemAppearance>;
279
280        /// Setter for [`stackedLayoutAppearance`][Self::stackedLayoutAppearance].
281        #[unsafe(method(setStackedLayoutAppearance:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn setStackedLayoutAppearance(
284            &self,
285            stacked_layout_appearance: &UITabBarItemAppearance,
286        );
287
288        /// The appearance for the inline tab bar item layout
289        #[unsafe(method(inlineLayoutAppearance))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn inlineLayoutAppearance(&self) -> Retained<UITabBarItemAppearance>;
292
293        /// Setter for [`inlineLayoutAppearance`][Self::inlineLayoutAppearance].
294        #[unsafe(method(setInlineLayoutAppearance:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn setInlineLayoutAppearance(
297            &self,
298            inline_layout_appearance: &UITabBarItemAppearance,
299        );
300
301        /// The appearance for the compact inline tab bar item layout
302        #[unsafe(method(compactInlineLayoutAppearance))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn compactInlineLayoutAppearance(&self) -> Retained<UITabBarItemAppearance>;
305
306        /// Setter for [`compactInlineLayoutAppearance`][Self::compactInlineLayoutAppearance].
307        #[unsafe(method(setCompactInlineLayoutAppearance:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setCompactInlineLayoutAppearance(
310            &self,
311            compact_inline_layout_appearance: &UITabBarItemAppearance,
312        );
313
314        #[cfg(feature = "UIColor")]
315        /// A color to use for the selectionIndicator, its specific behavior depends on the value of selectionIndicatorImage. If selectionIndicatorImage is nil, then the selectionIndicatorTintColor is used to color the UITabBar's default selection indicator; a nil or clearColor selectionIndicatorTintColor will result in no indicator. If selectionIndicatorImage is a template image, then the selectionIndicatorTintColor is used to tint the image; a nil or clearColor selectionIndicatorTintColor will also result in no indicator. If the selectionIndicatorImage is not a template image, then it will be rendered without respect to the value of selectionIndicatorTintColor.
316        #[unsafe(method(selectionIndicatorTintColor))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn selectionIndicatorTintColor(&self) -> Option<Retained<UIColor>>;
319
320        #[cfg(feature = "UIColor")]
321        /// Setter for [`selectionIndicatorTintColor`][Self::selectionIndicatorTintColor].
322        #[unsafe(method(setSelectionIndicatorTintColor:))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn setSelectionIndicatorTintColor(
325            &self,
326            selection_indicator_tint_color: Option<&UIColor>,
327        );
328
329        #[cfg(feature = "UIImage")]
330        /// An image that is rendered behind the selected UITabBarItem and above the tab bar's background. Modified by selectionIndicatorTintColor when appropriate.
331        #[unsafe(method(selectionIndicatorImage))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn selectionIndicatorImage(&self) -> Option<Retained<UIImage>>;
334
335        #[cfg(feature = "UIImage")]
336        /// Setter for [`selectionIndicatorImage`][Self::selectionIndicatorImage].
337        #[unsafe(method(setSelectionIndicatorImage:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn setSelectionIndicatorImage(
340            &self,
341            selection_indicator_image: Option<&UIImage>,
342        );
343
344        #[cfg(feature = "UITabBar")]
345        /// Determines how items in the tab bar lay out in the stacked item layout
346        #[unsafe(method(stackedItemPositioning))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn stackedItemPositioning(&self) -> UITabBarItemPositioning;
349
350        #[cfg(feature = "UITabBar")]
351        /// Setter for [`stackedItemPositioning`][Self::stackedItemPositioning].
352        #[unsafe(method(setStackedItemPositioning:))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn setStackedItemPositioning(
355            &self,
356            stacked_item_positioning: UITabBarItemPositioning,
357        );
358
359        #[cfg(feature = "objc2-core-foundation")]
360        #[unsafe(method(stackedItemWidth))]
361        #[unsafe(method_family = none)]
362        pub unsafe fn stackedItemWidth(&self) -> CGFloat;
363
364        #[cfg(feature = "objc2-core-foundation")]
365        /// Setter for [`stackedItemWidth`][Self::stackedItemWidth].
366        #[unsafe(method(setStackedItemWidth:))]
367        #[unsafe(method_family = none)]
368        pub unsafe fn setStackedItemWidth(&self, stacked_item_width: CGFloat);
369
370        #[cfg(feature = "objc2-core-foundation")]
371        #[unsafe(method(stackedItemSpacing))]
372        #[unsafe(method_family = none)]
373        pub unsafe fn stackedItemSpacing(&self) -> CGFloat;
374
375        #[cfg(feature = "objc2-core-foundation")]
376        /// Setter for [`stackedItemSpacing`][Self::stackedItemSpacing].
377        #[unsafe(method(setStackedItemSpacing:))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn setStackedItemSpacing(&self, stacked_item_spacing: CGFloat);
380    );
381}
382
383/// Methods declared on superclass `UIBarAppearance`.
384#[cfg(feature = "UIBarAppearance")]
385impl UITabBarAppearance {
386    extern_methods!(
387        /// Constructs a new bar appearance, configured with default values and targeting the device idiom.
388        #[unsafe(method(init))]
389        #[unsafe(method_family = init)]
390        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
391
392        #[cfg(feature = "UIDevice")]
393        /// 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.
394        #[unsafe(method(initWithIdiom:))]
395        #[unsafe(method_family = init)]
396        pub unsafe fn initWithIdiom(
397            this: Allocated<Self>,
398            idiom: UIUserInterfaceIdiom,
399        ) -> Retained<Self>;
400
401        /// 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.
402        #[unsafe(method(initWithBarAppearance:))]
403        #[unsafe(method_family = init)]
404        pub unsafe fn initWithBarAppearance(
405            this: Allocated<Self>,
406            bar_appearance: &UIBarAppearance,
407        ) -> Retained<Self>;
408
409        #[unsafe(method(initWithCoder:))]
410        #[unsafe(method_family = init)]
411        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
412    );
413}
414
415/// Methods declared on superclass `NSObject`.
416#[cfg(feature = "UIBarAppearance")]
417impl UITabBarAppearance {
418    extern_methods!(
419        #[unsafe(method(new))]
420        #[unsafe(method_family = new)]
421        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
422    );
423}