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-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

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

#[cfg(feature = "MKAnnotation")]
extern_conformance!(
    unsafe impl MKAnnotation for MKTileOverlay {}
);

#[cfg(all(feature = "MKAnnotation", feature = "MKOverlay"))]
extern_conformance!(
    unsafe impl MKOverlay for MKTileOverlay {}
);

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

impl MKTileOverlay {
    extern_methods!(
        #[unsafe(method(initWithURLTemplate:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURLTemplate(
            this: Allocated<Self>,
            url_template: Option<&NSString>,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(tileSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn tileSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`tileSize`][Self::tileSize].
        #[unsafe(method(setTileSize:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTileSize(&self, tile_size: CGSize);

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

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

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

        /// Setter for [`minimumZ`][Self::minimumZ].
        #[unsafe(method(setMinimumZ:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinimumZ(&self, minimum_z: NSInteger);

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

        /// Setter for [`maximumZ`][Self::maximumZ].
        #[unsafe(method(setMaximumZ:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaximumZ(&self, maximum_z: NSInteger);

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

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

        /// Setter for [`canReplaceMapContent`][Self::canReplaceMapContent].
        #[unsafe(method(setCanReplaceMapContent:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCanReplaceMapContent(&self, can_replace_map_content: bool);
    );
}

/// Methods declared on superclass `NSObject`.
impl MKTileOverlay {
    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>;
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mktileoverlaypath?language=objc)
#[cfg(feature = "objc2-core-foundation")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MKTileOverlayPath {
    pub x: NSInteger,
    pub y: NSInteger,
    pub z: NSInteger,
    pub contentScaleFactor: CGFloat,
}

#[cfg(feature = "objc2-core-foundation")]
unsafe impl Encode for MKTileOverlayPath {
    const ENCODING: Encoding = Encoding::Struct(
        "?",
        &[
            <NSInteger>::ENCODING,
            <NSInteger>::ENCODING,
            <NSInteger>::ENCODING,
            <CGFloat>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2-core-foundation")]
unsafe impl RefEncode for MKTileOverlayPath {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// CustomLoading.
impl MKTileOverlay {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(URLForTilePath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLForTilePath(&self, path: MKTileOverlayPath) -> Retained<NSURL>;

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        #[unsafe(method(loadTileAtPath:result:))]
        #[unsafe(method_family = none)]
        pub unsafe fn loadTileAtPath_result(
            &self,
            path: MKTileOverlayPath,
            result: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
        );
    );
}