objc2_ui_kit/generated/
UIPointerStyle.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
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerstyle?language=objc)
14    #[unsafe(super(UIHoverStyle, NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "UIHoverStyle")]
18    pub struct UIPointerStyle;
19);
20
21#[cfg(feature = "UIHoverStyle")]
22unsafe impl NSCopying for UIPointerStyle {}
23
24#[cfg(feature = "UIHoverStyle")]
25unsafe impl CopyingHelper for UIPointerStyle {
26    type Result = Self;
27}
28
29#[cfg(feature = "UIHoverStyle")]
30unsafe impl NSObjectProtocol for UIPointerStyle {}
31
32#[cfg(feature = "UIHoverStyle")]
33impl UIPointerStyle {
34    extern_methods!(
35        #[cfg(feature = "UIPointerAccessory")]
36        /// Accessories to display alongside this UIPointerStyle. Supports up to 4 accessories.
37        /// The system will attempt to animate between neighboring or similar accessories.
38        #[unsafe(method(accessories))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn accessories(&self) -> Retained<NSArray<UIPointerAccessory>>;
41
42        #[cfg(feature = "UIPointerAccessory")]
43        /// Setter for [`accessories`][Self::accessories].
44        #[unsafe(method(setAccessories:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn setAccessories(&self, accessories: &NSArray<UIPointerAccessory>);
47
48        /// Applies the provided content effect and pointer shape within the current region.
49        ///
50        ///
51        /// Parameter `effect`: The desired pointer effect.
52        ///
53        /// Parameter `shape`: The desired pointer shape. If omitted, a pointer will be generated automatically from the effect's preview view.
54        #[unsafe(method(styleWithEffect:shape:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn styleWithEffect_shape(
57            effect: &UIPointerEffect,
58            shape: Option<&UIPointerShape>,
59        ) -> Retained<Self>;
60
61        #[cfg(feature = "UIGeometry")]
62        /// Morphs the pointer into the provided shape when hovering over the current region.
63        ///
64        ///
65        /// Parameter `shape`: The desired pointer shape.
66        ///
67        /// Parameter `axes`: Axes along which to recenter the pointer on touch up.
68        #[unsafe(method(styleWithShape:constrainedAxes:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn styleWithShape_constrainedAxes(
71            shape: &UIPointerShape,
72            axes: UIAxis,
73        ) -> Retained<Self>;
74
75        /// Hides the pointer when hovering over the current region.
76        #[unsafe(method(hiddenPointerStyle))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn hiddenPointerStyle(mtm: MainThreadMarker) -> Retained<Self>;
79
80        /// Pointer style that displays an unconstrained system pointer. Use this to display accessories alongside the default pointer.
81        #[unsafe(method(systemPointerStyle))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn systemPointerStyle(mtm: MainThreadMarker) -> Retained<Self>;
84
85        #[unsafe(method(init))]
86        #[unsafe(method_family = init)]
87        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
88
89        #[unsafe(method(new))]
90        #[unsafe(method_family = new)]
91        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
92    );
93}
94
95/// Methods declared on superclass `UIHoverStyle`.
96#[cfg(feature = "UIHoverStyle")]
97impl UIPointerStyle {
98    extern_methods!(
99        #[cfg(feature = "UIShape")]
100        /// Creates a hover style with the provided shape and a `UIHoverAutomaticEffect`.
101        #[unsafe(method(styleWithShape:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn styleWithShape(
104            shape: Option<&UIShape>,
105            mtm: MainThreadMarker,
106        ) -> Retained<Self>;
107
108        /// Creates a hover style with the default shape and a `UIHoverAutomaticEffect`.
109        #[unsafe(method(automaticStyle))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn automaticStyle(mtm: MainThreadMarker) -> Retained<Self>;
112    );
113}
114
115extern_class!(
116    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointereffect?language=objc)
117    #[unsafe(super(NSObject))]
118    #[thread_kind = MainThreadOnly]
119    #[derive(Debug, PartialEq, Eq, Hash)]
120    pub struct UIPointerEffect;
121);
122
123unsafe impl NSCopying for UIPointerEffect {}
124
125unsafe impl CopyingHelper for UIPointerEffect {
126    type Result = Self;
127}
128
129unsafe impl NSObjectProtocol for UIPointerEffect {}
130
131#[cfg(feature = "UIHoverEffect")]
132unsafe impl UIHoverEffect for UIPointerEffect {}
133
134impl UIPointerEffect {
135    extern_methods!(
136        #[cfg(feature = "UITargetedPreview")]
137        #[unsafe(method(preview))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn preview(&self) -> Retained<UITargetedPreview>;
140
141        #[cfg(feature = "UITargetedPreview")]
142        /// Creates a pointer content effect with the given preview's view.
143        ///
144        ///
145        /// Parameter `preview`: A UITargetedPreview object describing a view with which to construct the effect.
146        ///
147        ///
148        /// UIPointerEffect attempts to determine the appropriate effect for the given preview automatically.
149        /// Use one of its subclasses to request a specific system-provided effect.
150        #[unsafe(method(effectWithPreview:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn effectWithPreview(preview: &UITargetedPreview) -> Retained<Self>;
153
154        #[unsafe(method(init))]
155        #[unsafe(method_family = init)]
156        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
157
158        #[unsafe(method(new))]
159        #[unsafe(method_family = new)]
160        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
161    );
162}
163
164extern_class!(
165    /// Pointer slides under the given view and morphs into the view's shape
166    ///
167    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerhighlighteffect?language=objc)
168    #[unsafe(super(UIPointerEffect, NSObject))]
169    #[thread_kind = MainThreadOnly]
170    #[derive(Debug, PartialEq, Eq, Hash)]
171    pub struct UIPointerHighlightEffect;
172);
173
174unsafe impl NSCopying for UIPointerHighlightEffect {}
175
176unsafe impl CopyingHelper for UIPointerHighlightEffect {
177    type Result = Self;
178}
179
180unsafe impl NSObjectProtocol for UIPointerHighlightEffect {}
181
182#[cfg(feature = "UIHoverEffect")]
183unsafe impl UIHoverEffect for UIPointerHighlightEffect {}
184
185impl UIPointerHighlightEffect {
186    extern_methods!();
187}
188
189/// Methods declared on superclass `UIPointerEffect`.
190impl UIPointerHighlightEffect {
191    extern_methods!(
192        #[cfg(feature = "UITargetedPreview")]
193        /// Creates a pointer content effect with the given preview's view.
194        ///
195        ///
196        /// Parameter `preview`: A UITargetedPreview object describing a view with which to construct the effect.
197        ///
198        ///
199        /// UIPointerEffect attempts to determine the appropriate effect for the given preview automatically.
200        /// Use one of its subclasses to request a specific system-provided effect.
201        #[unsafe(method(effectWithPreview:))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn effectWithPreview(preview: &UITargetedPreview) -> Retained<Self>;
204
205        #[unsafe(method(init))]
206        #[unsafe(method_family = init)]
207        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
208
209        #[unsafe(method(new))]
210        #[unsafe(method_family = new)]
211        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
212    );
213}
214
215extern_class!(
216    /// Pointer slides under the given view and disappears as the view scales up and gains a shadow.
217    ///
218    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerlifteffect?language=objc)
219    #[unsafe(super(UIPointerEffect, NSObject))]
220    #[thread_kind = MainThreadOnly]
221    #[derive(Debug, PartialEq, Eq, Hash)]
222    pub struct UIPointerLiftEffect;
223);
224
225unsafe impl NSCopying for UIPointerLiftEffect {}
226
227unsafe impl CopyingHelper for UIPointerLiftEffect {
228    type Result = Self;
229}
230
231unsafe impl NSObjectProtocol for UIPointerLiftEffect {}
232
233#[cfg(feature = "UIHoverEffect")]
234unsafe impl UIHoverEffect for UIPointerLiftEffect {}
235
236impl UIPointerLiftEffect {
237    extern_methods!();
238}
239
240/// Methods declared on superclass `UIPointerEffect`.
241impl UIPointerLiftEffect {
242    extern_methods!(
243        #[cfg(feature = "UITargetedPreview")]
244        /// Creates a pointer content effect with the given preview's view.
245        ///
246        ///
247        /// Parameter `preview`: A UITargetedPreview object describing a view with which to construct the effect.
248        ///
249        ///
250        /// UIPointerEffect attempts to determine the appropriate effect for the given preview automatically.
251        /// Use one of its subclasses to request a specific system-provided effect.
252        #[unsafe(method(effectWithPreview:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn effectWithPreview(preview: &UITargetedPreview) -> Retained<Self>;
255
256        #[unsafe(method(init))]
257        #[unsafe(method_family = init)]
258        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
259
260        #[unsafe(method(new))]
261        #[unsafe(method_family = new)]
262        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
263    );
264}
265
266/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointereffecttintmode?language=objc)
267// NS_ENUM
268#[repr(transparent)]
269#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
270pub struct UIPointerEffectTintMode(pub NSInteger);
271impl UIPointerEffectTintMode {
272    #[doc(alias = "UIPointerEffectTintModeNone")]
273    pub const None: Self = Self(0);
274    #[doc(alias = "UIPointerEffectTintModeOverlay")]
275    pub const Overlay: Self = Self(1);
276    #[doc(alias = "UIPointerEffectTintModeUnderlay")]
277    pub const Underlay: Self = Self(2);
278}
279
280unsafe impl Encode for UIPointerEffectTintMode {
281    const ENCODING: Encoding = NSInteger::ENCODING;
282}
283
284unsafe impl RefEncode for UIPointerEffectTintMode {
285    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
286}
287
288extern_class!(
289    /// Pointer retains the system shape while over the given view. Visual changes applied to the view are dictated by the effect's properties.
290    ///
291    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerhovereffect?language=objc)
292    #[unsafe(super(UIPointerEffect, NSObject))]
293    #[thread_kind = MainThreadOnly]
294    #[derive(Debug, PartialEq, Eq, Hash)]
295    pub struct UIPointerHoverEffect;
296);
297
298unsafe impl NSCopying for UIPointerHoverEffect {}
299
300unsafe impl CopyingHelper for UIPointerHoverEffect {
301    type Result = Self;
302}
303
304unsafe impl NSObjectProtocol for UIPointerHoverEffect {}
305
306#[cfg(feature = "UIHoverEffect")]
307unsafe impl UIHoverEffect for UIPointerHoverEffect {}
308
309impl UIPointerHoverEffect {
310    extern_methods!(
311        #[unsafe(method(preferredTintMode))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn preferredTintMode(&self) -> UIPointerEffectTintMode;
314
315        /// Setter for [`preferredTintMode`][Self::preferredTintMode].
316        #[unsafe(method(setPreferredTintMode:))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn setPreferredTintMode(&self, preferred_tint_mode: UIPointerEffectTintMode);
319
320        #[unsafe(method(prefersShadow))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn prefersShadow(&self) -> bool;
323
324        /// Setter for [`prefersShadow`][Self::prefersShadow].
325        #[unsafe(method(setPrefersShadow:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn setPrefersShadow(&self, prefers_shadow: bool);
328
329        #[unsafe(method(prefersScaledContent))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn prefersScaledContent(&self) -> bool;
332
333        /// Setter for [`prefersScaledContent`][Self::prefersScaledContent].
334        #[unsafe(method(setPrefersScaledContent:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn setPrefersScaledContent(&self, prefers_scaled_content: bool);
337    );
338}
339
340/// Methods declared on superclass `UIPointerEffect`.
341impl UIPointerHoverEffect {
342    extern_methods!(
343        #[cfg(feature = "UITargetedPreview")]
344        /// Creates a pointer content effect with the given preview's view.
345        ///
346        ///
347        /// Parameter `preview`: A UITargetedPreview object describing a view with which to construct the effect.
348        ///
349        ///
350        /// UIPointerEffect attempts to determine the appropriate effect for the given preview automatically.
351        /// Use one of its subclasses to request a specific system-provided effect.
352        #[unsafe(method(effectWithPreview:))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn effectWithPreview(preview: &UITargetedPreview) -> Retained<Self>;
355
356        #[unsafe(method(init))]
357        #[unsafe(method_family = init)]
358        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
359
360        #[unsafe(method(new))]
361        #[unsafe(method_family = new)]
362        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
363    );
364}
365
366extern_class!(
367    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointershape?language=objc)
368    #[unsafe(super(NSObject))]
369    #[thread_kind = MainThreadOnly]
370    #[derive(Debug, PartialEq, Eq, Hash)]
371    pub struct UIPointerShape;
372);
373
374unsafe impl NSCopying for UIPointerShape {}
375
376unsafe impl CopyingHelper for UIPointerShape {
377    type Result = Self;
378}
379
380unsafe impl NSObjectProtocol for UIPointerShape {}
381
382impl UIPointerShape {
383    extern_methods!(
384        #[cfg(feature = "UIBezierPath")]
385        /// UIBezierPath describing the pointer's shape. If used alongside a content effect, the shape must be
386        /// in the effect's preview's container view's coordinate space. When used as a standalone shape,
387        /// The path's bounds' origin corresponds to the pointer's physical location.
388        #[unsafe(method(shapeWithPath:))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn shapeWithPath(path: &UIBezierPath, mtm: MainThreadMarker) -> Retained<Self>;
391
392        #[cfg(feature = "objc2-core-foundation")]
393        /// Morphs the pointer to a rounded rectangle with the provided rect and the standard system corner radius.
394        ///
395        ///
396        /// Parameter `rect`: CGRect describing the pointer's frame. If used alongside a content effect, this rect must be in the effect's
397        /// preview's container view's coordinate space. Otherwise, it is centered about the pointer's current location
398        /// and the rect's origin is interpreted as an offset.
399        #[unsafe(method(shapeWithRoundedRect:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn shapeWithRoundedRect(rect: CGRect, mtm: MainThreadMarker) -> Retained<Self>;
402
403        #[cfg(feature = "objc2-core-foundation")]
404        /// Morphs the pointer to a rounded rectangle with the provided rect and cornerRadius.
405        ///
406        ///
407        /// Parameter `rect`: CGRect describing the pointer's frame. If used alongside a content effect, this rect must be in
408        /// the effect's preview's container view's coordinate space. Otherwise, it is centered about the
409        /// pointer's current location and the rect's origin is interpreted as an offset.
410        ///
411        /// Parameter `cornerRadius`: Corner radius to apply to the pointer.
412        #[unsafe(method(shapeWithRoundedRect:cornerRadius:))]
413        #[unsafe(method_family = none)]
414        pub unsafe fn shapeWithRoundedRect_cornerRadius(
415            rect: CGRect,
416            corner_radius: CGFloat,
417            mtm: MainThreadMarker,
418        ) -> Retained<Self>;
419
420        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
421        /// Morphs the pointer to a beam with the given length and axis.
422        ///
423        ///
424        /// Parameter `length`: The beam's length. Limited to the region's width or height, depending on the beam's axis.
425        ///
426        /// Parameter `axis`: The axis along which to draw the beam. Axis must be either UIAxisVertical or UIAxisHorizontal.
427        #[unsafe(method(beamWithPreferredLength:axis:))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn beamWithPreferredLength_axis(
430            length: CGFloat,
431            axis: UIAxis,
432            mtm: MainThreadMarker,
433        ) -> Retained<Self>;
434
435        #[unsafe(method(init))]
436        #[unsafe(method_family = init)]
437        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
438
439        #[unsafe(method(new))]
440        #[unsafe(method_family = new)]
441        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
442    );
443}