objc2_ui_kit/generated/
UIFocusEffect.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#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15extern_class!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocuseffect?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct UIFocusEffect;
20);
21
22unsafe impl NSCopying for UIFocusEffect {}
23
24unsafe impl CopyingHelper for UIFocusEffect {
25    type Result = Self;
26}
27
28unsafe impl NSObjectProtocol for UIFocusEffect {}
29
30impl UIFocusEffect {
31    extern_methods!(
32        /// Creates a default system effect using metrics inferred from the focus item.
33        #[unsafe(method(effect))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn effect() -> Retained<Self>;
36
37        #[unsafe(method(init))]
38        #[unsafe(method_family = init)]
39        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
40
41        #[unsafe(method(new))]
42        #[unsafe(method_family = new)]
43        pub unsafe fn new() -> Retained<Self>;
44    );
45}
46
47/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocushaloeffectposition?language=objc)
48// NS_ENUM
49#[repr(transparent)]
50#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
51pub struct UIFocusHaloEffectPosition(pub NSInteger);
52impl UIFocusHaloEffectPosition {
53    /// Automatically detects the best position depending on the the focus item and its containing view hierarchy.
54    #[doc(alias = "UIFocusHaloEffectPositionAutomatic")]
55    pub const Automatic: Self = Self(0);
56    /// Draws the halo around the given shape.
57    #[doc(alias = "UIFocusHaloEffectPositionOutside")]
58    pub const Outside: Self = Self(1);
59    /// Draws the halo inside the given shape.
60    #[doc(alias = "UIFocusHaloEffectPositionInside")]
61    pub const Inside: Self = Self(2);
62}
63
64unsafe impl Encode for UIFocusHaloEffectPosition {
65    const ENCODING: Encoding = NSInteger::ENCODING;
66}
67
68unsafe impl RefEncode for UIFocusHaloEffectPosition {
69    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
70}
71
72extern_class!(
73    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocushaloeffect?language=objc)
74    #[unsafe(super(UIFocusEffect, NSObject))]
75    #[derive(Debug, PartialEq, Eq, Hash)]
76    pub struct UIFocusHaloEffect;
77);
78
79unsafe impl NSCopying for UIFocusHaloEffect {}
80
81unsafe impl CopyingHelper for UIFocusHaloEffect {
82    type Result = Self;
83}
84
85unsafe impl NSObjectProtocol for UIFocusHaloEffect {}
86
87impl UIFocusHaloEffect {
88    extern_methods!(
89        #[cfg(feature = "objc2-core-foundation")]
90        /// Creates a rectangular halo.
91        #[unsafe(method(effectWithRect:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn effectWithRect(rect: CGRect) -> Retained<Self>;
94
95        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-quartz-core"))]
96        #[cfg(not(target_os = "watchos"))]
97        /// Creates a rounded rect halo using the specified corner radius and corner curve.
98        #[unsafe(method(effectWithRoundedRect:cornerRadius:curve:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn effectWithRoundedRect_cornerRadius_curve(
101            rect: CGRect,
102            corner_radius: CGFloat,
103            curve: &CALayerCornerCurve,
104        ) -> Retained<Self>;
105
106        #[cfg(feature = "UIBezierPath")]
107        /// Creates a halo with the given bezier path.
108        #[unsafe(method(effectWithPath:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn effectWithPath(bezier_path: &UIBezierPath) -> Retained<Self>;
111
112        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
113        /// Container view in which to place the effect. When not set, the container is determined automatically
114        /// from the focus item that provided this effect and the
115        /// `referenceView`(if present).
116        #[unsafe(method(containerView))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn containerView(&self, mtm: MainThreadMarker) -> Option<Retained<UIView>>;
119
120        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
121        /// This is a [weak property][objc2::topics::weak_property].
122        /// Setter for [`containerView`][Self::containerView].
123        #[unsafe(method(setContainerView:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setContainerView(&self, container_view: Option<&UIView>);
126
127        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
128        /// When set, the halo is placed above this view. If a
129        /// `containerView`is also set, the
130        /// `referenceView`must be a descendant
131        /// of the
132        /// `containerView.`The system will ensure that the halo is in the container but visually above the
133        /// `referenceView.`
134        #[unsafe(method(referenceView))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn referenceView(&self, mtm: MainThreadMarker) -> Option<Retained<UIView>>;
137
138        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
139        /// This is a [weak property][objc2::topics::weak_property].
140        /// Setter for [`referenceView`][Self::referenceView].
141        #[unsafe(method(setReferenceView:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setReferenceView(&self, reference_view: Option<&UIView>);
144
145        /// Position of the halo relative to the specified shape. Defaults to
146        /// `UIFocusHaloEffectPositionAutomatic.`
147        #[unsafe(method(position))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn position(&self) -> UIFocusHaloEffectPosition;
150
151        /// Setter for [`position`][Self::position].
152        #[unsafe(method(setPosition:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setPosition(&self, position: UIFocusHaloEffectPosition);
155    );
156}
157
158/// Methods declared on superclass `UIFocusEffect`.
159impl UIFocusHaloEffect {
160    extern_methods!(
161        /// Creates a default system effect using metrics inferred from the focus item.
162        #[unsafe(method(effect))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn effect() -> Retained<Self>;
165
166        #[unsafe(method(init))]
167        #[unsafe(method_family = init)]
168        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
169
170        #[unsafe(method(new))]
171        #[unsafe(method_family = new)]
172        pub unsafe fn new() -> Retained<Self>;
173    );
174}