1use 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#[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 #[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 unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITabBarDelegate>>>;
125
126 #[unsafe(method(setDelegate:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UITabBarDelegate>>);
131
132 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
133 #[unsafe(method(items))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn items(&self) -> Option<Retained<NSArray<UITabBarItem>>>;
136
137 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
138 #[unsafe(method(setItems:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn setItems(&self, items: Option<&NSArray<UITabBarItem>>);
142
143 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
144 #[unsafe(method(selectedItem))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn selectedItem(&self) -> Option<Retained<UITabBarItem>>;
147
148 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
149 #[unsafe(method(setSelectedItem:))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn setSelectedItem(&self, selected_item: Option<&UITabBarItem>);
154
155 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
156 #[unsafe(method(setItems:animated:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn setItems_animated(
159 &self,
160 items: Option<&NSArray<UITabBarItem>>,
161 animated: bool,
162 );
163
164 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
165 #[unsafe(method(beginCustomizingItems:))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn beginCustomizingItems(&self, items: &NSArray<UITabBarItem>);
168
169 #[unsafe(method(endCustomizingAnimated:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn endCustomizingAnimated(&self, animated: bool) -> bool;
172
173 #[unsafe(method(isCustomizing))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn isCustomizing(&self) -> bool;
176
177 #[cfg(feature = "UIColor")]
178 #[unsafe(method(tintColor))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
181
182 #[cfg(feature = "UIColor")]
183 #[unsafe(method(setTintColor:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
187
188 #[cfg(feature = "UIColor")]
189 #[unsafe(method(barTintColor))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn barTintColor(&self) -> Option<Retained<UIColor>>;
192
193 #[cfg(feature = "UIColor")]
194 #[unsafe(method(setBarTintColor:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
198
199 #[cfg(feature = "UIColor")]
200 #[unsafe(method(unselectedItemTintColor))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn unselectedItemTintColor(&self) -> Option<Retained<UIColor>>;
204
205 #[cfg(feature = "UIColor")]
206 #[unsafe(method(setUnselectedItemTintColor:))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn setUnselectedItemTintColor(
210 &self,
211 unselected_item_tint_color: Option<&UIColor>,
212 );
213
214 #[cfg(feature = "UIColor")]
215 #[deprecated]
216 #[unsafe(method(selectedImageTintColor))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn selectedImageTintColor(&self) -> Option<Retained<UIColor>>;
219
220 #[cfg(feature = "UIColor")]
221 #[deprecated]
223 #[unsafe(method(setSelectedImageTintColor:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn setSelectedImageTintColor(&self, selected_image_tint_color: Option<&UIColor>);
226
227 #[cfg(feature = "UIImage")]
228 #[unsafe(method(backgroundImage))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn backgroundImage(&self) -> Option<Retained<UIImage>>;
231
232 #[cfg(feature = "UIImage")]
233 #[unsafe(method(setBackgroundImage:))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn setBackgroundImage(&self, background_image: Option<&UIImage>);
237
238 #[cfg(feature = "UIImage")]
239 #[unsafe(method(selectionIndicatorImage))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn selectionIndicatorImage(&self) -> Option<Retained<UIImage>>;
242
243 #[cfg(feature = "UIImage")]
244 #[unsafe(method(setSelectionIndicatorImage:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn setSelectionIndicatorImage(
248 &self,
249 selection_indicator_image: Option<&UIImage>,
250 );
251
252 #[cfg(feature = "UIImage")]
253 #[unsafe(method(shadowImage))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn shadowImage(&self) -> Option<Retained<UIImage>>;
256
257 #[cfg(feature = "UIImage")]
258 #[unsafe(method(setShadowImage:))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn setShadowImage(&self, shadow_image: Option<&UIImage>);
262
263 #[unsafe(method(itemPositioning))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn itemPositioning(&self) -> UITabBarItemPositioning;
266
267 #[unsafe(method(setItemPositioning:))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn setItemPositioning(&self, item_positioning: UITabBarItemPositioning);
271
272 #[cfg(feature = "objc2-core-foundation")]
273 #[unsafe(method(itemWidth))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn itemWidth(&self) -> CGFloat;
276
277 #[cfg(feature = "objc2-core-foundation")]
278 #[unsafe(method(setItemWidth:))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn setItemWidth(&self, item_width: CGFloat);
282
283 #[cfg(feature = "objc2-core-foundation")]
284 #[unsafe(method(itemSpacing))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn itemSpacing(&self) -> CGFloat;
287
288 #[cfg(feature = "objc2-core-foundation")]
289 #[unsafe(method(setItemSpacing:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn setItemSpacing(&self, item_spacing: CGFloat);
293
294 #[cfg(feature = "UIInterface")]
295 #[unsafe(method(barStyle))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn barStyle(&self) -> UIBarStyle;
298
299 #[cfg(feature = "UIInterface")]
300 #[unsafe(method(setBarStyle:))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn setBarStyle(&self, bar_style: UIBarStyle);
304
305 #[unsafe(method(isTranslucent))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn isTranslucent(&self) -> bool;
308
309 #[unsafe(method(setTranslucent:))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn setTranslucent(&self, translucent: bool);
313
314 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
315 #[unsafe(method(standardAppearance))]
317 #[unsafe(method_family = none)]
318 pub unsafe fn standardAppearance(&self) -> Retained<UITabBarAppearance>;
319
320 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
321 #[unsafe(method(setStandardAppearance:))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn setStandardAppearance(&self, standard_appearance: &UITabBarAppearance);
325
326 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
327 #[unsafe(method(scrollEdgeAppearance))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UITabBarAppearance>>;
331
332 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
333 #[unsafe(method(setScrollEdgeAppearance:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn setScrollEdgeAppearance(
337 &self,
338 scroll_edge_appearance: Option<&UITabBarAppearance>,
339 );
340
341 #[unsafe(method(leadingAccessoryView))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn leadingAccessoryView(&self) -> Retained<UIView>;
344
345 #[unsafe(method(trailingAccessoryView))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn trailingAccessoryView(&self) -> Retained<UIView>;
348 );
349}
350
351#[cfg(all(feature = "UIResponder", feature = "UIView"))]
353impl UITabBar {
354 extern_methods!(
355 #[cfg(feature = "objc2-core-foundation")]
356 #[unsafe(method(initWithFrame:))]
357 #[unsafe(method_family = init)]
358 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
359
360 #[unsafe(method(initWithCoder:))]
361 #[unsafe(method_family = init)]
362 pub unsafe fn initWithCoder(
363 this: Allocated<Self>,
364 coder: &NSCoder,
365 ) -> Option<Retained<Self>>;
366 );
367}
368
369#[cfg(all(feature = "UIResponder", feature = "UIView"))]
371impl UITabBar {
372 extern_methods!(
373 #[unsafe(method(init))]
374 #[unsafe(method_family = init)]
375 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
376
377 #[unsafe(method(new))]
378 #[unsafe(method_family = new)]
379 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
380 );
381}
382
383extern_protocol!(
384 pub unsafe trait UITabBarDelegate: NSObjectProtocol + MainThreadOnly {
386 #[cfg(all(
387 feature = "UIBarItem",
388 feature = "UIResponder",
389 feature = "UITabBarItem",
390 feature = "UIView"
391 ))]
392 #[optional]
393 #[unsafe(method(tabBar:didSelectItem:))]
394 #[unsafe(method_family = none)]
395 unsafe fn tabBar_didSelectItem(&self, tab_bar: &UITabBar, item: &UITabBarItem);
396
397 #[cfg(all(
398 feature = "UIBarItem",
399 feature = "UIResponder",
400 feature = "UITabBarItem",
401 feature = "UIView"
402 ))]
403 #[optional]
404 #[unsafe(method(tabBar:willBeginCustomizingItems:))]
405 #[unsafe(method_family = none)]
406 unsafe fn tabBar_willBeginCustomizingItems(
407 &self,
408 tab_bar: &UITabBar,
409 items: &NSArray<UITabBarItem>,
410 );
411
412 #[cfg(all(
413 feature = "UIBarItem",
414 feature = "UIResponder",
415 feature = "UITabBarItem",
416 feature = "UIView"
417 ))]
418 #[optional]
419 #[unsafe(method(tabBar:didBeginCustomizingItems:))]
420 #[unsafe(method_family = none)]
421 unsafe fn tabBar_didBeginCustomizingItems(
422 &self,
423 tab_bar: &UITabBar,
424 items: &NSArray<UITabBarItem>,
425 );
426
427 #[cfg(all(
428 feature = "UIBarItem",
429 feature = "UIResponder",
430 feature = "UITabBarItem",
431 feature = "UIView"
432 ))]
433 #[optional]
434 #[unsafe(method(tabBar:willEndCustomizingItems:changed:))]
435 #[unsafe(method_family = none)]
436 unsafe fn tabBar_willEndCustomizingItems_changed(
437 &self,
438 tab_bar: &UITabBar,
439 items: &NSArray<UITabBarItem>,
440 changed: bool,
441 );
442
443 #[cfg(all(
444 feature = "UIBarItem",
445 feature = "UIResponder",
446 feature = "UITabBarItem",
447 feature = "UIView"
448 ))]
449 #[optional]
450 #[unsafe(method(tabBar:didEndCustomizingItems:changed:))]
451 #[unsafe(method_family = none)]
452 unsafe fn tabBar_didEndCustomizingItems_changed(
453 &self,
454 tab_bar: &UITabBar,
455 items: &NSArray<UITabBarItem>,
456 changed: bool,
457 );
458 }
459);
460
461#[cfg(all(feature = "UIResponder", feature = "UIView"))]
463impl UITabBar {
464 extern_methods!();
465}
466
467#[cfg(all(
468 feature = "UIResponder",
469 feature = "UISpringLoadedInteractionSupporting",
470 feature = "UIView"
471))]
472extern_conformance!(
473 unsafe impl UISpringLoadedInteractionSupporting for UITabBar {}
474);