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::*;

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpgridtemplatemaximumitems?language=objc)
    pub static CPGridTemplateMaximumItems: NSUInteger;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpgridtemplate?language=objc)
    #[unsafe(super(CPTemplate, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CPTemplate")]
    pub struct CPGridTemplate;
);

#[cfg(all(feature = "CPBarButtonProviding", feature = "CPTemplate"))]
extern_conformance!(
    unsafe impl CPBarButtonProviding for CPGridTemplate {}
);

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

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

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

#[cfg(feature = "CPTemplate")]
impl CPGridTemplate {
    extern_methods!(
        #[cfg(feature = "CPGridButton")]
        /// Initialize a grid template with an array of
        /// `CPGridButton`and a title.
        ///
        ///
        /// Parameter `title`: Title shown in template's navigation bar.
        ///
        /// Parameter `gridButtons`: A list of grid buttons on the template. The maximum button count is
        /// `CPGridTemplateMaximumItems.`
        /// Note: A grid template will only display the first
        /// `CPGridTemplateMaximumItems`buttons in the provided
        /// `gridButtons`array.
        #[unsafe(method(initWithTitle:gridButtons:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTitle_gridButtons(
            this: Allocated<Self>,
            title: Option<&NSString>,
            grid_buttons: &NSArray<CPGridButton>,
        ) -> 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>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The expected image size for your
        /// `CPGridButton.`
        /// To properly size your list images, your app should size them to the display scale of the car screen.
        /// See -[CPInterfaceController carTraitCollection].
        #[unsafe(method(maximumGridButtonImageSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumGridButtonImageSize(mtm: MainThreadMarker) -> CGSize;

        #[cfg(feature = "CPGridButton")]
        /// Array of grid buttons displayed on the template
        #[unsafe(method(gridButtons))]
        #[unsafe(method_family = none)]
        pub unsafe fn gridButtons(&self) -> Retained<NSArray<CPGridButton>>;

        #[cfg(feature = "CPGridButton")]
        /// Update the grid buttons displayed in this template, reloading
        /// the view displaying these buttons.
        #[unsafe(method(updateGridButtons:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateGridButtons(&self, grid_buttons: &NSArray<CPGridButton>);

        /// Title shown in template's navigation bar
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub unsafe fn title(&self) -> Retained<NSString>;

        /// Update the title displayed in this template.
        #[unsafe(method(updateTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateTitle(&self, title: &NSString);
    );
}