objc2_car_play/generated/
CPTabBarTemplate.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
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cptabbartemplate?language=objc)
12    #[unsafe(super(CPTemplate, NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    #[cfg(feature = "CPTemplate")]
16    pub struct CPTabBarTemplate;
17);
18
19#[cfg(feature = "CPTemplate")]
20extern_conformance!(
21    unsafe impl NSCoding for CPTabBarTemplate {}
22);
23
24#[cfg(feature = "CPTemplate")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for CPTabBarTemplate {}
27);
28
29#[cfg(feature = "CPTemplate")]
30extern_conformance!(
31    unsafe impl NSSecureCoding for CPTabBarTemplate {}
32);
33
34#[cfg(feature = "CPTemplate")]
35impl CPTabBarTemplate {
36    extern_methods!(
37        #[unsafe(method(init))]
38        #[unsafe(method_family = init)]
39        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
40
41        #[unsafe(method(new))]
42        #[unsafe(method_family = new)]
43        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
44
45        /// Initialize the tab bar with an array of templates. Each template in the array
46        /// becomes a tab on the tab bar.
47        ///
48        /// The maximum number of tabs in the tab bar template is given by
49        /// `maximumTabCount.`
50        #[unsafe(method(initWithTemplates:))]
51        #[unsafe(method_family = init)]
52        pub unsafe fn initWithTemplates(
53            this: Allocated<Self>,
54            templates: &NSArray<CPTemplate>,
55        ) -> Retained<Self>;
56
57        /// The tab bar delegate is informed of tab bar events, like selecting a tab.
58        #[unsafe(method(delegate))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn delegate(
61            &self,
62        ) -> Option<Retained<ProtocolObject<dyn CPTabBarTemplateDelegate>>>;
63
64        /// Setter for [`delegate`][Self::delegate].
65        ///
66        /// This is a [weak property][objc2::topics::weak_property].
67        #[unsafe(method(setDelegate:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn setDelegate(
70            &self,
71            delegate: Option<&ProtocolObject<dyn CPTabBarTemplateDelegate>>,
72        );
73
74        /// The maximum number of tabs that your app may display in a
75        /// `CPTabBarTemplate,`depending on the entitlements that your app declares.
76        ///
77        ///
78        /// Warning: The system will throw an exception if your app attempts to display more
79        /// than this number of tabs in your tab bar template.
80        #[unsafe(method(maximumTabCount))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn maximumTabCount(mtm: MainThreadMarker) -> NSInteger;
83
84        /// The currently-visible templates in the tab bar. Each template corresponds to
85        /// a single tab on the tab bar.
86        #[unsafe(method(templates))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn templates(&self) -> Retained<NSArray<CPTemplate>>;
89
90        /// The currently-selected template in the tab bar.
91        #[unsafe(method(selectedTemplate))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn selectedTemplate(&self) -> Option<Retained<CPTemplate>>;
94
95        /// Update the tabs displayed in this tab bar, replacing the currently-visible tabs.
96        /// Each template in the array becomes a tab on the tab bar.
97        #[unsafe(method(updateTemplates:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn updateTemplates(&self, new_templates: &NSArray<CPTemplate>);
100
101        /// Update the currently-selected tab in this tab bar template, switching to the first tab
102        /// that is currently hosting
103        /// `newTemplate.`
104        /// Parameter `newTemplate`: The template that should become selected in the tab bar.
105        #[unsafe(method(selectTemplate:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn selectTemplate(&self, new_template: &CPTemplate);
108
109        /// Update the currently-selected tab in this tab bar template, switching to the tab
110        /// at the specified index.
111        ///
112        ///
113        /// Parameter `index`: The index of the tab to select. This must be less than the number
114        /// of tabs in this tab bar template.
115        #[unsafe(method(selectTemplateAtIndex:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn selectTemplateAtIndex(&self, index: NSInteger);
118    );
119}
120
121extern_protocol!(
122    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cptabbartemplatedelegate?language=objc)
123    pub unsafe trait CPTabBarTemplateDelegate: NSObjectProtocol + MainThreadOnly {
124        #[cfg(feature = "CPTemplate")]
125        /// The user has selected one of the tabs in the tab bar template, bringing the selected template to the foreground.
126        #[unsafe(method(tabBarTemplate:didSelectTemplate:))]
127        #[unsafe(method_family = none)]
128        unsafe fn tabBarTemplate_didSelectTemplate(
129            &self,
130            tab_bar_template: &CPTabBarTemplate,
131            selected_template: &CPTemplate,
132        );
133    }
134);