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 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 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 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 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 fn containerView(&self, mtm: MainThreadMarker) -> Option<Retained<UIView>>;
127
128        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
129        /// Setter for [`containerView`][Self::containerView].
130        ///
131        /// This is a [weak property][objc2::topics::weak_property].
132        #[unsafe(method(setContainerView:))]
133        #[unsafe(method_family = none)]
134        pub fn setContainerView(&self, container_view: Option<&UIView>);
135
136        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
137        /// When set, the halo is placed above this view. If a
138        /// `containerView`is also set, the
139        /// `referenceView`must be a descendant
140        /// of the
141        /// `containerView.`The system will ensure that the halo is in the container but visually above the
142        /// `referenceView.`
143        #[unsafe(method(referenceView))]
144        #[unsafe(method_family = none)]
145        pub fn referenceView(&self, mtm: MainThreadMarker) -> Option<Retained<UIView>>;
146
147        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
148        /// Setter for [`referenceView`][Self::referenceView].
149        ///
150        /// This is a [weak property][objc2::topics::weak_property].
151        #[unsafe(method(setReferenceView:))]
152        #[unsafe(method_family = none)]
153        pub fn setReferenceView(&self, reference_view: Option<&UIView>);
154
155        /// Position of the halo relative to the specified shape. Defaults to
156        /// `UIFocusHaloEffectPositionAutomatic.`
157        #[unsafe(method(position))]
158        #[unsafe(method_family = none)]
159        pub fn position(&self) -> UIFocusHaloEffectPosition;
160
161        /// Setter for [`position`][Self::position].
162        #[unsafe(method(setPosition:))]
163        #[unsafe(method_family = none)]
164        pub fn setPosition(&self, position: UIFocusHaloEffectPosition);
165    );
166}
167
168/// Methods declared on superclass `UIFocusEffect`.
169impl UIFocusHaloEffect {
170    extern_methods!(
171        /// Creates a default system effect using metrics inferred from the focus item.
172        #[unsafe(method(effect))]
173        #[unsafe(method_family = none)]
174        pub fn effect() -> Retained<Self>;
175
176        #[unsafe(method(init))]
177        #[unsafe(method_family = init)]
178        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
179
180        #[unsafe(method(new))]
181        #[unsafe(method_family = new)]
182        pub unsafe fn new() -> Retained<Self>;
183    );
184}