objc2_ui_kit/generated/
UIHoverStyle.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
8use crate::*;
9
10extern_class!(
11    /// The hover style to apply to a view, including an effect and a shape to use
12    /// for displaying that effect.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uihoverstyle?language=objc)
15    #[unsafe(super(NSObject))]
16    #[thread_kind = MainThreadOnly]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct UIHoverStyle;
19);
20
21extern_conformance!(
22    unsafe impl NSCopying for UIHoverStyle {}
23);
24
25unsafe impl CopyingHelper for UIHoverStyle {
26    type Result = Self;
27}
28
29extern_conformance!(
30    unsafe impl NSObjectProtocol for UIHoverStyle {}
31);
32
33impl UIHoverStyle {
34    extern_methods!(
35        #[cfg(feature = "UIHoverEffect")]
36        /// The effect to apply to the view with this style. Use `UIHoverAutomaticEffect`
37        /// to apply a system-default effect to the view.
38        #[unsafe(method(effect))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn effect(&self) -> Retained<ProtocolObject<dyn UIHoverEffect>>;
41
42        #[cfg(feature = "UIHoverEffect")]
43        /// Setter for [`effect`][Self::effect].
44        #[unsafe(method(setEffect:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn setEffect(&self, effect: &ProtocolObject<dyn UIHoverEffect>);
47
48        #[cfg(feature = "UIShape")]
49        /// The shape to use for the hover effect. If a `nil` shape is used, a
50        /// system-default shape will be chosen based on the view.
51        #[unsafe(method(shape))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn shape(&self) -> Option<Retained<UIShape>>;
54
55        #[cfg(feature = "UIShape")]
56        /// Setter for [`shape`][Self::shape].
57        #[unsafe(method(setShape:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setShape(&self, shape: Option<&UIShape>);
60
61        /// Whether the effect to apply to the view with this style is enabled.
62        /// Use this property to temporarily disable a view's hover effect without
63        /// removing it from the view entirely.
64        #[unsafe(method(isEnabled))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn isEnabled(&self) -> bool;
67
68        /// Setter for [`isEnabled`][Self::isEnabled].
69        #[unsafe(method(setEnabled:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setEnabled(&self, enabled: bool);
72
73        #[cfg(all(feature = "UIHoverEffect", feature = "UIShape"))]
74        /// Creates a hover style with the provided effect and shape.
75        #[unsafe(method(styleWithEffect:shape:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn styleWithEffect_shape(
78            effect: &ProtocolObject<dyn UIHoverEffect>,
79            shape: Option<&UIShape>,
80        ) -> Retained<Self>;
81
82        #[cfg(feature = "UIShape")]
83        /// Creates a hover style with the provided shape and a `UIHoverAutomaticEffect`.
84        #[unsafe(method(styleWithShape:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn styleWithShape(
87            shape: Option<&UIShape>,
88            mtm: MainThreadMarker,
89        ) -> Retained<Self>;
90
91        /// Creates a hover style with the default shape and a `UIHoverAutomaticEffect`.
92        #[unsafe(method(automaticStyle))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn automaticStyle(mtm: MainThreadMarker) -> Retained<Self>;
95
96        #[unsafe(method(init))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
99
100        #[unsafe(method(new))]
101        #[unsafe(method_family = new)]
102        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
103    );
104}
105
106/// UIHoverStyle.
107#[cfg(all(feature = "UIResponder", feature = "UIView"))]
108impl UIView {
109    extern_methods!(
110        /// The hover style associated with this view. Defaults to `nil`,
111        /// indicating that this view should not have any hover effect.
112        /// Subclasses may configure this style to use a different default value.
113        #[unsafe(method(hoverStyle))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn hoverStyle(&self) -> Option<Retained<UIHoverStyle>>;
116
117        /// Setter for [`hoverStyle`][Self::hoverStyle].
118        #[unsafe(method(setHoverStyle:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn setHoverStyle(&self, hover_style: Option<&UIHoverStyle>);
121    );
122}