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
//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpbuttonmaximumimagesize?language=objc)
#[cfg(feature = "objc2-core-foundation")]
pub static CPButtonMaximumImageSize: CGSize;
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpbutton?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPButton;
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPButton {}
);
impl CPButton {
extern_methods!(
#[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
/// Initialize a button for the Contact, POI, or Information templates with a custom image and a handler, called when
/// the user taps this button.
///
///
/// Parameter `image`: An image to be displayed in this button. The maximum image size is given by
/// `CPButtonMaximumImageSize.`
/// Parameter `handler`: A block that will be called when the user taps this button.
///
///
/// Note: This class is only available in templates that support buttons with custom images, like the Contact template.
///
///
/// When providing an image, your app should provide a
/// `UIImage`that is display-ready. If necessary for the image, provide
/// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
/// or by using
/// `UIImageAsset`to combine two
/// `UIImage`instances into a single image with
/// both styles.
///
/// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
#[unsafe(method(initWithImage:handler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithImage_handler(
this: Allocated<Self>,
image: &UIImage,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
) -> Retained<Self>;
#[cfg(feature = "objc2-ui-kit")]
/// An optional image, displayed only in templates that support custom images, like the Contact template.
///
///
/// When providing an image, your app should provide a
/// `UIImage`that is display-ready. If necessary for the image, provide
/// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
/// or by using
/// `UIImageAsset`to combine two
/// `UIImage`instances into a single image with
/// both styles.
///
/// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
/// A custom title to display for this button, displayed only in templates that allow for custom titles.
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub unsafe fn title(&self) -> Option<Retained<NSString>>;
/// Setter for [`title`][Self::title].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitle(&self, title: Option<&NSString>);
/// A Boolean value indicating whether the button is enabled.
///
///
/// Set the value of this property to
/// `YES`to enable the button or
/// `NO`to disable it. The default value of this property is
/// `YES.`
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isEnabled(&self) -> bool;
/// Setter for [`isEnabled`][Self::isEnabled].
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}