objc2_ui_kit/generated/
UITabBarItem.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
10/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbarsystemitem?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UITabBarSystemItem(pub NSInteger);
15impl UITabBarSystemItem {
16    #[doc(alias = "UITabBarSystemItemMore")]
17    pub const More: Self = Self(0);
18    #[doc(alias = "UITabBarSystemItemFavorites")]
19    pub const Favorites: Self = Self(1);
20    #[doc(alias = "UITabBarSystemItemFeatured")]
21    pub const Featured: Self = Self(2);
22    #[doc(alias = "UITabBarSystemItemTopRated")]
23    pub const TopRated: Self = Self(3);
24    #[doc(alias = "UITabBarSystemItemRecents")]
25    pub const Recents: Self = Self(4);
26    #[doc(alias = "UITabBarSystemItemContacts")]
27    pub const Contacts: Self = Self(5);
28    #[doc(alias = "UITabBarSystemItemHistory")]
29    pub const History: Self = Self(6);
30    #[doc(alias = "UITabBarSystemItemBookmarks")]
31    pub const Bookmarks: Self = Self(7);
32    #[doc(alias = "UITabBarSystemItemSearch")]
33    pub const Search: Self = Self(8);
34    #[doc(alias = "UITabBarSystemItemDownloads")]
35    pub const Downloads: Self = Self(9);
36    #[doc(alias = "UITabBarSystemItemMostRecent")]
37    pub const MostRecent: Self = Self(10);
38    #[doc(alias = "UITabBarSystemItemMostViewed")]
39    pub const MostViewed: Self = Self(11);
40}
41
42unsafe impl Encode for UITabBarSystemItem {
43    const ENCODING: Encoding = NSInteger::ENCODING;
44}
45
46unsafe impl RefEncode for UITabBarSystemItem {
47    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}
49
50extern_class!(
51    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbaritem?language=objc)
52    #[unsafe(super(UIBarItem, NSObject))]
53    #[thread_kind = MainThreadOnly]
54    #[derive(Debug, PartialEq, Eq, Hash)]
55    #[cfg(feature = "UIBarItem")]
56    pub struct UITabBarItem;
57);
58
59#[cfg(feature = "UIBarItem")]
60extern_conformance!(
61    unsafe impl NSCoding for UITabBarItem {}
62);
63
64#[cfg(feature = "UIBarItem")]
65extern_conformance!(
66    unsafe impl NSObjectProtocol for UITabBarItem {}
67);
68
69#[cfg(all(feature = "UIAppearance", feature = "UIBarItem"))]
70extern_conformance!(
71    unsafe impl UIAppearance for UITabBarItem {}
72);
73
74#[cfg(feature = "UIBarItem")]
75impl UITabBarItem {
76    extern_methods!(
77        #[unsafe(method(init))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
80
81        #[unsafe(method(initWithCoder:))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn initWithCoder(
84            this: Allocated<Self>,
85            coder: &NSCoder,
86        ) -> Option<Retained<Self>>;
87
88        #[cfg(feature = "UIImage")]
89        #[unsafe(method(initWithTitle:image:tag:))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn initWithTitle_image_tag(
92            this: Allocated<Self>,
93            title: Option<&NSString>,
94            image: Option<&UIImage>,
95            tag: NSInteger,
96        ) -> Retained<Self>;
97
98        #[cfg(feature = "UIImage")]
99        #[unsafe(method(initWithTitle:image:selectedImage:))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn initWithTitle_image_selectedImage(
102            this: Allocated<Self>,
103            title: Option<&NSString>,
104            image: Option<&UIImage>,
105            selected_image: Option<&UIImage>,
106        ) -> Retained<Self>;
107
108        #[unsafe(method(initWithTabBarSystemItem:tag:))]
109        #[unsafe(method_family = init)]
110        pub unsafe fn initWithTabBarSystemItem_tag(
111            this: Allocated<Self>,
112            system_item: UITabBarSystemItem,
113            tag: NSInteger,
114        ) -> Retained<Self>;
115
116        #[cfg(feature = "UIImage")]
117        #[unsafe(method(selectedImage))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn selectedImage(&self) -> Option<Retained<UIImage>>;
120
121        #[cfg(feature = "UIImage")]
122        /// Setter for [`selectedImage`][Self::selectedImage].
123        #[unsafe(method(setSelectedImage:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setSelectedImage(&self, selected_image: Option<&UIImage>);
126
127        #[unsafe(method(badgeValue))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn badgeValue(&self) -> Option<Retained<NSString>>;
130
131        /// Setter for [`badgeValue`][Self::badgeValue].
132        #[unsafe(method(setBadgeValue:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setBadgeValue(&self, badge_value: Option<&NSString>);
135
136        #[cfg(feature = "UIImage")]
137        #[deprecated = "Use initWithTitle:image:selectedImage: or the image and selectedImage properties along with UIImageRenderingModeAlwaysOriginal"]
138        #[unsafe(method(setFinishedSelectedImage:withFinishedUnselectedImage:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setFinishedSelectedImage_withFinishedUnselectedImage(
141            &self,
142            selected_image: Option<&UIImage>,
143            unselected_image: Option<&UIImage>,
144        );
145
146        #[cfg(feature = "UIImage")]
147        #[deprecated]
148        #[unsafe(method(finishedSelectedImage))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn finishedSelectedImage(&self) -> Option<Retained<UIImage>>;
151
152        #[cfg(feature = "UIImage")]
153        #[deprecated]
154        #[unsafe(method(finishedUnselectedImage))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn finishedUnselectedImage(&self) -> Option<Retained<UIImage>>;
157
158        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
159        #[unsafe(method(titlePositionAdjustment))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn titlePositionAdjustment(&self) -> UIOffset;
162
163        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
164        /// Setter for [`titlePositionAdjustment`][Self::titlePositionAdjustment].
165        #[unsafe(method(setTitlePositionAdjustment:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setTitlePositionAdjustment(&self, title_position_adjustment: UIOffset);
168
169        #[cfg(feature = "UIColor")]
170        /// If this item displays a badge, this color will be used for the badge's background. If set to nil, the default background color will be used instead.
171        #[unsafe(method(badgeColor))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn badgeColor(&self) -> Option<Retained<UIColor>>;
174
175        #[cfg(feature = "UIColor")]
176        /// Setter for [`badgeColor`][Self::badgeColor].
177        #[unsafe(method(setBadgeColor:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setBadgeColor(&self, badge_color: Option<&UIColor>);
180
181        #[cfg(feature = "UIControl")]
182        /// Provide text attributes to use to draw the badge text for the given singular control state (Normal, Disabled, Focused, Selected, or Highlighted). Default values will be supplied for keys that are not provided by this dictionary. See NSAttributedString.h for details on what keys are available.
183        #[unsafe(method(setBadgeTextAttributes:forState:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setBadgeTextAttributes_forState(
186            &self,
187            text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
188            state: UIControlState,
189        );
190
191        #[cfg(feature = "UIControl")]
192        /// Returns attributes previously set via -setBadgeTextAttributes:forState:.
193        #[unsafe(method(badgeTextAttributesForState:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn badgeTextAttributesForState(
196            &self,
197            state: UIControlState,
198        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
199
200        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
201        /// When set and this item is selected, overrides the hosting tab bar's standardAppearance.
202        #[unsafe(method(standardAppearance))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn standardAppearance(&self) -> Option<Retained<UITabBarAppearance>>;
205
206        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
207        /// Setter for [`standardAppearance`][Self::standardAppearance].
208        #[unsafe(method(setStandardAppearance:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn setStandardAppearance(
211            &self,
212            standard_appearance: Option<&UITabBarAppearance>,
213        );
214
215        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
216        /// When set and this item is selected, overrides the hosting tab bar's scrollEdgeAppearance.
217        #[unsafe(method(scrollEdgeAppearance))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UITabBarAppearance>>;
220
221        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
222        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
223        #[unsafe(method(setScrollEdgeAppearance:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setScrollEdgeAppearance(
226            &self,
227            scroll_edge_appearance: Option<&UITabBarAppearance>,
228        );
229    );
230}
231
232/// Methods declared on superclass `NSObject`.
233#[cfg(feature = "UIBarItem")]
234impl UITabBarItem {
235    extern_methods!(
236        #[unsafe(method(new))]
237        #[unsafe(method_family = new)]
238        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
239    );
240}
241
242/// SpringLoading.
243#[cfg(feature = "UIBarItem")]
244impl UITabBarItem {
245    extern_methods!();
246}
247
248#[cfg(all(feature = "UIBarItem", feature = "UISpringLoadedInteractionSupporting"))]
249extern_conformance!(
250    unsafe impl UISpringLoadedInteractionSupporting for UITabBarItem {}
251);