objc2_car_play/generated/CPDashboardButton.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#[cfg(feature = "objc2-ui-kit")]
8use objc2_ui_kit::*;
9
10use crate::*;
11
12extern_class!(
13 /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpdashboardbutton?language=objc)
14 #[unsafe(super(NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 pub struct CPDashboardButton;
17);
18
19extern_conformance!(
20 unsafe impl NSCoding for CPDashboardButton {}
21);
22
23extern_conformance!(
24 unsafe impl NSObjectProtocol for CPDashboardButton {}
25);
26
27extern_conformance!(
28 unsafe impl NSSecureCoding for CPDashboardButton {}
29);
30
31impl CPDashboardButton {
32 extern_methods!(
33 #[unsafe(method(new))]
34 #[unsafe(method_family = new)]
35 pub unsafe fn new() -> Retained<Self>;
36
37 #[unsafe(method(init))]
38 #[unsafe(method_family = init)]
39 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
40
41 #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
42 /// Initialize a button with title variants, optional subtitle variants, and image.
43 ///
44 ///
45 /// Parameter `titleVariants`: An array of title variants for this button, arranged from longest to shortest. You must provide at least one title.
46 ///
47 /// Parameter `subtitleVariants`: An array of subtitle variants for this button, arranged from longest to shortest.
48 ///
49 /// Parameter `image`: The image displayed on the button. It must be non-nil for the button to be displayed.
50 ///
51 /// Parameter `handler`: A block to execute when the user selects the button. The block has no return value and takes the selected button as its only parameter.
52 /// The image must be non-nil and the title must be a non-zero length string for the button to be displayed.
53 #[unsafe(method(initWithTitleVariants:subtitleVariants:image:handler:))]
54 #[unsafe(method_family = init)]
55 pub unsafe fn initWithTitleVariants_subtitleVariants_image_handler(
56 this: Allocated<Self>,
57 title_variants: &NSArray<NSString>,
58 subtitle_variants: &NSArray<NSString>,
59 image: &UIImage,
60 handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPDashboardButton>)>>,
61 ) -> Retained<Self>;
62
63 #[cfg(feature = "objc2-ui-kit")]
64 /// The image displayed on the button. Maximum supported size is 30x30 points.
65 ///
66 ///
67 /// Animated images are not supported. If an animated image is assigned, only the first image will be used.
68 #[unsafe(method(image))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn image(&self) -> Retained<UIImage>;
71
72 /// An array of title variants for this button, arranged from most to least preferred.
73 /// The system will select a title from your list of provided variants that fits the available space.
74 /// The variant strings should be provided as localized, displayable content.
75 #[unsafe(method(titleVariants))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn titleVariants(&self) -> Retained<NSArray<NSString>>;
78
79 /// An array of subtitle variants for this button, arranged from most to least preferred.
80 /// The system will select a title from your list of provided variants that fits the available space.
81 /// The variant strings should be provided as localized, displayable content.
82 #[unsafe(method(subtitleVariants))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn subtitleVariants(&self) -> Retained<NSArray<NSString>>;
85 );
86}