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