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