objc2-watch-kit 0.3.2

Bindings to the WatchKit 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkhaptictype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKHapticType(pub NSInteger);
impl WKHapticType {
    #[doc(alias = "WKHapticTypeNotification")]
    pub const Notification: Self = Self(0);
    #[doc(alias = "WKHapticTypeDirectionUp")]
    pub const DirectionUp: Self = Self(1);
    #[doc(alias = "WKHapticTypeDirectionDown")]
    pub const DirectionDown: Self = Self(2);
    #[doc(alias = "WKHapticTypeSuccess")]
    pub const Success: Self = Self(3);
    #[doc(alias = "WKHapticTypeFailure")]
    pub const Failure: Self = Self(4);
    #[doc(alias = "WKHapticTypeRetry")]
    pub const Retry: Self = Self(5);
    #[doc(alias = "WKHapticTypeStart")]
    pub const Start: Self = Self(6);
    #[doc(alias = "WKHapticTypeStop")]
    pub const Stop: Self = Self(7);
    #[doc(alias = "WKHapticTypeClick")]
    pub const Click: Self = Self(8);
    #[doc(alias = "WKHapticTypeNavigationLeftTurn")]
    pub const NavigationLeftTurn: Self = Self(9);
    #[doc(alias = "WKHapticTypeNavigationRightTurn")]
    pub const NavigationRightTurn: Self = Self(10);
    #[doc(alias = "WKHapticTypeNavigationGenericManeuver")]
    pub const NavigationGenericManeuver: Self = Self(11);
    #[doc(alias = "WKHapticTypeUnderwaterDepthPrompt")]
    pub const UnderwaterDepthPrompt: Self = Self(12);
    #[doc(alias = "WKHapticTypeUnderwaterDepthCriticalPrompt")]
    pub const UnderwaterDepthCriticalPrompt: Self = Self(13);
}

unsafe impl Encode for WKHapticType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacelayoutdirection?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKInterfaceLayoutDirection(pub NSInteger);
impl WKInterfaceLayoutDirection {
    #[doc(alias = "WKInterfaceLayoutDirectionLeftToRight")]
    pub const LeftToRight: Self = Self(0);
    #[doc(alias = "WKInterfaceLayoutDirectionRightToLeft")]
    pub const RightToLeft: Self = Self(1);
}

unsafe impl Encode for WKInterfaceLayoutDirection {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacesemanticcontentattribute?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKInterfaceSemanticContentAttribute(pub NSInteger);
impl WKInterfaceSemanticContentAttribute {
    #[doc(alias = "WKInterfaceSemanticContentAttributeUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "WKInterfaceSemanticContentAttributePlayback")]
    pub const Playback: Self = Self(1);
    #[doc(alias = "WKInterfaceSemanticContentAttributeSpatial")]
    pub const Spatial: Self = Self(2);
    #[doc(alias = "WKInterfaceSemanticContentAttributeForceLeftToRight")]
    pub const ForceLeftToRight: Self = Self(3);
    #[doc(alias = "WKInterfaceSemanticContentAttributeForceRightToLeft")]
    pub const ForceRightToLeft: Self = Self(4);
}

unsafe impl Encode for WKInterfaceSemanticContentAttribute {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacedevicewristlocation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKInterfaceDeviceWristLocation(pub NSInteger);
impl WKInterfaceDeviceWristLocation {
    #[doc(alias = "WKInterfaceDeviceWristLocationLeft")]
    pub const Left: Self = Self(0);
    #[doc(alias = "WKInterfaceDeviceWristLocationRight")]
    pub const Right: Self = Self(1);
}

unsafe impl Encode for WKInterfaceDeviceWristLocation {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacedevicecrownorientation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKInterfaceDeviceCrownOrientation(pub NSInteger);
impl WKInterfaceDeviceCrownOrientation {
    #[doc(alias = "WKInterfaceDeviceCrownOrientationLeft")]
    pub const Left: Self = Self(0);
    #[doc(alias = "WKInterfaceDeviceCrownOrientationRight")]
    pub const Right: Self = Self(1);
}

unsafe impl Encode for WKInterfaceDeviceCrownOrientation {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkwaterresistancerating?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKWaterResistanceRating(pub NSInteger);
impl WKWaterResistanceRating {
    #[doc(alias = "WKWaterResistanceRatingIPX7")]
    pub const IPX7: Self = Self(0);
    #[doc(alias = "WKWaterResistanceRatingWR50")]
    pub const WR50: Self = Self(1);
    #[doc(alias = "WKWaterResistanceRatingWR100")]
    pub const WR100: Self = Self(2);
}

unsafe impl Encode for WKWaterResistanceRating {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacedevicebatterystate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKInterfaceDeviceBatteryState(pub NSInteger);
impl WKInterfaceDeviceBatteryState {
    #[doc(alias = "WKInterfaceDeviceBatteryStateUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "WKInterfaceDeviceBatteryStateUnplugged")]
    pub const Unplugged: Self = Self(1);
    #[doc(alias = "WKInterfaceDeviceBatteryStateCharging")]
    pub const Charging: Self = Self(2);
    #[doc(alias = "WKInterfaceDeviceBatteryStateFull")]
    pub const Full: Self = Self(3);
}

unsafe impl Encode for WKInterfaceDeviceBatteryState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

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

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

impl WKInterfaceDevice {
    extern_methods!(
        #[unsafe(method(currentDevice))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentDevice() -> Retained<WKInterfaceDevice>;

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

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

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

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

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

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

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

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

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

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

        #[unsafe(method(interfaceLayoutDirectionForSemanticContentAttribute:))]
        #[unsafe(method_family = none)]
        pub unsafe fn interfaceLayoutDirectionForSemanticContentAttribute(
            semantic_content_attribute: WKInterfaceSemanticContentAttribute,
        ) -> WKInterfaceLayoutDirection;

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

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

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

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

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

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

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

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

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

        #[unsafe(method(playHaptic:))]
        #[unsafe(method_family = none)]
        pub unsafe fn playHaptic(&self, r#type: WKHapticType);

        #[unsafe(method(enableWaterLock))]
        #[unsafe(method_family = none)]
        pub unsafe fn enableWaterLock(&self);
    );
}

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