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/cpmapbutton?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CPMapButton;
);

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

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

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

impl CPMapButton {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// Initializes a new map button.
        ///
        ///
        /// Parameter `handler`: A block to execute when the user selects the button. The block has no return value and takes the selected button as its only parameter.
        #[unsafe(method(initWithHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithHandler(
            this: Allocated<Self>,
            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPMapButton>)>>,
        ) -> Retained<Self>;

        /// A Boolean value indicating whether the button is enabled.
        ///
        ///
        /// Set the value of this property to
        /// `YES`to enable the button or
        /// `NO`to disable it. The default value of this property is
        /// `YES.`
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEnabled(&self) -> bool;

        /// Setter for [`isEnabled`][Self::isEnabled].
        #[unsafe(method(setEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEnabled(&self, enabled: bool);

        /// A Boolean value indicating whether the button is hidden.
        ///
        ///
        /// Setting the value of this property to
        /// `YES`hides the button and setting it to
        /// `NO`shows it. The default value is
        /// `NO.`
        #[unsafe(method(isHidden))]
        #[unsafe(method_family = none)]
        pub unsafe fn isHidden(&self) -> bool;

        /// Setter for [`isHidden`][Self::isHidden].
        #[unsafe(method(setHidden:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHidden(&self, hidden: bool);

        #[cfg(feature = "objc2-ui-kit")]
        /// The image displayed on the button.
        ///
        ///
        /// Animated images are not supported. If an animated image is assigned, only the first image will be used.
        #[unsafe(method(image))]
        #[unsafe(method_family = none)]
        pub unsafe fn image(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "objc2-ui-kit")]
        /// Setter for [`image`][Self::image].
        #[unsafe(method(setImage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setImage(&self, image: Option<&UIImage>);

        #[cfg(feature = "objc2-ui-kit")]
        /// The image displayed on the button when focused.
        ///
        ///
        /// The button will automatically create a focused image using the alpha values from the source image.
        ///
        ///
        /// Note: If unspecified, the button will use the default
        /// `image`
        #[unsafe(method(focusedImage))]
        #[unsafe(method_family = none)]
        pub unsafe fn focusedImage(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "objc2-ui-kit")]
        /// Setter for [`focusedImage`][Self::focusedImage].
        #[unsafe(method(setFocusedImage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFocusedImage(&self, focused_image: Option<&UIImage>);
    );
}

/// Methods declared on superclass `NSObject`.
impl CPMapButton {
    extern_methods!(
        #[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>;
    );
}