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