objc2_car_play/generated/
CPInformationTemplate.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
10/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpinformationtemplatelayout?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct CPInformationTemplateLayout(pub NSInteger);
15impl CPInformationTemplateLayout {
16    /// A layout that will align all items on the leading edge of the template.
17    #[doc(alias = "CPInformationTemplateLayoutLeading")]
18    pub const Leading: Self = Self(0);
19    /// A layout that will split each item into two columns.
20    #[doc(alias = "CPInformationTemplateLayoutTwoColumn")]
21    pub const TwoColumn: Self = Self(1);
22}
23
24unsafe impl Encode for CPInformationTemplateLayout {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for CPInformationTemplateLayout {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpinformationtemplate?language=objc)
34    #[unsafe(super(CPTemplate, NSObject))]
35    #[thread_kind = MainThreadOnly]
36    #[derive(Debug, PartialEq, Eq, Hash)]
37    #[cfg(feature = "CPTemplate")]
38    pub struct CPInformationTemplate;
39);
40
41#[cfg(all(feature = "CPBarButtonProviding", feature = "CPTemplate"))]
42extern_conformance!(
43    unsafe impl CPBarButtonProviding for CPInformationTemplate {}
44);
45
46#[cfg(feature = "CPTemplate")]
47extern_conformance!(
48    unsafe impl NSCoding for CPInformationTemplate {}
49);
50
51#[cfg(feature = "CPTemplate")]
52extern_conformance!(
53    unsafe impl NSObjectProtocol for CPInformationTemplate {}
54);
55
56#[cfg(feature = "CPTemplate")]
57extern_conformance!(
58    unsafe impl NSSecureCoding for CPInformationTemplate {}
59);
60
61#[cfg(feature = "CPTemplate")]
62impl CPInformationTemplate {
63    extern_methods!(
64        #[cfg(all(feature = "CPInformationItem", feature = "CPTextButton"))]
65        /// Initialize a CPInformationTemplate with a title, optional labels, and optional action buttons.
66        ///
67        ///
68        /// Parameter `layout`: Information template layout, either leading aligned or two columns
69        ///
70        /// Parameter `title`: Information template title, appears at the top of the template
71        ///
72        /// Parameter `items`: Information items that will appear in the template
73        ///
74        /// Parameter `actions`: Optional actions that appear at the bottom of the template
75        ///
76        ///
77        /// Note: The maximum number of
78        /// `CPInformationItem`is 10. If you specify more than 10 items, only the first 10 will be used.
79        /// The maximum number of
80        /// `CPTextButton`is 3. If you specify more than 3, only the first 3 will be used.
81        #[unsafe(method(initWithTitle:layout:items:actions:))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn initWithTitle_layout_items_actions(
84            this: Allocated<Self>,
85            title: &NSString,
86            layout: CPInformationTemplateLayout,
87            items: &NSArray<CPInformationItem>,
88            actions: &NSArray<CPTextButton>,
89        ) -> Retained<Self>;
90
91        /// Information template layout, either leading aligned or two columns.
92        #[unsafe(method(layout))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn layout(&self) -> CPInformationTemplateLayout;
95
96        /// Title that will appear at the top of the template.
97        #[unsafe(method(title))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn title(&self) -> Retained<NSString>;
100
101        /// Setter for [`title`][Self::title].
102        ///
103        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
104        #[unsafe(method(setTitle:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setTitle(&self, title: &NSString);
107
108        #[cfg(feature = "CPInformationItem")]
109        /// An array of
110        /// `CPInformationItem.`To update the items appearing in this information template, assign a new array to this property.
111        ///
112        ///
113        /// Note: The maximum number of items is 10. If you specify more than 10 items, only the first 10 will be used.
114        #[unsafe(method(items))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn items(&self) -> Retained<NSArray<CPInformationItem>>;
117
118        #[cfg(feature = "CPInformationItem")]
119        /// Setter for [`items`][Self::items].
120        ///
121        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
122        #[unsafe(method(setItems:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setItems(&self, items: &NSArray<CPInformationItem>);
125
126        #[cfg(feature = "CPTextButton")]
127        /// An array of actions that appear at the bottom of the template.
128        ///
129        /// To update the actions appearing in this information template, assign a new array to this property.
130        ///
131        ///
132        /// Note: The maximum number of actions is 3. If you specify more than 3, only the first 3 will be used.
133        #[unsafe(method(actions))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn actions(&self) -> Retained<NSArray<CPTextButton>>;
136
137        #[cfg(feature = "CPTextButton")]
138        /// Setter for [`actions`][Self::actions].
139        ///
140        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
141        #[unsafe(method(setActions:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setActions(&self, actions: &NSArray<CPTextButton>);
144
145        #[unsafe(method(init))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
148
149        #[unsafe(method(new))]
150        #[unsafe(method_family = new)]
151        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
152    );
153}