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