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_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistimagerowitemcardelement?language=objc)
    #[unsafe(super(CPListImageRowItemElement, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CPListImageRowItemElement")]
    pub struct CPListImageRowItemCardElement;
);

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

#[cfg(feature = "CPListImageRowItemElement")]
impl CPListImageRowItemCardElement {
    extern_methods!(
        #[cfg(feature = "objc2-ui-kit")]
        /// Initialize an element that is constituted of an image, boolean to entirely cover the element with the image, title, subtitle and a tint color.
        ///
        /// 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.
        ///
        ///
        /// Note: The expected image size is given by +[CPListImageRowItemCardElement maximumImageSize] or by +[CPListImageRowItemCardElement maximumFullHeightImageSize] if
        /// `showsImageFullHeight`is true. Images provided will be resized to this size if necessary.
        ///
        ///
        /// To properly size your images, your app should size them to the display scale of the car screen.
        /// See -[CPInterfaceController carTraitCollection].
        ///
        ///
        /// Parameter `image`: The image associated to the element.
        ///
        /// Parameter `showsImageFullHeight`: Determines if the image should entirely cover the card
        ///
        /// Parameter `title`: The title of the element.
        ///
        /// Parameter `subtitle`: The subtitle of the element.
        ///
        /// Parameter `tintColor`: The color used as background if
        /// `showsImageFullHeight`is true, part of the gradient color at the bottom of the card otherwise.
        #[unsafe(method(initWithImage:showsImageFullHeight:title:subtitle:tintColor:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithImage_showsImageFullHeight_title_subtitle_tintColor(
            this: Allocated<Self>,
            image: &UIImage,
            shows_image_full_height: bool,
            title: Option<&NSString>,
            subtitle: Option<&NSString>,
            tint_color: Option<&UIColor>,
        ) -> Retained<Self>;

        /// The title associated with this element.
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub unsafe fn title(&self) -> 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: &NSString);

        /// The subtitle associated with this element.
        #[unsafe(method(subtitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;

        /// Setter for [`subtitle`][Self::subtitle].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSubtitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);

        /// A Boolean value indicating whether the element should be fill with the image.
        ///
        ///
        /// Set the value of this property to
        /// `YES`to fill the element with the image or
        /// `NO`to use a rounded square image that does not fill the card.
        #[unsafe(method(showsImageFullHeight))]
        #[unsafe(method_family = none)]
        pub unsafe fn showsImageFullHeight(&self) -> bool;

        #[cfg(feature = "objc2-ui-kit")]
        /// A UIColor used to tint the element. When
        /// `showsImageFullHeight`is true, the tint color is applied behind the labels at the bottom of the card. Otherwise, this color is part of the gradient color at the bottom of the card.
        ///
        /// If this value is nil, iOS will use secondarySystemBackground color.
        #[unsafe(method(tintColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;

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

        #[cfg(feature = "objc2-core-foundation")]
        /// The expected image size for the image in your
        /// `CPListImageRowItemCardElement`when
        /// `showsImageFullHeight`is false. Images provided
        /// will be resized to this size.
        ///
        ///
        /// To properly size your images, your app should size them to the display scale of the car screen.
        /// See -[CPInterfaceController carTraitCollection].
        #[unsafe(method(maximumImageSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumImageSize(mtm: MainThreadMarker) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// The expected image size for the image in your
        /// `CPListImageRowItemCardElement`when
        /// `showsImageFullHeight`is  true. Images provided
        /// will be resized to this size.
        ///
        ///
        /// To properly size your images, your app should size them to the display scale of the car screen.
        /// See -[CPInterfaceController carTraitCollection].
        #[unsafe(method(maximumFullHeightImageSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumFullHeightImageSize(mtm: MainThreadMarker) -> CGSize;
    );
}

/// Methods declared on superclass `CPListImageRowItemElement`.
#[cfg(feature = "CPListImageRowItemElement")]
impl CPListImageRowItemCardElement {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CPListImageRowItemElement")]
impl CPListImageRowItemCardElement {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}