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