objc2_ui_kit/generated/
UIPointerAccessory.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/uikit/uipointeraccessoryposition?language=objc)
13#[cfg(feature = "objc2-core-foundation")]
14#[repr(C)]
15#[derive(Clone, Copy, Debug, PartialEq)]
16pub struct UIPointerAccessoryPosition {
17    /// Offset from the primary pointer shape. Only allows positive values.
18    pub offset: CGFloat,
19    /// Clock-wise angle from top in radians.
20    pub angle: CGFloat,
21}
22
23#[cfg(feature = "objc2-core-foundation")]
24unsafe impl Encode for UIPointerAccessoryPosition {
25    const ENCODING: Encoding = Encoding::Struct("?", &[<CGFloat>::ENCODING, <CGFloat>::ENCODING]);
26}
27
28#[cfg(feature = "objc2-core-foundation")]
29unsafe impl RefEncode for UIPointerAccessoryPosition {
30    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33#[cfg(feature = "objc2-core-foundation")]
34unsafe impl Send for UIPointerAccessoryPosition {}
35
36#[cfg(feature = "objc2-core-foundation")]
37unsafe impl Sync for UIPointerAccessoryPosition {}
38
39// TODO: pub fn UIPointerAccessoryPositionMake(offset: CGFloat,angle: CGFloat,) -> UIPointerAccessoryPosition;
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositiontop?language=objc)
43    #[cfg(feature = "objc2-core-foundation")]
44    pub static UIPointerAccessoryPositionTop: UIPointerAccessoryPosition;
45}
46
47extern "C" {
48    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositiontopright?language=objc)
49    #[cfg(feature = "objc2-core-foundation")]
50    pub static UIPointerAccessoryPositionTopRight: UIPointerAccessoryPosition;
51}
52
53extern "C" {
54    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositionright?language=objc)
55    #[cfg(feature = "objc2-core-foundation")]
56    pub static UIPointerAccessoryPositionRight: UIPointerAccessoryPosition;
57}
58
59extern "C" {
60    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositionbottomright?language=objc)
61    #[cfg(feature = "objc2-core-foundation")]
62    pub static UIPointerAccessoryPositionBottomRight: UIPointerAccessoryPosition;
63}
64
65extern "C" {
66    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositionbottom?language=objc)
67    #[cfg(feature = "objc2-core-foundation")]
68    pub static UIPointerAccessoryPositionBottom: UIPointerAccessoryPosition;
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositionbottomleft?language=objc)
73    #[cfg(feature = "objc2-core-foundation")]
74    pub static UIPointerAccessoryPositionBottomLeft: UIPointerAccessoryPosition;
75}
76
77extern "C" {
78    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositionleft?language=objc)
79    #[cfg(feature = "objc2-core-foundation")]
80    pub static UIPointerAccessoryPositionLeft: UIPointerAccessoryPosition;
81}
82
83extern "C" {
84    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessorypositiontopleft?language=objc)
85    #[cfg(feature = "objc2-core-foundation")]
86    pub static UIPointerAccessoryPositionTopLeft: UIPointerAccessoryPosition;
87}
88
89extern_class!(
90    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointeraccessory?language=objc)
91    #[unsafe(super(NSObject))]
92    #[thread_kind = MainThreadOnly]
93    #[derive(Debug, PartialEq, Eq, Hash)]
94    pub struct UIPointerAccessory;
95);
96
97unsafe impl NSCopying for UIPointerAccessory {}
98
99unsafe impl CopyingHelper for UIPointerAccessory {
100    type Result = Self;
101}
102
103unsafe impl NSObjectProtocol for UIPointerAccessory {}
104
105impl UIPointerAccessory {
106    extern_methods!(
107        #[cfg(feature = "UIPointerStyle")]
108        /// This accessory's shape.
109        #[unsafe(method(shape))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn shape(&self) -> Retained<UIPointerShape>;
112
113        #[cfg(feature = "objc2-core-foundation")]
114        /// This accessory shape's position relative to the pointer.
115        #[unsafe(method(position))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn position(&self) -> UIPointerAccessoryPosition;
118
119        /// Indicates whether the accessory is rotated to match its angle.
120        /// This is false by default for custom accessories, but varies for system vended ones.
121        #[unsafe(method(orientationMatchesAngle))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn orientationMatchesAngle(&self) -> bool;
124
125        /// Setter for [`orientationMatchesAngle`][Self::orientationMatchesAngle].
126        #[unsafe(method(setOrientationMatchesAngle:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setOrientationMatchesAngle(&self, orientation_matches_angle: bool);
129
130        #[cfg(all(feature = "UIPointerStyle", feature = "objc2-core-foundation"))]
131        /// Creates an accessory with the given pointer shape and position.
132        ///
133        ///
134        /// Parameter `shape`: The desired accessory shape.
135        ///
136        /// Parameter `position`: The desired accessory position.
137        #[unsafe(method(accessoryWithShape:position:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn accessoryWithShape_position(
140            shape: &UIPointerShape,
141            position: UIPointerAccessoryPosition,
142        ) -> Retained<Self>;
143
144        #[cfg(feature = "objc2-core-foundation")]
145        /// Returns an arrow shaped accessory with the given position.
146        #[unsafe(method(arrowAccessoryWithPosition:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn arrowAccessoryWithPosition(
149            position: UIPointerAccessoryPosition,
150            mtm: MainThreadMarker,
151        ) -> Retained<Self>;
152
153        #[unsafe(method(init))]
154        #[unsafe(method_family = init)]
155        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
156
157        #[unsafe(method(new))]
158        #[unsafe(method_family = new)]
159        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
160    );
161}