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::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// `CPAlertTemplate`represents a modal alert that must be dismissed with a button press
    /// before the user may return to using the app.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpalerttemplate?language=objc)
    #[unsafe(super(CPTemplate, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CPTemplate")]
    pub struct CPAlertTemplate;
);

#[cfg(feature = "CPTemplate")]
extern_conformance!(
    unsafe impl NSCoding for CPAlertTemplate {}
);

#[cfg(feature = "CPTemplate")]
extern_conformance!(
    unsafe impl NSObjectProtocol for CPAlertTemplate {}
);

#[cfg(feature = "CPTemplate")]
extern_conformance!(
    unsafe impl NSSecureCoding for CPAlertTemplate {}
);

#[cfg(feature = "CPTemplate")]
impl CPAlertTemplate {
    extern_methods!(
        #[cfg(feature = "CPAlertAction")]
        /// Initialize a
        /// `CPAlertTemplate`by specifying a list of title variants and at least one action.
        ///
        ///
        /// Parameter `titleVariants`: An array of strings, ordered longest to shortest. The template will display
        /// the longest string that fits in the available space on the current size of the car screen,
        /// dropping down to shorter strings as necessary.
        ///
        ///
        /// Parameter `actions`: An array of alert actions to display in this alert template. You must specify at
        /// least one action.
        #[unsafe(method(initWithTitleVariants:actions:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTitleVariants_actions(
            this: Allocated<Self>,
            title_variants: &NSArray<NSString>,
            actions: &NSArray<CPAlertAction>,
        ) -> Retained<Self>;

        #[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>;

        #[unsafe(method(titleVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn titleVariants(&self) -> Retained<NSArray<NSString>>;

        /// Maximum number of action buttons that may appear in any
        /// `CPAlertTemplate.`If you add more than this number of buttons, only the most recently-added buttons
        /// (up to this count) will be kept.
        #[unsafe(method(maximumActionCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumActionCount(mtm: MainThreadMarker) -> NSUInteger;

        #[cfg(feature = "CPAlertAction")]
        #[unsafe(method(actions))]
        #[unsafe(method_family = none)]
        pub unsafe fn actions(&self) -> Retained<NSArray<CPAlertAction>>;
    );
}