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::*;
#[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" {
    /// The expected maximum size of an image size for your
    /// `CPListSection.`To properly size your images, your app should size them to the display scale of the car screen.
    /// See -[CPInterfaceController carTraitCollection].
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximumlistsectionimagesize?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static CPMaximumListSectionImageSize: CGSize;
}

extern_class!(
    /// `CPListSection`models a single section of items appearing in a
    /// `CPListTemplate.`
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistsection?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CPListSection;
);

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

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

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

impl CPListSection {
    extern_methods!(
        #[cfg(feature = "CPListItemTypes")]
        #[unsafe(method(initWithItems:header:sectionIndexTitle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithItems_header_sectionIndexTitle(
            this: Allocated<Self>,
            items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
            header: Option<&NSString>,
            section_index_title: Option<&NSString>,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "CPButton",
            feature = "CPListItemTypes",
            feature = "objc2-ui-kit"
        ))]
        /// Create a section with a list of items and an optional header containing labels, an image, and a button.
        ///
        ///
        /// Note: The maximum size of the section header image is given by CPMaximumListSectionImageSize.
        ///
        /// When providing an image, your app may 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.
        ///
        ///
        /// To properly size your header image, your app should consider the display scale of the car screen.
        /// See -[CPInterfaceController carTraitCollection].
        #[unsafe(method(initWithItems:header:headerSubtitle:headerImage:headerButton:sectionIndexTitle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithItems_header_headerSubtitle_headerImage_headerButton_sectionIndexTitle(
            this: Allocated<Self>,
            items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
            header: &NSString,
            header_subtitle: Option<&NSString>,
            header_image: Option<&UIImage>,
            header_button: Option<&CPButton>,
            section_index_title: Option<&NSString>,
        ) -> Retained<Self>;

        #[cfg(feature = "CPListItemTypes")]
        #[unsafe(method(initWithItems:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithItems(
            this: Allocated<Self>,
            items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
        ) -> 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() -> Retained<Self>;

        /// Optional string to use for a simple header in this section.
        #[unsafe(method(header))]
        #[unsafe(method_family = none)]
        pub unsafe fn header(&self) -> Option<Retained<NSString>>;

        /// Optional section header elements used by the enhanced header in this section.
        #[unsafe(method(headerSubtitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn headerSubtitle(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "objc2-ui-kit")]
        #[unsafe(method(headerImage))]
        #[unsafe(method_family = none)]
        pub unsafe fn headerImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "objc2-ui-kit")]
        /// Setter for [`headerImage`][Self::headerImage].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setHeaderImage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeaderImage(&self, header_image: Option<&UIImage>);

        #[cfg(feature = "CPButton")]
        #[unsafe(method(headerButton))]
        #[unsafe(method_family = none)]
        pub unsafe fn headerButton(&self) -> Option<Retained<CPButton>>;

        /// An optional section index title to use in a table displaying this section.
        /// The system will enforce a maximum length of 1 for each section index title - in other words,
        /// you must choose single-character section index titles.
        #[unsafe(method(sectionIndexTitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn sectionIndexTitle(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "CPListItemTypes")]
        /// Items appearing in this section.
        #[unsafe(method(items))]
        #[unsafe(method_family = none)]
        pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn CPListTemplateItem>>>;

        #[cfg(feature = "CPListItemTypes")]
        /// Search for an item in this section, returning its index
        /// or
        /// `NSNotFound`if not found.
        #[unsafe(method(indexOfItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexOfItem(
            &self,
            item: &ProtocolObject<dyn CPListTemplateItem>,
        ) -> NSUInteger;

        #[cfg(feature = "CPListItemTypes")]
        /// Convenience access to the item in this section at the specified index.
        #[unsafe(method(itemAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn itemAtIndex(
            &self,
            index: NSUInteger,
        ) -> Retained<ProtocolObject<dyn CPListTemplateItem>>;
    );
}