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