objc2-map-kit 0.3.2

Bindings to the MapKit 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-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkpinannotationcolor?language=objc)
// NS_ENUM
#[deprecated = "Use MKPinAnnotationView's pinTintColor instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MKPinAnnotationColor(pub NSUInteger);
impl MKPinAnnotationColor {
    #[doc(alias = "MKPinAnnotationColorRed")]
    #[deprecated = "Use MKPinAnnotationView's pinTintColor instead"]
    pub const Red: Self = Self(0);
    #[doc(alias = "MKPinAnnotationColorGreen")]
    #[deprecated = "Use MKPinAnnotationView's pinTintColor instead"]
    pub const Green: Self = Self(1);
    #[doc(alias = "MKPinAnnotationColorPurple")]
    #[deprecated = "Use MKPinAnnotationView's pinTintColor instead"]
    pub const Purple: Self = Self(2);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkpinannotationview?language=objc)
    #[unsafe(super(MKAnnotationView, NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
    #[cfg(target_os = "macos")]
    #[deprecated]
    pub struct MKPinAnnotationView;
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibility for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSDraggingDestination for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for MKPinAnnotationView {}
);

#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl MKPinAnnotationView {
    extern_methods!(
        #[unsafe(method(redPinColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn redPinColor(mtm: MainThreadMarker) -> Retained<NSColor>;

        #[unsafe(method(greenPinColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn greenPinColor(mtm: MainThreadMarker) -> Retained<NSColor>;

        #[unsafe(method(purplePinColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn purplePinColor(mtm: MainThreadMarker) -> Retained<NSColor>;

        #[unsafe(method(pinTintColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn pinTintColor(&self) -> Option<Retained<NSColor>>;

        /// Setter for [`pinTintColor`][Self::pinTintColor].
        ///
        /// # Safety
        ///
        /// `pin_tint_color` might not allow `None`.
        #[unsafe(method(setPinTintColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPinTintColor(&self, pin_tint_color: Option<&NSColor>);

        #[deprecated]
        #[unsafe(method(animatesDrop))]
        #[unsafe(method_family = none)]
        pub unsafe fn animatesDrop(&self) -> bool;

        /// Setter for [`animatesDrop`][Self::animatesDrop].
        #[deprecated]
        #[unsafe(method(setAnimatesDrop:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAnimatesDrop(&self, animates_drop: bool);

        #[deprecated = "Use pinTintColor instead"]
        #[unsafe(method(pinColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn pinColor(&self) -> MKPinAnnotationColor;

        /// Setter for [`pinColor`][Self::pinColor].
        #[deprecated = "Use pinTintColor instead"]
        #[unsafe(method(setPinColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPinColor(&self, pin_color: MKPinAnnotationColor);
    );
}

/// Methods declared on superclass `MKAnnotationView`.
#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl MKPinAnnotationView {
    extern_methods!(
        #[cfg(feature = "MKAnnotation")]
        #[unsafe(method(initWithAnnotation:reuseIdentifier:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAnnotation_reuseIdentifier(
            this: Allocated<Self>,
            annotation: Option<&ProtocolObject<dyn MKAnnotation>>,
            reuse_identifier: Option<&NSString>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `a_decoder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl MKPinAnnotationView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl MKPinAnnotationView {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "MKAnnotationView", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl MKPinAnnotationView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}