objc2_ui_kit/generated/
UITabBar.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#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbaritempositioning?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UITabBarItemPositioning(pub NSInteger);
20impl UITabBarItemPositioning {
21    #[doc(alias = "UITabBarItemPositioningAutomatic")]
22    pub const Automatic: Self = Self(0);
23    #[doc(alias = "UITabBarItemPositioningFill")]
24    pub const Fill: Self = Self(1);
25    #[doc(alias = "UITabBarItemPositioningCentered")]
26    pub const Centered: Self = Self(2);
27}
28
29unsafe impl Encode for UITabBarItemPositioning {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for UITabBarItemPositioning {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbar?language=objc)
39    #[unsafe(super(UIView, UIResponder, NSObject))]
40    #[thread_kind = MainThreadOnly]
41    #[derive(Debug, PartialEq, Eq, Hash)]
42    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
43    pub struct UITabBar;
44);
45
46#[cfg(all(
47    feature = "UIResponder",
48    feature = "UIView",
49    feature = "objc2-quartz-core"
50))]
51#[cfg(not(target_os = "watchos"))]
52extern_conformance!(
53    unsafe impl CALayerDelegate for UITabBar {}
54);
55
56#[cfg(all(feature = "UIResponder", feature = "UIView"))]
57extern_conformance!(
58    unsafe impl NSCoding for UITabBar {}
59);
60
61#[cfg(all(feature = "UIResponder", feature = "UIView"))]
62extern_conformance!(
63    unsafe impl NSObjectProtocol for UITabBar {}
64);
65
66#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
67extern_conformance!(
68    unsafe impl UIAppearance for UITabBar {}
69);
70
71#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
72extern_conformance!(
73    unsafe impl UIAppearanceContainer for UITabBar {}
74);
75
76#[cfg(all(feature = "UIResponder", feature = "UIView"))]
77extern_conformance!(
78    unsafe impl UICoordinateSpace for UITabBar {}
79);
80
81#[cfg(all(
82    feature = "UIDynamicBehavior",
83    feature = "UIResponder",
84    feature = "UIView"
85))]
86extern_conformance!(
87    unsafe impl UIDynamicItem for UITabBar {}
88);
89
90#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
91extern_conformance!(
92    unsafe impl UIFocusEnvironment for UITabBar {}
93);
94
95#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
96extern_conformance!(
97    unsafe impl UIFocusItem for UITabBar {}
98);
99
100#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
101extern_conformance!(
102    unsafe impl UIFocusItemContainer for UITabBar {}
103);
104
105#[cfg(all(feature = "UIResponder", feature = "UIView"))]
106extern_conformance!(
107    unsafe impl UIResponderStandardEditActions for UITabBar {}
108);
109
110#[cfg(all(
111    feature = "UIResponder",
112    feature = "UITraitCollection",
113    feature = "UIView"
114))]
115extern_conformance!(
116    unsafe impl UITraitEnvironment for UITabBar {}
117);
118
119#[cfg(all(feature = "UIResponder", feature = "UIView"))]
120impl UITabBar {
121    extern_methods!(
122        #[unsafe(method(delegate))]
123        #[unsafe(method_family = none)]
124        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITabBarDelegate>>>;
125
126        /// Setter for [`delegate`][Self::delegate].
127        ///
128        /// This is a [weak property][objc2::topics::weak_property].
129        #[unsafe(method(setDelegate:))]
130        #[unsafe(method_family = none)]
131        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UITabBarDelegate>>);
132
133        #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
134        #[unsafe(method(items))]
135        #[unsafe(method_family = none)]
136        pub fn items(&self) -> Option<Retained<NSArray<UITabBarItem>>>;
137
138        #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
139        /// Setter for [`items`][Self::items].
140        ///
141        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
142        #[unsafe(method(setItems:))]
143        #[unsafe(method_family = none)]
144        pub fn setItems(&self, items: Option<&NSArray<UITabBarItem>>);
145
146        #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
147        #[unsafe(method(selectedItem))]
148        #[unsafe(method_family = none)]
149        pub fn selectedItem(&self) -> Option<Retained<UITabBarItem>>;
150
151        #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
152        /// Setter for [`selectedItem`][Self::selectedItem].
153        ///
154        /// This is a [weak property][objc2::topics::weak_property].
155        #[unsafe(method(setSelectedItem:))]
156        #[unsafe(method_family = none)]
157        pub fn setSelectedItem(&self, selected_item: Option<&UITabBarItem>);
158
159        #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
160        #[unsafe(method(setItems:animated:))]
161        #[unsafe(method_family = none)]
162        pub fn setItems_animated(&self, items: Option<&NSArray<UITabBarItem>>, animated: bool);
163
164        #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
165        #[unsafe(method(beginCustomizingItems:))]
166        #[unsafe(method_family = none)]
167        pub fn beginCustomizingItems(&self, items: &NSArray<UITabBarItem>);
168
169        #[unsafe(method(endCustomizingAnimated:))]
170        #[unsafe(method_family = none)]
171        pub fn endCustomizingAnimated(&self, animated: bool) -> bool;
172
173        #[unsafe(method(isCustomizing))]
174        #[unsafe(method_family = none)]
175        pub fn isCustomizing(&self) -> bool;
176
177        #[cfg(feature = "UIColor")]
178        #[unsafe(method(tintColor))]
179        #[unsafe(method_family = none)]
180        pub fn tintColor(&self) -> Option<Retained<UIColor>>;
181
182        #[cfg(feature = "UIColor")]
183        /// Setter for [`tintColor`][Self::tintColor].
184        ///
185        /// # Safety
186        ///
187        /// `tint_color` might not allow `None`.
188        #[unsafe(method(setTintColor:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
191
192        #[cfg(feature = "UIColor")]
193        #[unsafe(method(barTintColor))]
194        #[unsafe(method_family = none)]
195        pub fn barTintColor(&self) -> Option<Retained<UIColor>>;
196
197        #[cfg(feature = "UIColor")]
198        /// Setter for [`barTintColor`][Self::barTintColor].
199        #[unsafe(method(setBarTintColor:))]
200        #[unsafe(method_family = none)]
201        pub fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
202
203        #[cfg(feature = "UIColor")]
204        /// Unselected items in this tab bar will be tinted with this color. Setting this value to nil indicates that UITabBar should use its default value instead.
205        #[unsafe(method(unselectedItemTintColor))]
206        #[unsafe(method_family = none)]
207        pub fn unselectedItemTintColor(&self) -> Option<Retained<UIColor>>;
208
209        #[cfg(feature = "UIColor")]
210        /// Setter for [`unselectedItemTintColor`][Self::unselectedItemTintColor].
211        ///
212        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
213        #[unsafe(method(setUnselectedItemTintColor:))]
214        #[unsafe(method_family = none)]
215        pub fn setUnselectedItemTintColor(&self, unselected_item_tint_color: Option<&UIColor>);
216
217        #[cfg(feature = "UIColor")]
218        #[deprecated]
219        #[unsafe(method(selectedImageTintColor))]
220        #[unsafe(method_family = none)]
221        pub fn selectedImageTintColor(&self) -> Option<Retained<UIColor>>;
222
223        #[cfg(feature = "UIColor")]
224        /// Setter for [`selectedImageTintColor`][Self::selectedImageTintColor].
225        #[deprecated]
226        #[unsafe(method(setSelectedImageTintColor:))]
227        #[unsafe(method_family = none)]
228        pub fn setSelectedImageTintColor(&self, selected_image_tint_color: Option<&UIColor>);
229
230        #[cfg(feature = "UIImage")]
231        #[unsafe(method(backgroundImage))]
232        #[unsafe(method_family = none)]
233        pub fn backgroundImage(&self) -> Option<Retained<UIImage>>;
234
235        #[cfg(feature = "UIImage")]
236        /// Setter for [`backgroundImage`][Self::backgroundImage].
237        #[unsafe(method(setBackgroundImage:))]
238        #[unsafe(method_family = none)]
239        pub fn setBackgroundImage(&self, background_image: Option<&UIImage>);
240
241        #[cfg(feature = "UIImage")]
242        #[unsafe(method(selectionIndicatorImage))]
243        #[unsafe(method_family = none)]
244        pub fn selectionIndicatorImage(&self) -> Option<Retained<UIImage>>;
245
246        #[cfg(feature = "UIImage")]
247        /// Setter for [`selectionIndicatorImage`][Self::selectionIndicatorImage].
248        #[unsafe(method(setSelectionIndicatorImage:))]
249        #[unsafe(method_family = none)]
250        pub fn setSelectionIndicatorImage(&self, selection_indicator_image: Option<&UIImage>);
251
252        #[cfg(feature = "UIImage")]
253        #[unsafe(method(shadowImage))]
254        #[unsafe(method_family = none)]
255        pub fn shadowImage(&self) -> Option<Retained<UIImage>>;
256
257        #[cfg(feature = "UIImage")]
258        /// Setter for [`shadowImage`][Self::shadowImage].
259        #[unsafe(method(setShadowImage:))]
260        #[unsafe(method_family = none)]
261        pub fn setShadowImage(&self, shadow_image: Option<&UIImage>);
262
263        #[unsafe(method(itemPositioning))]
264        #[unsafe(method_family = none)]
265        pub fn itemPositioning(&self) -> UITabBarItemPositioning;
266
267        /// Setter for [`itemPositioning`][Self::itemPositioning].
268        #[unsafe(method(setItemPositioning:))]
269        #[unsafe(method_family = none)]
270        pub fn setItemPositioning(&self, item_positioning: UITabBarItemPositioning);
271
272        #[cfg(feature = "objc2-core-foundation")]
273        #[unsafe(method(itemWidth))]
274        #[unsafe(method_family = none)]
275        pub fn itemWidth(&self) -> CGFloat;
276
277        #[cfg(feature = "objc2-core-foundation")]
278        /// Setter for [`itemWidth`][Self::itemWidth].
279        #[unsafe(method(setItemWidth:))]
280        #[unsafe(method_family = none)]
281        pub fn setItemWidth(&self, item_width: CGFloat);
282
283        #[cfg(feature = "objc2-core-foundation")]
284        #[unsafe(method(itemSpacing))]
285        #[unsafe(method_family = none)]
286        pub fn itemSpacing(&self) -> CGFloat;
287
288        #[cfg(feature = "objc2-core-foundation")]
289        /// Setter for [`itemSpacing`][Self::itemSpacing].
290        #[unsafe(method(setItemSpacing:))]
291        #[unsafe(method_family = none)]
292        pub fn setItemSpacing(&self, item_spacing: CGFloat);
293
294        #[cfg(feature = "UIInterface")]
295        #[unsafe(method(barStyle))]
296        #[unsafe(method_family = none)]
297        pub fn barStyle(&self) -> UIBarStyle;
298
299        #[cfg(feature = "UIInterface")]
300        /// Setter for [`barStyle`][Self::barStyle].
301        #[unsafe(method(setBarStyle:))]
302        #[unsafe(method_family = none)]
303        pub fn setBarStyle(&self, bar_style: UIBarStyle);
304
305        #[unsafe(method(isTranslucent))]
306        #[unsafe(method_family = none)]
307        pub fn isTranslucent(&self) -> bool;
308
309        /// Setter for [`isTranslucent`][Self::isTranslucent].
310        #[unsafe(method(setTranslucent:))]
311        #[unsafe(method_family = none)]
312        pub fn setTranslucent(&self, translucent: bool);
313
314        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
315        /// Describes the appearance attributes for the tab bar to use.
316        #[unsafe(method(standardAppearance))]
317        #[unsafe(method_family = none)]
318        pub fn standardAppearance(&self) -> Retained<UITabBarAppearance>;
319
320        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
321        /// Setter for [`standardAppearance`][Self::standardAppearance].
322        ///
323        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
324        #[unsafe(method(setStandardAppearance:))]
325        #[unsafe(method_family = none)]
326        pub fn setStandardAppearance(&self, standard_appearance: &UITabBarAppearance);
327
328        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
329        /// Describes the appearance attributes for the tabBar to use when an observable scroll view is scrolled to the bottom. If not set, standardAppearance will be used instead.
330        #[unsafe(method(scrollEdgeAppearance))]
331        #[unsafe(method_family = none)]
332        pub fn scrollEdgeAppearance(&self) -> Option<Retained<UITabBarAppearance>>;
333
334        #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
335        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
336        ///
337        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
338        #[unsafe(method(setScrollEdgeAppearance:))]
339        #[unsafe(method_family = none)]
340        pub fn setScrollEdgeAppearance(&self, scroll_edge_appearance: Option<&UITabBarAppearance>);
341
342        #[unsafe(method(leadingAccessoryView))]
343        #[unsafe(method_family = none)]
344        pub fn leadingAccessoryView(&self) -> Retained<UIView>;
345
346        #[unsafe(method(trailingAccessoryView))]
347        #[unsafe(method_family = none)]
348        pub fn trailingAccessoryView(&self) -> Retained<UIView>;
349    );
350}
351
352/// Methods declared on superclass `UIView`.
353#[cfg(all(feature = "UIResponder", feature = "UIView"))]
354impl UITabBar {
355    extern_methods!(
356        #[cfg(feature = "objc2-core-foundation")]
357        #[unsafe(method(initWithFrame:))]
358        #[unsafe(method_family = init)]
359        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
360
361        /// # Safety
362        ///
363        /// `coder` possibly has further requirements.
364        #[unsafe(method(initWithCoder:))]
365        #[unsafe(method_family = init)]
366        pub unsafe fn initWithCoder(
367            this: Allocated<Self>,
368            coder: &NSCoder,
369        ) -> Option<Retained<Self>>;
370
371        #[unsafe(method(init))]
372        #[unsafe(method_family = init)]
373        pub fn init(this: Allocated<Self>) -> Retained<Self>;
374    );
375}
376
377/// Methods declared on superclass `NSObject`.
378#[cfg(all(feature = "UIResponder", feature = "UIView"))]
379impl UITabBar {
380    extern_methods!(
381        #[unsafe(method(new))]
382        #[unsafe(method_family = new)]
383        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
384    );
385}
386
387extern_protocol!(
388    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitabbardelegate?language=objc)
389    pub unsafe trait UITabBarDelegate: NSObjectProtocol + MainThreadOnly {
390        #[cfg(all(
391            feature = "UIBarItem",
392            feature = "UIResponder",
393            feature = "UITabBarItem",
394            feature = "UIView"
395        ))]
396        #[optional]
397        #[unsafe(method(tabBar:didSelectItem:))]
398        #[unsafe(method_family = none)]
399        fn tabBar_didSelectItem(&self, tab_bar: &UITabBar, item: &UITabBarItem);
400
401        #[cfg(all(
402            feature = "UIBarItem",
403            feature = "UIResponder",
404            feature = "UITabBarItem",
405            feature = "UIView"
406        ))]
407        #[optional]
408        #[unsafe(method(tabBar:willBeginCustomizingItems:))]
409        #[unsafe(method_family = none)]
410        fn tabBar_willBeginCustomizingItems(
411            &self,
412            tab_bar: &UITabBar,
413            items: &NSArray<UITabBarItem>,
414        );
415
416        #[cfg(all(
417            feature = "UIBarItem",
418            feature = "UIResponder",
419            feature = "UITabBarItem",
420            feature = "UIView"
421        ))]
422        #[optional]
423        #[unsafe(method(tabBar:didBeginCustomizingItems:))]
424        #[unsafe(method_family = none)]
425        fn tabBar_didBeginCustomizingItems(
426            &self,
427            tab_bar: &UITabBar,
428            items: &NSArray<UITabBarItem>,
429        );
430
431        #[cfg(all(
432            feature = "UIBarItem",
433            feature = "UIResponder",
434            feature = "UITabBarItem",
435            feature = "UIView"
436        ))]
437        #[optional]
438        #[unsafe(method(tabBar:willEndCustomizingItems:changed:))]
439        #[unsafe(method_family = none)]
440        fn tabBar_willEndCustomizingItems_changed(
441            &self,
442            tab_bar: &UITabBar,
443            items: &NSArray<UITabBarItem>,
444            changed: bool,
445        );
446
447        #[cfg(all(
448            feature = "UIBarItem",
449            feature = "UIResponder",
450            feature = "UITabBarItem",
451            feature = "UIView"
452        ))]
453        #[optional]
454        #[unsafe(method(tabBar:didEndCustomizingItems:changed:))]
455        #[unsafe(method_family = none)]
456        fn tabBar_didEndCustomizingItems_changed(
457            &self,
458            tab_bar: &UITabBar,
459            items: &NSArray<UITabBarItem>,
460            changed: bool,
461        );
462    }
463);
464
465/// SpringLoading.
466#[cfg(all(feature = "UIResponder", feature = "UIView"))]
467impl UITabBar {
468    extern_methods!();
469}
470
471#[cfg(all(
472    feature = "UIResponder",
473    feature = "UISpringLoadedInteractionSupporting",
474    feature = "UIView"
475))]
476extern_conformance!(
477    unsafe impl UISpringLoadedInteractionSupporting for UITabBar {}
478);