objc2-car-play 0.3.2

Bindings to the CarPlay framework
Documentation
//! 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::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpdashboardbutton?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CPDashboardButton;
);

extern_conformance!(
    unsafe impl NSCoding for CPDashboardButton {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for CPDashboardButton {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for CPDashboardButton {}
);

impl CPDashboardButton {
    extern_methods!(
        #[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>;

        #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
        /// Initialize a button with title variants, optional subtitle variants, and image.
        ///
        ///
        /// Parameter `titleVariants`: An array of title variants for this button, arranged from longest to shortest. You must provide at least one title.
        ///
        /// Parameter `subtitleVariants`: An array of subtitle variants for this button, arranged from longest to shortest.
        ///
        /// Parameter `image`: The image displayed on the button. It must be non-nil for the button to be displayed.
        ///
        /// 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.
        /// The image must be non-nil and the title must be a non-zero length string for the button to be displayed.
        #[unsafe(method(initWithTitleVariants:subtitleVariants:image:handler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTitleVariants_subtitleVariants_image_handler(
            this: Allocated<Self>,
            title_variants: &NSArray<NSString>,
            subtitle_variants: &NSArray<NSString>,
            image: &UIImage,
            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPDashboardButton>)>>,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-ui-kit")]
        /// The image displayed on the button. Maximum supported size is 30x30 points.
        ///
        ///
        /// Animated images are not supported. If an animated image is assigned, only the first image will be used.
        #[unsafe(method(image))]
        #[unsafe(method_family = none)]
        pub unsafe fn image(&self) -> Retained<UIImage>;

        /// An array of title variants for this button, arranged from most to least preferred.
        /// The system will select a title from your list of provided variants that fits the available space.
        /// The variant strings should be provided as localized, displayable content.
        #[unsafe(method(titleVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn titleVariants(&self) -> Retained<NSArray<NSString>>;

        /// An array of subtitle variants for this button, arranged from most to least preferred.
        /// The system will select a title from your list of provided variants that fits the available space.
        /// The variant strings should be provided as localized, displayable content.
        #[unsafe(method(subtitleVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn subtitleVariants(&self) -> Retained<NSArray<NSString>>;
    );
}