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

/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpinstrumentclustersetting?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CPInstrumentClusterSetting(pub NSUInteger);
impl CPInstrumentClusterSetting {
    #[doc(alias = "CPInstrumentClusterSettingUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "CPInstrumentClusterSettingEnabled")]
    pub const Enabled: Self = Self(1);
    #[doc(alias = "CPInstrumentClusterSettingDisabled")]
    pub const Disabled: Self = Self(2);
    #[doc(alias = "CPInstrumentClusterSettingUserPreference")]
    pub const UserPreference: Self = Self(3);
}

unsafe impl Encode for CPInstrumentClusterSetting {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for CPInstrumentClusterSetting {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpinstrumentclustercontroller?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CPInstrumentClusterController;
);

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

impl CPInstrumentClusterController {
    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() -> Retained<Self>;

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn CPInstrumentClusterControllerDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn CPInstrumentClusterControllerDelegate>>,
        );

        #[cfg(feature = "objc2-ui-kit")]
        /// The UIWindow created for this CPInstrumentClusterController
        #[unsafe(method(instrumentClusterWindow))]
        #[unsafe(method_family = none)]
        pub unsafe fn instrumentClusterWindow(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<UIWindow>>;

        #[unsafe(method(speedLimitSetting))]
        #[unsafe(method_family = none)]
        pub unsafe fn speedLimitSetting(&self) -> CPInstrumentClusterSetting;

        #[unsafe(method(compassSetting))]
        #[unsafe(method_family = none)]
        pub unsafe fn compassSetting(&self) -> CPInstrumentClusterSetting;

        /// inactiveDescriptionVariants is an array of
        /// `NSString`to be displayed when the user is not actively navigating,
        /// arranged from most to least preferred.
        #[unsafe(method(inactiveDescriptionVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn inactiveDescriptionVariants(&self) -> Retained<NSArray<NSString>>;

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

        /// attributedInactiveDescriptionVariants is an array of
        /// `NSAttributedString`to be displayed when the user is not actively navigating,
        /// arranged from most to least preferred.
        ///
        /// `attributedInactiveDescriptionVariants`will be preferred over inactiveDescriptionVariants.
        ///
        /// Only one type of attribute is presently supported: text attachments. You may annotate the string with images
        /// by including one or more text attachments. The maximum text attachment image size is 64x25 points.
        ///
        ///
        /// Warning: All attributes other than text attachment attributes will be removed from your attributed string.
        ///
        ///
        /// See: +[NSAttributedString attributedStringWithAttachment:], -[NSTextAttachment image]
        #[unsafe(method(attributedInactiveDescriptionVariants))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributedInactiveDescriptionVariants(
            &self,
        ) -> Retained<NSArray<NSAttributedString>>;

        /// Setter for [`attributedInactiveDescriptionVariants`][Self::attributedInactiveDescriptionVariants].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAttributedInactiveDescriptionVariants:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAttributedInactiveDescriptionVariants(
            &self,
            attributed_inactive_description_variants: &NSArray<NSAttributedString>,
        );
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpinstrumentclustercontrollerdelegate?language=objc)
    pub unsafe trait CPInstrumentClusterControllerDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-ui-kit")]
        #[unsafe(method(instrumentClusterControllerDidConnectWindow:))]
        #[unsafe(method_family = none)]
        unsafe fn instrumentClusterControllerDidConnectWindow(
            &self,
            instrument_cluster_window: &UIWindow,
        );

        #[cfg(feature = "objc2-ui-kit")]
        #[unsafe(method(instrumentClusterControllerDidDisconnectWindow:))]
        #[unsafe(method_family = none)]
        unsafe fn instrumentClusterControllerDidDisconnectWindow(
            &self,
            instrument_cluster_window: &UIWindow,
        );

        #[optional]
        #[unsafe(method(instrumentClusterControllerDidZoomIn:))]
        #[unsafe(method_family = none)]
        unsafe fn instrumentClusterControllerDidZoomIn(
            &self,
            instrument_cluster_controller: &CPInstrumentClusterController,
        );

        #[optional]
        #[unsafe(method(instrumentClusterControllerDidZoomOut:))]
        #[unsafe(method_family = none)]
        unsafe fn instrumentClusterControllerDidZoomOut(
            &self,
            instrument_cluster_controller: &CPInstrumentClusterController,
        );

        #[optional]
        #[unsafe(method(instrumentClusterController:didChangeCompassSetting:))]
        #[unsafe(method_family = none)]
        unsafe fn instrumentClusterController_didChangeCompassSetting(
            &self,
            instrument_cluster_controller: &CPInstrumentClusterController,
            compass_setting: CPInstrumentClusterSetting,
        );

        #[optional]
        #[unsafe(method(instrumentClusterController:didChangeSpeedLimitSetting:))]
        #[unsafe(method_family = none)]
        unsafe fn instrumentClusterController_didChangeSpeedLimitSetting(
            &self,
            instrument_cluster_controller: &CPInstrumentClusterController,
            speed_limit_setting: CPInstrumentClusterSetting,
        );
    }
);