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/cpmessagecomposebarbutton?language=objc)
    #[unsafe(super(CPBarButton, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CPBarButton")]
    pub struct CPMessageComposeBarButton;
);

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

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

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

#[cfg(feature = "CPBarButton")]
impl CPMessageComposeBarButton {
    extern_methods!(
        /// Convenience initializer that creates a message compose button with a system-provided image.
        ///
        /// Note: This button type does not use a handler. Instead, tapping this button will activate Siri
        /// and launch into a compose message flow.
        #[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>;

        #[cfg(feature = "objc2-ui-kit")]
        /// Convenience initializer that creates a message compose button with a custom image.
        ///
        ///
        /// Note: This button type does not use a handler. Instead, tapping this button will activate Siri
        /// and launch into a compose message flow.
        #[unsafe(method(initWithImage:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithImage(this: Allocated<Self>, image: &UIImage) -> Retained<Self>;

        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub unsafe fn title(&self) -> Option<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: Option<&NSString>);

        #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
        /// # Safety
        ///
        /// `handler` must be a valid pointer or null.
        #[unsafe(method(initWithImage:handler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithImage_handler(
            this: Allocated<Self>,
            image: &UIImage,
            handler: CPBarButtonHandler,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `handler` must be a valid pointer or null.
        #[unsafe(method(initWithTitle:handler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTitle_handler(
            this: Allocated<Self>,
            title: &NSString,
            handler: CPBarButtonHandler,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `CPBarButton`.
#[cfg(feature = "CPBarButton")]
impl CPMessageComposeBarButton {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `handler` must be a valid pointer or null.
        #[deprecated]
        #[unsafe(method(initWithType:handler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithType_handler(
            this: Allocated<Self>,
            r#type: CPBarButtonType,
            handler: CPBarButtonHandler,
        ) -> Retained<Self>;
    );
}