objc2_watch_kit/generated/
WKInterfaceDevice.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkhaptictype?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct WKHapticType(pub NSInteger);
17impl WKHapticType {
18    #[doc(alias = "WKHapticTypeNotification")]
19    pub const Notification: Self = Self(0);
20    #[doc(alias = "WKHapticTypeDirectionUp")]
21    pub const DirectionUp: Self = Self(1);
22    #[doc(alias = "WKHapticTypeDirectionDown")]
23    pub const DirectionDown: Self = Self(2);
24    #[doc(alias = "WKHapticTypeSuccess")]
25    pub const Success: Self = Self(3);
26    #[doc(alias = "WKHapticTypeFailure")]
27    pub const Failure: Self = Self(4);
28    #[doc(alias = "WKHapticTypeRetry")]
29    pub const Retry: Self = Self(5);
30    #[doc(alias = "WKHapticTypeStart")]
31    pub const Start: Self = Self(6);
32    #[doc(alias = "WKHapticTypeStop")]
33    pub const Stop: Self = Self(7);
34    #[doc(alias = "WKHapticTypeClick")]
35    pub const Click: Self = Self(8);
36    #[doc(alias = "WKHapticTypeNavigationLeftTurn")]
37    pub const NavigationLeftTurn: Self = Self(9);
38    #[doc(alias = "WKHapticTypeNavigationRightTurn")]
39    pub const NavigationRightTurn: Self = Self(10);
40    #[doc(alias = "WKHapticTypeNavigationGenericManeuver")]
41    pub const NavigationGenericManeuver: Self = Self(11);
42    #[doc(alias = "WKHapticTypeUnderwaterDepthPrompt")]
43    pub const UnderwaterDepthPrompt: Self = Self(12);
44    #[doc(alias = "WKHapticTypeUnderwaterDepthCriticalPrompt")]
45    pub const UnderwaterDepthCriticalPrompt: Self = Self(13);
46}
47
48unsafe impl Encode for WKHapticType {
49    const ENCODING: Encoding = NSInteger::ENCODING;
50}
51
52unsafe impl RefEncode for WKHapticType {
53    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacelayoutdirection?language=objc)
57// NS_ENUM
58#[repr(transparent)]
59#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
60pub struct WKInterfaceLayoutDirection(pub NSInteger);
61impl WKInterfaceLayoutDirection {
62    #[doc(alias = "WKInterfaceLayoutDirectionLeftToRight")]
63    pub const LeftToRight: Self = Self(0);
64    #[doc(alias = "WKInterfaceLayoutDirectionRightToLeft")]
65    pub const RightToLeft: Self = Self(1);
66}
67
68unsafe impl Encode for WKInterfaceLayoutDirection {
69    const ENCODING: Encoding = NSInteger::ENCODING;
70}
71
72unsafe impl RefEncode for WKInterfaceLayoutDirection {
73    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
74}
75
76/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacesemanticcontentattribute?language=objc)
77// NS_ENUM
78#[repr(transparent)]
79#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
80pub struct WKInterfaceSemanticContentAttribute(pub NSInteger);
81impl WKInterfaceSemanticContentAttribute {
82    #[doc(alias = "WKInterfaceSemanticContentAttributeUnspecified")]
83    pub const Unspecified: Self = Self(0);
84    #[doc(alias = "WKInterfaceSemanticContentAttributePlayback")]
85    pub const Playback: Self = Self(1);
86    #[doc(alias = "WKInterfaceSemanticContentAttributeSpatial")]
87    pub const Spatial: Self = Self(2);
88    #[doc(alias = "WKInterfaceSemanticContentAttributeForceLeftToRight")]
89    pub const ForceLeftToRight: Self = Self(3);
90    #[doc(alias = "WKInterfaceSemanticContentAttributeForceRightToLeft")]
91    pub const ForceRightToLeft: Self = Self(4);
92}
93
94unsafe impl Encode for WKInterfaceSemanticContentAttribute {
95    const ENCODING: Encoding = NSInteger::ENCODING;
96}
97
98unsafe impl RefEncode for WKInterfaceSemanticContentAttribute {
99    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
100}
101
102/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacedevicewristlocation?language=objc)
103// NS_ENUM
104#[repr(transparent)]
105#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
106pub struct WKInterfaceDeviceWristLocation(pub NSInteger);
107impl WKInterfaceDeviceWristLocation {
108    #[doc(alias = "WKInterfaceDeviceWristLocationLeft")]
109    pub const Left: Self = Self(0);
110    #[doc(alias = "WKInterfaceDeviceWristLocationRight")]
111    pub const Right: Self = Self(1);
112}
113
114unsafe impl Encode for WKInterfaceDeviceWristLocation {
115    const ENCODING: Encoding = NSInteger::ENCODING;
116}
117
118unsafe impl RefEncode for WKInterfaceDeviceWristLocation {
119    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
120}
121
122/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacedevicecrownorientation?language=objc)
123// NS_ENUM
124#[repr(transparent)]
125#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
126pub struct WKInterfaceDeviceCrownOrientation(pub NSInteger);
127impl WKInterfaceDeviceCrownOrientation {
128    #[doc(alias = "WKInterfaceDeviceCrownOrientationLeft")]
129    pub const Left: Self = Self(0);
130    #[doc(alias = "WKInterfaceDeviceCrownOrientationRight")]
131    pub const Right: Self = Self(1);
132}
133
134unsafe impl Encode for WKInterfaceDeviceCrownOrientation {
135    const ENCODING: Encoding = NSInteger::ENCODING;
136}
137
138unsafe impl RefEncode for WKInterfaceDeviceCrownOrientation {
139    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
140}
141
142/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkwaterresistancerating?language=objc)
143// NS_ENUM
144#[repr(transparent)]
145#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
146pub struct WKWaterResistanceRating(pub NSInteger);
147impl WKWaterResistanceRating {
148    #[doc(alias = "WKWaterResistanceRatingIPX7")]
149    pub const IPX7: Self = Self(0);
150    #[doc(alias = "WKWaterResistanceRatingWR50")]
151    pub const WR50: Self = Self(1);
152    #[doc(alias = "WKWaterResistanceRatingWR100")]
153    pub const WR100: Self = Self(2);
154}
155
156unsafe impl Encode for WKWaterResistanceRating {
157    const ENCODING: Encoding = NSInteger::ENCODING;
158}
159
160unsafe impl RefEncode for WKWaterResistanceRating {
161    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
162}
163
164/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacedevicebatterystate?language=objc)
165// NS_ENUM
166#[repr(transparent)]
167#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
168pub struct WKInterfaceDeviceBatteryState(pub NSInteger);
169impl WKInterfaceDeviceBatteryState {
170    #[doc(alias = "WKInterfaceDeviceBatteryStateUnknown")]
171    pub const Unknown: Self = Self(0);
172    #[doc(alias = "WKInterfaceDeviceBatteryStateUnplugged")]
173    pub const Unplugged: Self = Self(1);
174    #[doc(alias = "WKInterfaceDeviceBatteryStateCharging")]
175    pub const Charging: Self = Self(2);
176    #[doc(alias = "WKInterfaceDeviceBatteryStateFull")]
177    pub const Full: Self = Self(3);
178}
179
180unsafe impl Encode for WKInterfaceDeviceBatteryState {
181    const ENCODING: Encoding = NSInteger::ENCODING;
182}
183
184unsafe impl RefEncode for WKInterfaceDeviceBatteryState {
185    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
186}
187
188extern_class!(
189    /// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkinterfacedevice?language=objc)
190    #[unsafe(super(NSObject))]
191    #[derive(Debug, PartialEq, Eq, Hash)]
192    pub struct WKInterfaceDevice;
193);
194
195extern_conformance!(
196    unsafe impl NSObjectProtocol for WKInterfaceDevice {}
197);
198
199impl WKInterfaceDevice {
200    extern_methods!(
201        #[unsafe(method(currentDevice))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn currentDevice() -> Retained<WKInterfaceDevice>;
204
205        #[cfg(feature = "objc2-core-foundation")]
206        #[unsafe(method(screenBounds))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn screenBounds(&self) -> CGRect;
209
210        #[cfg(feature = "objc2-core-foundation")]
211        #[unsafe(method(screenScale))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn screenScale(&self) -> CGFloat;
214
215        #[unsafe(method(isBatteryMonitoringEnabled))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn isBatteryMonitoringEnabled(&self) -> bool;
218
219        /// Setter for [`isBatteryMonitoringEnabled`][Self::isBatteryMonitoringEnabled].
220        #[unsafe(method(setBatteryMonitoringEnabled:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn setBatteryMonitoringEnabled(&self, battery_monitoring_enabled: bool);
223
224        #[unsafe(method(batteryLevel))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn batteryLevel(&self) -> c_float;
227
228        #[unsafe(method(batteryState))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn batteryState(&self) -> WKInterfaceDeviceBatteryState;
231
232        #[unsafe(method(preferredContentSizeCategory))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn preferredContentSizeCategory(&self) -> Retained<NSString>;
235
236        #[unsafe(method(layoutDirection))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn layoutDirection(&self) -> WKInterfaceLayoutDirection;
239
240        #[unsafe(method(wristLocation))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn wristLocation(&self) -> WKInterfaceDeviceWristLocation;
243
244        #[unsafe(method(crownOrientation))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn crownOrientation(&self) -> WKInterfaceDeviceCrownOrientation;
247
248        #[unsafe(method(interfaceLayoutDirectionForSemanticContentAttribute:))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn interfaceLayoutDirectionForSemanticContentAttribute(
251            semantic_content_attribute: WKInterfaceSemanticContentAttribute,
252        ) -> WKInterfaceLayoutDirection;
253
254        #[unsafe(method(systemVersion))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn systemVersion(&self) -> Retained<NSString>;
257
258        #[unsafe(method(name))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn name(&self) -> Retained<NSString>;
261
262        #[unsafe(method(model))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn model(&self) -> Retained<NSString>;
265
266        #[unsafe(method(localizedModel))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn localizedModel(&self) -> Retained<NSString>;
269
270        #[unsafe(method(systemName))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn systemName(&self) -> Retained<NSString>;
273
274        #[unsafe(method(waterResistanceRating))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn waterResistanceRating(&self) -> WKWaterResistanceRating;
277
278        #[unsafe(method(isWaterLockEnabled))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn isWaterLockEnabled(&self) -> bool;
281
282        #[unsafe(method(supportsAudioStreaming))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn supportsAudioStreaming(&self) -> bool;
285
286        #[unsafe(method(identifierForVendor))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn identifierForVendor(&self) -> Option<Retained<NSUUID>>;
289
290        #[unsafe(method(playHaptic:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn playHaptic(&self, r#type: WKHapticType);
293
294        #[unsafe(method(enableWaterLock))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn enableWaterLock(&self);
297    );
298}
299
300/// Methods declared on superclass `NSObject`.
301impl WKInterfaceDevice {
302    extern_methods!(
303        #[unsafe(method(init))]
304        #[unsafe(method_family = init)]
305        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
306
307        #[unsafe(method(new))]
308        #[unsafe(method_family = new)]
309        pub unsafe fn new() -> Retained<Self>;
310    );
311}