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