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"))]
52unsafe impl CALayerDelegate for UITabBar {}
53
54#[cfg(all(feature = "UIResponder", feature = "UIView"))]
55unsafe impl NSCoding for UITabBar {}
56
57#[cfg(all(feature = "UIResponder", feature = "UIView"))]
58unsafe impl NSObjectProtocol for UITabBar {}
59
60#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
61unsafe impl UIAppearance for UITabBar {}
62
63#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
64unsafe impl UIAppearanceContainer for UITabBar {}
65
66#[cfg(all(feature = "UIResponder", feature = "UIView"))]
67unsafe impl UICoordinateSpace for UITabBar {}
68
69#[cfg(all(
70 feature = "UIDynamicBehavior",
71 feature = "UIResponder",
72 feature = "UIView"
73))]
74unsafe impl UIDynamicItem for UITabBar {}
75
76#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
77unsafe impl UIFocusEnvironment for UITabBar {}
78
79#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
80unsafe impl UIFocusItem for UITabBar {}
81
82#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
83unsafe impl UIFocusItemContainer for UITabBar {}
84
85#[cfg(all(feature = "UIResponder", feature = "UIView"))]
86unsafe impl UIResponderStandardEditActions for UITabBar {}
87
88#[cfg(all(
89 feature = "UIResponder",
90 feature = "UITraitCollection",
91 feature = "UIView"
92))]
93unsafe impl UITraitEnvironment for UITabBar {}
94
95#[cfg(all(feature = "UIResponder", feature = "UIView"))]
96impl UITabBar {
97 extern_methods!(
98 #[unsafe(method(delegate))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITabBarDelegate>>>;
101
102 #[unsafe(method(setDelegate:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UITabBarDelegate>>);
107
108 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
109 #[unsafe(method(items))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn items(&self) -> Option<Retained<NSArray<UITabBarItem>>>;
112
113 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
114 #[unsafe(method(setItems:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn setItems(&self, items: Option<&NSArray<UITabBarItem>>);
118
119 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
120 #[unsafe(method(selectedItem))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn selectedItem(&self) -> Option<Retained<UITabBarItem>>;
123
124 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
125 #[unsafe(method(setSelectedItem:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn setSelectedItem(&self, selected_item: Option<&UITabBarItem>);
130
131 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
132 #[unsafe(method(setItems:animated:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn setItems_animated(
135 &self,
136 items: Option<&NSArray<UITabBarItem>>,
137 animated: bool,
138 );
139
140 #[cfg(all(feature = "UIBarItem", feature = "UITabBarItem"))]
141 #[unsafe(method(beginCustomizingItems:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn beginCustomizingItems(&self, items: &NSArray<UITabBarItem>);
144
145 #[unsafe(method(endCustomizingAnimated:))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn endCustomizingAnimated(&self, animated: bool) -> bool;
148
149 #[unsafe(method(isCustomizing))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn isCustomizing(&self) -> bool;
152
153 #[cfg(feature = "UIColor")]
154 #[unsafe(method(tintColor))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
157
158 #[cfg(feature = "UIColor")]
159 #[unsafe(method(setTintColor:))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
163
164 #[cfg(feature = "UIColor")]
165 #[unsafe(method(barTintColor))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn barTintColor(&self) -> Option<Retained<UIColor>>;
168
169 #[cfg(feature = "UIColor")]
170 #[unsafe(method(setBarTintColor:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
174
175 #[cfg(feature = "UIColor")]
176 #[unsafe(method(unselectedItemTintColor))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn unselectedItemTintColor(&self) -> Option<Retained<UIColor>>;
180
181 #[cfg(feature = "UIColor")]
182 #[unsafe(method(setUnselectedItemTintColor:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn setUnselectedItemTintColor(
186 &self,
187 unselected_item_tint_color: Option<&UIColor>,
188 );
189
190 #[cfg(feature = "UIColor")]
191 #[deprecated]
192 #[unsafe(method(selectedImageTintColor))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn selectedImageTintColor(&self) -> Option<Retained<UIColor>>;
195
196 #[cfg(feature = "UIColor")]
197 #[deprecated]
199 #[unsafe(method(setSelectedImageTintColor:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn setSelectedImageTintColor(&self, selected_image_tint_color: Option<&UIColor>);
202
203 #[cfg(feature = "UIImage")]
204 #[unsafe(method(backgroundImage))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn backgroundImage(&self) -> Option<Retained<UIImage>>;
207
208 #[cfg(feature = "UIImage")]
209 #[unsafe(method(setBackgroundImage:))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn setBackgroundImage(&self, background_image: Option<&UIImage>);
213
214 #[cfg(feature = "UIImage")]
215 #[unsafe(method(selectionIndicatorImage))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn selectionIndicatorImage(&self) -> Option<Retained<UIImage>>;
218
219 #[cfg(feature = "UIImage")]
220 #[unsafe(method(setSelectionIndicatorImage:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn setSelectionIndicatorImage(
224 &self,
225 selection_indicator_image: Option<&UIImage>,
226 );
227
228 #[cfg(feature = "UIImage")]
229 #[unsafe(method(shadowImage))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn shadowImage(&self) -> Option<Retained<UIImage>>;
232
233 #[cfg(feature = "UIImage")]
234 #[unsafe(method(setShadowImage:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn setShadowImage(&self, shadow_image: Option<&UIImage>);
238
239 #[unsafe(method(itemPositioning))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn itemPositioning(&self) -> UITabBarItemPositioning;
242
243 #[unsafe(method(setItemPositioning:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn setItemPositioning(&self, item_positioning: UITabBarItemPositioning);
247
248 #[cfg(feature = "objc2-core-foundation")]
249 #[unsafe(method(itemWidth))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn itemWidth(&self) -> CGFloat;
252
253 #[cfg(feature = "objc2-core-foundation")]
254 #[unsafe(method(setItemWidth:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn setItemWidth(&self, item_width: CGFloat);
258
259 #[cfg(feature = "objc2-core-foundation")]
260 #[unsafe(method(itemSpacing))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn itemSpacing(&self) -> CGFloat;
263
264 #[cfg(feature = "objc2-core-foundation")]
265 #[unsafe(method(setItemSpacing:))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn setItemSpacing(&self, item_spacing: CGFloat);
269
270 #[cfg(feature = "UIInterface")]
271 #[unsafe(method(barStyle))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn barStyle(&self) -> UIBarStyle;
274
275 #[cfg(feature = "UIInterface")]
276 #[unsafe(method(setBarStyle:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn setBarStyle(&self, bar_style: UIBarStyle);
280
281 #[unsafe(method(isTranslucent))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn isTranslucent(&self) -> bool;
284
285 #[unsafe(method(setTranslucent:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn setTranslucent(&self, translucent: bool);
289
290 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
291 #[unsafe(method(standardAppearance))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn standardAppearance(&self) -> Retained<UITabBarAppearance>;
295
296 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
297 #[unsafe(method(setStandardAppearance:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn setStandardAppearance(&self, standard_appearance: &UITabBarAppearance);
301
302 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
303 #[unsafe(method(scrollEdgeAppearance))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UITabBarAppearance>>;
307
308 #[cfg(all(feature = "UIBarAppearance", feature = "UITabBarAppearance"))]
309 #[unsafe(method(setScrollEdgeAppearance:))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn setScrollEdgeAppearance(
313 &self,
314 scroll_edge_appearance: Option<&UITabBarAppearance>,
315 );
316
317 #[unsafe(method(leadingAccessoryView))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn leadingAccessoryView(&self) -> Retained<UIView>;
320
321 #[unsafe(method(trailingAccessoryView))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn trailingAccessoryView(&self) -> Retained<UIView>;
324 );
325}
326
327#[cfg(all(feature = "UIResponder", feature = "UIView"))]
329impl UITabBar {
330 extern_methods!(
331 #[cfg(feature = "objc2-core-foundation")]
332 #[unsafe(method(initWithFrame:))]
333 #[unsafe(method_family = init)]
334 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
335
336 #[unsafe(method(initWithCoder:))]
337 #[unsafe(method_family = init)]
338 pub unsafe fn initWithCoder(
339 this: Allocated<Self>,
340 coder: &NSCoder,
341 ) -> Option<Retained<Self>>;
342 );
343}
344
345#[cfg(all(feature = "UIResponder", feature = "UIView"))]
347impl UITabBar {
348 extern_methods!(
349 #[unsafe(method(init))]
350 #[unsafe(method_family = init)]
351 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
352
353 #[unsafe(method(new))]
354 #[unsafe(method_family = new)]
355 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
356 );
357}
358
359extern_protocol!(
360 pub unsafe trait UITabBarDelegate: NSObjectProtocol + MainThreadOnly {
362 #[cfg(all(
363 feature = "UIBarItem",
364 feature = "UIResponder",
365 feature = "UITabBarItem",
366 feature = "UIView"
367 ))]
368 #[optional]
369 #[unsafe(method(tabBar:didSelectItem:))]
370 #[unsafe(method_family = none)]
371 unsafe fn tabBar_didSelectItem(&self, tab_bar: &UITabBar, item: &UITabBarItem);
372
373 #[cfg(all(
374 feature = "UIBarItem",
375 feature = "UIResponder",
376 feature = "UITabBarItem",
377 feature = "UIView"
378 ))]
379 #[optional]
380 #[unsafe(method(tabBar:willBeginCustomizingItems:))]
381 #[unsafe(method_family = none)]
382 unsafe fn tabBar_willBeginCustomizingItems(
383 &self,
384 tab_bar: &UITabBar,
385 items: &NSArray<UITabBarItem>,
386 );
387
388 #[cfg(all(
389 feature = "UIBarItem",
390 feature = "UIResponder",
391 feature = "UITabBarItem",
392 feature = "UIView"
393 ))]
394 #[optional]
395 #[unsafe(method(tabBar:didBeginCustomizingItems:))]
396 #[unsafe(method_family = none)]
397 unsafe fn tabBar_didBeginCustomizingItems(
398 &self,
399 tab_bar: &UITabBar,
400 items: &NSArray<UITabBarItem>,
401 );
402
403 #[cfg(all(
404 feature = "UIBarItem",
405 feature = "UIResponder",
406 feature = "UITabBarItem",
407 feature = "UIView"
408 ))]
409 #[optional]
410 #[unsafe(method(tabBar:willEndCustomizingItems:changed:))]
411 #[unsafe(method_family = none)]
412 unsafe fn tabBar_willEndCustomizingItems_changed(
413 &self,
414 tab_bar: &UITabBar,
415 items: &NSArray<UITabBarItem>,
416 changed: bool,
417 );
418
419 #[cfg(all(
420 feature = "UIBarItem",
421 feature = "UIResponder",
422 feature = "UITabBarItem",
423 feature = "UIView"
424 ))]
425 #[optional]
426 #[unsafe(method(tabBar:didEndCustomizingItems:changed:))]
427 #[unsafe(method_family = none)]
428 unsafe fn tabBar_didEndCustomizingItems_changed(
429 &self,
430 tab_bar: &UITabBar,
431 items: &NSArray<UITabBarItem>,
432 changed: bool,
433 );
434 }
435);
436
437#[cfg(all(feature = "UIResponder", feature = "UIView"))]
439impl UITabBar {
440 extern_methods!();
441}
442
443#[cfg(all(
444 feature = "UIResponder",
445 feature = "UISpringLoadedInteractionSupporting",
446 feature = "UIView"
447))]
448unsafe impl UISpringLoadedInteractionSupporting for UITabBar {}