1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UITabBarControllerSidebarLayout(pub NSInteger);
15impl UITabBarControllerSidebarLayout {
16 #[doc(alias = "UITabBarControllerSidebarLayoutAutomatic")]
19 pub const Automatic: Self = Self(0);
20 #[doc(alias = "UITabBarControllerSidebarLayoutOverlap")]
25 pub const Overlap: Self = Self(1);
26 #[doc(alias = "UITabBarControllerSidebarLayoutTile")]
30 pub const Tile: Self = Self(2);
31}
32
33unsafe impl Encode for UITabBarControllerSidebarLayout {
34 const ENCODING: Encoding = NSInteger::ENCODING;
35}
36
37unsafe impl RefEncode for UITabBarControllerSidebarLayout {
38 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
39}
40
41extern_class!(
42 #[unsafe(super(NSObject))]
44 #[thread_kind = MainThreadOnly]
45 #[derive(Debug, PartialEq, Eq, Hash)]
46 pub struct UITabSidebarScrollTarget;
47);
48
49extern_conformance!(
50 unsafe impl NSObjectProtocol for UITabSidebarScrollTarget {}
51);
52
53impl UITabSidebarScrollTarget {
54 extern_methods!(
55 #[unsafe(method(targetForHeader))]
57 #[unsafe(method_family = none)]
58 pub fn targetForHeader(mtm: MainThreadMarker) -> Retained<Self>;
59
60 #[unsafe(method(targetForFooter))]
62 #[unsafe(method_family = none)]
63 pub fn targetForFooter(mtm: MainThreadMarker) -> Retained<Self>;
64
65 #[cfg(feature = "UITab")]
66 #[unsafe(method(targetForTab:))]
68 #[unsafe(method_family = none)]
69 pub fn targetForTab(tab: &UITab) -> Retained<Self>;
70 );
71}
72
73impl UITabSidebarScrollTarget {
75 extern_methods!(
76 #[unsafe(method(init))]
77 #[unsafe(method_family = init)]
78 pub fn init(this: Allocated<Self>) -> Retained<Self>;
79
80 #[unsafe(method(new))]
81 #[unsafe(method_family = new)]
82 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
83 );
84}
85
86extern_class!(
87 #[unsafe(super(NSObject))]
89 #[thread_kind = MainThreadOnly]
90 #[derive(Debug, PartialEq, Eq, Hash)]
91 pub struct UITabBarControllerSidebar;
92);
93
94extern_conformance!(
95 unsafe impl NSObjectProtocol for UITabBarControllerSidebar {}
96);
97
98impl UITabBarControllerSidebar {
99 extern_methods!(
100 #[unsafe(method(delegate))]
102 #[unsafe(method_family = none)]
103 pub fn delegate(
104 &self,
105 ) -> Option<Retained<ProtocolObject<dyn UITabBarControllerSidebarDelegate>>>;
106
107 #[unsafe(method(setDelegate:))]
111 #[unsafe(method_family = none)]
112 pub fn setDelegate(
113 &self,
114 delegate: Option<&ProtocolObject<dyn UITabBarControllerSidebarDelegate>>,
115 );
116
117 #[unsafe(method(isHidden))]
119 #[unsafe(method_family = none)]
120 pub fn isHidden(&self) -> bool;
121
122 #[unsafe(method(setHidden:))]
124 #[unsafe(method_family = none)]
125 pub fn setHidden(&self, hidden: bool);
126
127 #[unsafe(method(preferredLayout))]
130 #[unsafe(method_family = none)]
131 pub fn preferredLayout(&self) -> UITabBarControllerSidebarLayout;
132
133 #[unsafe(method(setPreferredLayout:))]
135 #[unsafe(method_family = none)]
136 pub fn setPreferredLayout(&self, preferred_layout: UITabBarControllerSidebarLayout);
137
138 #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
139 #[unsafe(method(navigationOverflowItems))]
143 #[unsafe(method_family = none)]
144 pub fn navigationOverflowItems(&self) -> Option<Retained<UIDeferredMenuElement>>;
145
146 #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
147 #[unsafe(method(setNavigationOverflowItems:))]
149 #[unsafe(method_family = none)]
150 pub fn setNavigationOverflowItems(
151 &self,
152 navigation_overflow_items: Option<&UIDeferredMenuElement>,
153 );
154
155 #[cfg(feature = "UIContentConfiguration")]
156 #[unsafe(method(headerContentConfiguration))]
159 #[unsafe(method_family = none)]
160 pub fn headerContentConfiguration(
161 &self,
162 ) -> Option<Retained<ProtocolObject<dyn UIContentConfiguration>>>;
163
164 #[cfg(feature = "UIContentConfiguration")]
165 #[unsafe(method(setHeaderContentConfiguration:))]
169 #[unsafe(method_family = none)]
170 pub fn setHeaderContentConfiguration(
171 &self,
172 header_content_configuration: Option<&ProtocolObject<dyn UIContentConfiguration>>,
173 );
174
175 #[cfg(feature = "UIContentConfiguration")]
176 #[unsafe(method(footerContentConfiguration))]
179 #[unsafe(method_family = none)]
180 pub fn footerContentConfiguration(
181 &self,
182 ) -> Option<Retained<ProtocolObject<dyn UIContentConfiguration>>>;
183
184 #[cfg(feature = "UIContentConfiguration")]
185 #[unsafe(method(setFooterContentConfiguration:))]
189 #[unsafe(method_family = none)]
190 pub fn setFooterContentConfiguration(
191 &self,
192 footer_content_configuration: Option<&ProtocolObject<dyn UIContentConfiguration>>,
193 );
194
195 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
196 #[unsafe(method(bottomBarView))]
201 #[unsafe(method_family = none)]
202 pub fn bottomBarView(&self) -> Option<Retained<UIView>>;
203
204 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
205 #[unsafe(method(setBottomBarView:))]
207 #[unsafe(method_family = none)]
208 pub fn setBottomBarView(&self, bottom_bar_view: Option<&UIView>);
209
210 #[unsafe(method(scrollToTarget:animated:))]
212 #[unsafe(method_family = none)]
213 pub fn scrollToTarget_animated(&self, target: &UITabSidebarScrollTarget, animated: bool);
214
215 #[cfg(feature = "UITab")]
216 #[unsafe(method(reconfigureItemForTab:))]
219 #[unsafe(method_family = none)]
220 pub fn reconfigureItemForTab(&self, tab: &UITab);
221
222 #[unsafe(method(init))]
223 #[unsafe(method_family = init)]
224 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
225
226 #[unsafe(method(new))]
227 #[unsafe(method_family = new)]
228 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
229 );
230}
231
232extern_protocol!(
233 pub unsafe trait UITabBarControllerSidebarAnimating:
235 NSObjectProtocol + MainThreadOnly
236 {
237 #[cfg(feature = "block2")]
238 #[unsafe(method(addAnimations:))]
239 #[unsafe(method_family = none)]
240 fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
241
242 #[cfg(feature = "block2")]
243 #[unsafe(method(addCompletion:))]
244 #[unsafe(method_family = none)]
245 fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn()>);
246 }
247);
248
249extern_protocol!(
250 pub unsafe trait UITabBarControllerSidebarDelegate:
252 NSObjectProtocol + MainThreadOnly
253 {
254 #[cfg(all(
255 feature = "UIResponder",
256 feature = "UITabBarController",
257 feature = "UIViewController"
258 ))]
259 #[optional]
263 #[unsafe(method(tabBarController:sidebarVisibilityWillChange:animator:))]
264 #[unsafe(method_family = none)]
265 fn tabBarController_sidebarVisibilityWillChange_animator(
266 &self,
267 tab_bar_controller: &UITabBarController,
268 sidebar: &UITabBarControllerSidebar,
269 animator: &ProtocolObject<dyn UITabBarControllerSidebarAnimating>,
270 );
271
272 #[cfg(all(
273 feature = "UIResponder",
274 feature = "UITabBarController",
275 feature = "UITabSidebarItem",
276 feature = "UIViewController"
277 ))]
278 #[optional]
282 #[unsafe(method(tabBarController:sidebar:itemForRequest:))]
283 #[unsafe(method_family = none)]
284 fn tabBarController_sidebar_itemForRequest(
285 &self,
286 tab_bar_controller: &UITabBarController,
287 sidebar: &UITabBarControllerSidebar,
288 request: &UITabSidebarItemRequest,
289 ) -> Retained<UITabSidebarItem>;
290
291 #[cfg(all(
292 feature = "UIResponder",
293 feature = "UITabBarController",
294 feature = "UITabSidebarItem",
295 feature = "UIViewController"
296 ))]
297 #[optional]
301 #[unsafe(method(tabBarController:sidebar:updateItem:))]
302 #[unsafe(method_family = none)]
303 fn tabBarController_sidebar_updateItem(
304 &self,
305 tab_bar_controller: &UITabBarController,
306 sidebar: &UITabBarControllerSidebar,
307 item: &UITabSidebarItem,
308 );
309
310 #[cfg(all(
311 feature = "UIResponder",
312 feature = "UITab",
313 feature = "UITabBarController",
314 feature = "UIViewController"
315 ))]
316 #[optional]
318 #[unsafe(method(tabBarController:sidebar:willBeginDisplayingTab:))]
319 #[unsafe(method_family = none)]
320 fn tabBarController_sidebar_willBeginDisplayingTab(
321 &self,
322 tab_bar_controller: &UITabBarController,
323 sidebar: &UITabBarControllerSidebar,
324 tab: &UITab,
325 );
326
327 #[cfg(all(
328 feature = "UIResponder",
329 feature = "UITab",
330 feature = "UITabBarController",
331 feature = "UIViewController"
332 ))]
333 #[optional]
335 #[unsafe(method(tabBarController:sidebar:didEndDisplayingTab:))]
336 #[unsafe(method_family = none)]
337 fn tabBarController_sidebar_didEndDisplayingTab(
338 &self,
339 tab_bar_controller: &UITabBarController,
340 sidebar: &UITabBarControllerSidebar,
341 tab: &UITab,
342 );
343
344 #[cfg(all(
345 feature = "UIResponder",
346 feature = "UISwipeActionsConfiguration",
347 feature = "UITab",
348 feature = "UITabBarController",
349 feature = "UIViewController"
350 ))]
351 #[optional]
354 #[unsafe(method(tabBarController:sidebar:leadingSwipeActionsConfigurationForTab:))]
355 #[unsafe(method_family = none)]
356 fn tabBarController_sidebar_leadingSwipeActionsConfigurationForTab(
357 &self,
358 tab_bar_controller: &UITabBarController,
359 sidebar: &UITabBarControllerSidebar,
360 tab: &UITab,
361 ) -> Option<Retained<UISwipeActionsConfiguration>>;
362
363 #[cfg(all(
364 feature = "UIResponder",
365 feature = "UISwipeActionsConfiguration",
366 feature = "UITab",
367 feature = "UITabBarController",
368 feature = "UIViewController"
369 ))]
370 #[optional]
373 #[unsafe(method(tabBarController:sidebar:trailingSwipeActionsConfigurationForTab:))]
374 #[unsafe(method_family = none)]
375 fn tabBarController_sidebar_trailingSwipeActionsConfigurationForTab(
376 &self,
377 tab_bar_controller: &UITabBarController,
378 sidebar: &UITabBarControllerSidebar,
379 tab: &UITab,
380 ) -> Option<Retained<UISwipeActionsConfiguration>>;
381
382 #[cfg(all(
383 feature = "UIContextMenuConfiguration",
384 feature = "UIResponder",
385 feature = "UITab",
386 feature = "UITabBarController",
387 feature = "UIViewController"
388 ))]
389 #[optional]
392 #[unsafe(method(tabBarController:sidebar:contextMenuConfigurationForTab:))]
393 #[unsafe(method_family = none)]
394 fn tabBarController_sidebar_contextMenuConfigurationForTab(
395 &self,
396 tab_bar_controller: &UITabBarController,
397 sidebar: &UITabBarControllerSidebar,
398 tab: &UITab,
399 ) -> Option<Retained<UIContextMenuConfiguration>>;
400
401 #[cfg(all(
402 feature = "UIDragItem",
403 feature = "UIDragSession",
404 feature = "UIResponder",
405 feature = "UITab",
406 feature = "UITabBarController",
407 feature = "UIViewController"
408 ))]
409 #[optional]
412 #[unsafe(method(tabBarController:sidebar:itemsForBeginningDragSession:tab:))]
413 #[unsafe(method_family = none)]
414 fn tabBarController_sidebar_itemsForBeginningDragSession_tab(
415 &self,
416 tab_bar_controller: &UITabBarController,
417 sidebar: &UITabBarControllerSidebar,
418 drag_session: &ProtocolObject<dyn UIDragSession>,
419 tab: &UITab,
420 ) -> Retained<NSArray<UIDragItem>>;
421
422 #[cfg(all(
423 feature = "UIDragItem",
424 feature = "UIDragSession",
425 feature = "UIResponder",
426 feature = "UITab",
427 feature = "UITabBarController",
428 feature = "UIViewController"
429 ))]
430 #[optional]
433 #[unsafe(method(tabBarController:sidebar:itemsForAddingToDragSession:tab:))]
434 #[unsafe(method_family = none)]
435 fn tabBarController_sidebar_itemsForAddingToDragSession_tab(
436 &self,
437 tab_bar_controller: &UITabBarController,
438 sidebar: &UITabBarControllerSidebar,
439 drag_session: &ProtocolObject<dyn UIDragSession>,
440 tab: &UITab,
441 ) -> Retained<NSArray<UIDragItem>>;
442
443 #[cfg(all(
444 feature = "UIAction",
445 feature = "UIDragSession",
446 feature = "UIDropInteraction",
447 feature = "UIMenuElement",
448 feature = "UIResponder",
449 feature = "UITab",
450 feature = "UITabBarController",
451 feature = "UITabGroup",
452 feature = "UIViewController"
453 ))]
454 #[optional]
458 #[unsafe(method(tabBarController:sidebar:sidebarAction:group:operationForAcceptingItemsFromDropSession:))]
459 #[unsafe(method_family = none)]
460 fn tabBarController_sidebar_sidebarAction_group_operationForAcceptingItemsFromDropSession(
461 &self,
462 tab_bar_controller: &UITabBarController,
463 sidebar: &UITabBarControllerSidebar,
464 sidebar_action: &UIAction,
465 group: &UITabGroup,
466 session: &ProtocolObject<dyn UIDropSession>,
467 ) -> UIDropOperation;
468
469 #[cfg(all(
470 feature = "UIAction",
471 feature = "UIDragSession",
472 feature = "UIMenuElement",
473 feature = "UIResponder",
474 feature = "UITab",
475 feature = "UITabBarController",
476 feature = "UITabGroup",
477 feature = "UIViewController"
478 ))]
479 #[optional]
482 #[unsafe(method(tabBarController:sidebar:sidebarAction:group:acceptItemsFromDropSession:))]
483 #[unsafe(method_family = none)]
484 fn tabBarController_sidebar_sidebarAction_group_acceptItemsFromDropSession(
485 &self,
486 tab_bar_controller: &UITabBarController,
487 sidebar: &UITabBarControllerSidebar,
488 sidebar_action: &UIAction,
489 group: &UITabGroup,
490 session: &ProtocolObject<dyn UIDropSession>,
491 );
492 }
493);