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 fn init(this: Allocated<Self>) -> Retained<Self>;
80
81        /// # Safety
82        ///
83        /// `coder` possibly has further requirements.
84        #[unsafe(method(initWithCoder:))]
85        #[unsafe(method_family = init)]
86        pub unsafe fn initWithCoder(
87            this: Allocated<Self>,
88            coder: &NSCoder,
89        ) -> Option<Retained<Self>>;
90
91        #[cfg(feature = "UIImage")]
92        #[unsafe(method(initWithTitle:image:tag:))]
93        #[unsafe(method_family = init)]
94        pub fn initWithTitle_image_tag(
95            this: Allocated<Self>,
96            title: Option<&NSString>,
97            image: Option<&UIImage>,
98            tag: NSInteger,
99        ) -> Retained<Self>;
100
101        #[cfg(feature = "UIImage")]
102        #[unsafe(method(initWithTitle:image:selectedImage:))]
103        #[unsafe(method_family = init)]
104        pub fn initWithTitle_image_selectedImage(
105            this: Allocated<Self>,
106            title: Option<&NSString>,
107            image: Option<&UIImage>,
108            selected_image: Option<&UIImage>,
109        ) -> Retained<Self>;
110
111        #[unsafe(method(initWithTabBarSystemItem:tag:))]
112        #[unsafe(method_family = init)]
113        pub fn initWithTabBarSystemItem_tag(
114            this: Allocated<Self>,
115            system_item: UITabBarSystemItem,
116            tag: NSInteger,
117        ) -> Retained<Self>;
118
119        #[cfg(feature = "UIImage")]
120        #[unsafe(method(selectedImage))]
121        #[unsafe(method_family = none)]
122        pub fn selectedImage(&self) -> Option<Retained<UIImage>>;
123
124        #[cfg(feature = "UIImage")]
125        /// Setter for [`selectedImage`][Self::selectedImage].
126        #[unsafe(method(setSelectedImage:))]
127        #[unsafe(method_family = none)]
128        pub fn setSelectedImage(&self, selected_image: Option<&UIImage>);
129
130        #[unsafe(method(badgeValue))]
131        #[unsafe(method_family = none)]
132        pub fn badgeValue(&self) -> Option<Retained<NSString>>;
133
134        /// Setter for [`badgeValue`][Self::badgeValue].
135        ///
136        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
137        #[unsafe(method(setBadgeValue:))]
138        #[unsafe(method_family = none)]
139        pub fn setBadgeValue(&self, badge_value: Option<&NSString>);
140
141        #[cfg(feature = "UIImage")]
142        #[deprecated = "Use initWithTitle:image:selectedImage: or the image and selectedImage properties along with UIImageRenderingModeAlwaysOriginal"]
143        #[unsafe(method(setFinishedSelectedImage:withFinishedUnselectedImage:))]
144        #[unsafe(method_family = none)]
145        pub fn setFinishedSelectedImage_withFinishedUnselectedImage(
146            &self,
147            selected_image: Option<&UIImage>,
148            unselected_image: Option<&UIImage>,
149        );
150
151        #[cfg(feature = "UIImage")]
152        #[deprecated]
153        #[unsafe(method(finishedSelectedImage))]
154        #[unsafe(method_family = none)]
155        pub fn finishedSelectedImage(&self) -> Option<Retained<UIImage>>;
156
157        #[cfg(feature = "UIImage")]
158        #[deprecated]
159        #[unsafe(method(finishedUnselectedImage))]
160        #[unsafe(method_family = none)]
161        pub fn finishedUnselectedImage(&self) -> Option<Retained<UIImage>>;
162
163        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
164        #[unsafe(method(titlePositionAdjustment))]
165        #[unsafe(method_family = none)]
166        pub fn titlePositionAdjustment(&self) -> UIOffset;
167
168        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
169        /// Setter for [`titlePositionAdjustment`][Self::titlePositionAdjustment].
170        #[unsafe(method(setTitlePositionAdjustment:))]
171        #[unsafe(method_family = none)]
172        pub fn setTitlePositionAdjustment(&self, title_position_adjustment: UIOffset);
173
174        #[cfg(feature = "UIColor")]
175        /// 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.
176        #[unsafe(method(badgeColor))]
177        #[unsafe(method_family = none)]
178        pub fn badgeColor(&self) -> Option<Retained<UIColor>>;
179
180        #[cfg(feature = "UIColor")]
181        /// Setter for [`badgeColor`][Self::badgeColor].
182        ///
183        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
184        #[unsafe(method(setBadgeColor:))]
185        #[unsafe(method_family = none)]
186        pub fn setBadgeColor(&self, badge_color: Option<&UIColor>);
187
188        #[cfg(feature = "UIControl")]
189        /// 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.
190        ///
191        /// # Safety
192        ///
193        /// `text_attributes` generic should be of the correct type.
194        #[unsafe(method(setBadgeTextAttributes:forState:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn setBadgeTextAttributes_forState(
197            &self,
198            text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
199            state: UIControlState,
200        );
201
202        #[cfg(feature = "UIControl")]
203        /// Returns attributes previously set via -setBadgeTextAttributes:forState:.
204        #[unsafe(method(badgeTextAttributesForState:))]
205        #[unsafe(method_family = none)]
206        pub fn badgeTextAttributesForState(
207            &self,
208            state: UIControlState,
209        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
210
211        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
212        /// When set and this item is selected, overrides the hosting tab bar's standardAppearance.
213        #[unsafe(method(standardAppearance))]
214        #[unsafe(method_family = none)]
215        pub fn standardAppearance(&self) -> Option<Retained<UITabBarAppearance>>;
216
217        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
218        /// Setter for [`standardAppearance`][Self::standardAppearance].
219        ///
220        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
221        #[unsafe(method(setStandardAppearance:))]
222        #[unsafe(method_family = none)]
223        pub fn setStandardAppearance(&self, standard_appearance: Option<&UITabBarAppearance>);
224
225        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
226        /// When set and this item is selected, overrides the hosting tab bar's scrollEdgeAppearance.
227        #[unsafe(method(scrollEdgeAppearance))]
228        #[unsafe(method_family = none)]
229        pub fn scrollEdgeAppearance(&self) -> Option<Retained<UITabBarAppearance>>;
230
231        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
232        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
233        ///
234        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
235        #[unsafe(method(setScrollEdgeAppearance:))]
236        #[unsafe(method_family = none)]
237        pub fn setScrollEdgeAppearance(&self, scroll_edge_appearance: Option<&UITabBarAppearance>);
238    );
239}
240
241/// Methods declared on superclass `NSObject`.
242#[cfg(feature = "UIBarItem")]
243impl UITabBarItem {
244    extern_methods!(
245        #[unsafe(method(new))]
246        #[unsafe(method_family = new)]
247        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
248    );
249}
250
251/// SpringLoading.
252#[cfg(feature = "UIBarItem")]
253impl UITabBarItem {
254    extern_methods!();
255}
256
257#[cfg(all(feature = "UIBarItem", feature = "UISpringLoadedInteractionSupporting"))]
258extern_conformance!(
259    unsafe impl UISpringLoadedInteractionSupporting for UITabBarItem {}
260);