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