1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;
use crate::*;
extern_class!(
/// A layer type that can be used to apply a hover effect to its sublayers.
///
/// This layer type is useful for adding hover effects to an existing
/// ``CALayer`` hierarchy. Where possible, use ``UIView.hoverStyle`` instead.
///
/// A ``UIHoverEffectLayer`` is configured with:
///
/// 1. A container ``UIView``, which is used to infer some properties of the
/// hover effect from its trait collection and to allow some aspects of the
/// hover effect to behave correctly. This view's layer should be an ancestor
/// layer of the ``UIHoverEffectLayer``.
/// 2. A ``UIHoverStyle``, which describes the effect to use and the shape of
/// that effect. You then add your content layers that should receive a hover
/// effect as sublayers of this layer.
///
/// ``UIHoverEffectLayer`` may add its own internal sublayers as background or
/// overlay layers relative to your content sublayers. To preserve the correct
/// appearance of the effect, these internal sublayers are automatically sorted
/// accordingly within the layer's layout pass. As such, do not assume that the
/// indices of your content sublayers will remain stable throughout the lifetime
/// of the layer.
///
/// - Note: Not all ``UIHoverStyle``s may be supported by
/// ``UIHoverEffectLayer``. If the provided style is not supported, a fallback
/// style will be selected instead.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uihovereffectlayer?language=objc)
#[unsafe(super(CALayer, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
pub struct UIHoverEffectLayer;
);
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl CAMediaTiming for UIHoverEffectLayer {}
);
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl NSCoding for UIHoverEffectLayer {}
);
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UIHoverEffectLayer {}
);
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
unsafe impl NSSecureCoding for UIHoverEffectLayer {}
);
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
impl UIHoverEffectLayer {
extern_methods!(
#[cfg(feature = "UIHoverStyle")]
/// The hover style to apply to the sublayers of this layer when this layer
/// is hovered (e.g., when the user looks at this layer). Defaults to the
/// automatic style.
///
/// - Note: Not all ``UIHoverStyle``s may be supported by
/// ``UIHoverEffectLayer``. If the provided style is not supported, a fallback
/// style will be selected instead.
#[unsafe(method(hoverStyle))]
#[unsafe(method_family = none)]
pub fn hoverStyle(&self) -> Retained<UIHoverStyle>;
#[cfg(feature = "UIHoverStyle")]
/// Setter for [`hoverStyle`][Self::hoverStyle].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setHoverStyle:))]
#[unsafe(method_family = none)]
pub fn setHoverStyle(&self, hover_style: &UIHoverStyle);
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
/// The ``UIView`` in which this layer is contained. This view is used to
/// derive traits and other properties for applying the correct hover effect
/// to the layer. It may also be used to assist with applying some kinds of
/// hover effects to the layer.
///
/// The ``containerView`` should be an ancestor of this layer (once it has
/// been added to a layer hierarchy) to behave correctly, but does not need
/// to be the immediate parent of this layer. If the ``containerView`` is
/// set to nil or is deallocated, some aspects of this layer's hover effect
/// may no longer work correctly.
#[unsafe(method(containerView))]
#[unsafe(method_family = none)]
pub fn containerView(&self) -> Option<Retained<UIView>>;
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
/// Setter for [`containerView`][Self::containerView].
///
/// This is a [weak property][objc2::topics::weak_property].
#[unsafe(method(setContainerView:))]
#[unsafe(method_family = none)]
pub fn setContainerView(&self, container_view: Option<&UIView>);
#[cfg(all(feature = "UIHoverStyle", feature = "UIResponder", feature = "UIView"))]
/// Creates a ``UIHoverEffectLayer`` with the provided `containerView`
/// and `style`. If a `nil` `style` is provided, the automatic style will
/// be used instead.
#[unsafe(method(initWithContainerView:style:))]
#[unsafe(method_family = init)]
pub fn initWithContainerView_style(
this: Allocated<Self>,
container_view: &UIView,
style: Option<&UIHoverStyle>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `CALayer`.
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
impl UIHoverEffectLayer {
extern_methods!(
/// Layer creation and initialization. *
#[unsafe(method(layer))]
#[unsafe(method_family = none)]
pub fn layer(mtm: MainThreadMarker) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
/// # Safety
///
/// `layer` should be of the correct type.
#[unsafe(method(initWithLayer:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
impl UIHoverEffectLayer {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}