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