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"))]
51extern_conformance!(
52    unsafe impl CAMediaTiming for UIHoverEffectLayer {}
53);
54
55#[cfg(feature = "objc2-quartz-core")]
56#[cfg(not(target_os = "watchos"))]
57extern_conformance!(
58    unsafe impl NSCoding for UIHoverEffectLayer {}
59);
60
61#[cfg(feature = "objc2-quartz-core")]
62#[cfg(not(target_os = "watchos"))]
63extern_conformance!(
64    unsafe impl NSObjectProtocol for UIHoverEffectLayer {}
65);
66
67#[cfg(feature = "objc2-quartz-core")]
68#[cfg(not(target_os = "watchos"))]
69extern_conformance!(
70    unsafe impl NSSecureCoding for UIHoverEffectLayer {}
71);
72
73#[cfg(feature = "objc2-quartz-core")]
74#[cfg(not(target_os = "watchos"))]
75impl UIHoverEffectLayer {
76    extern_methods!(
77        #[cfg(feature = "UIHoverStyle")]
78        /// The hover style to apply to the sublayers of this layer when this layer
79        /// is hovered (e.g., when the user looks at this layer). Defaults to the
80        /// automatic style.
81        ///
82        /// - Note: Not all ``UIHoverStyle``s may be supported by
83        /// ``UIHoverEffectLayer``. If the provided style is not supported, a fallback
84        /// style will be selected instead.
85        #[unsafe(method(hoverStyle))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn hoverStyle(&self) -> Retained<UIHoverStyle>;
88
89        #[cfg(feature = "UIHoverStyle")]
90        /// Setter for [`hoverStyle`][Self::hoverStyle].
91        #[unsafe(method(setHoverStyle:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setHoverStyle(&self, hover_style: &UIHoverStyle);
94
95        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
96        /// The ``UIView`` in which this layer is contained. This view is used to
97        /// derive traits and other properties for applying the correct hover effect
98        /// to the layer. It may also be used to assist with applying some kinds of
99        /// hover effects to the layer.
100        ///
101        /// The ``containerView`` should be an ancestor of this layer (once it has
102        /// been added to a layer hierarchy) to behave correctly, but does not need
103        /// to be the immediate parent of this layer. If the ``containerView`` is
104        /// set to nil or is deallocated, some aspects of this layer's hover effect
105        /// may no longer work correctly.
106        #[unsafe(method(containerView))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn containerView(&self) -> Option<Retained<UIView>>;
109
110        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
111        /// This is a [weak property][objc2::topics::weak_property].
112        /// Setter for [`containerView`][Self::containerView].
113        #[unsafe(method(setContainerView:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn setContainerView(&self, container_view: Option<&UIView>);
116
117        #[cfg(all(feature = "UIHoverStyle", feature = "UIResponder", feature = "UIView"))]
118        /// Creates a ``UIHoverEffectLayer`` with the provided `containerView`
119        /// and `style`. If a `nil` `style` is provided, the automatic style will
120        /// be used instead.
121        #[unsafe(method(initWithContainerView:style:))]
122        #[unsafe(method_family = init)]
123        pub unsafe fn initWithContainerView_style(
124            this: Allocated<Self>,
125            container_view: &UIView,
126            style: Option<&UIHoverStyle>,
127        ) -> Retained<Self>;
128    );
129}
130
131/// Methods declared on superclass `CALayer`.
132#[cfg(feature = "objc2-quartz-core")]
133#[cfg(not(target_os = "watchos"))]
134impl UIHoverEffectLayer {
135    extern_methods!(
136        /// Layer creation and initialization. *
137        #[unsafe(method(layer))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn layer(mtm: MainThreadMarker) -> Retained<Self>;
140
141        #[unsafe(method(init))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
144
145        #[unsafe(method(initWithLayer:))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
148    );
149}
150
151/// Methods declared on superclass `NSObject`.
152#[cfg(feature = "objc2-quartz-core")]
153#[cfg(not(target_os = "watchos"))]
154impl UIHoverEffectLayer {
155    extern_methods!(
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
159    );
160}