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 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 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 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 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 fn isEnabled(&self) -> bool;
67
68        /// Setter for [`isEnabled`][Self::isEnabled].
69        #[unsafe(method(setEnabled:))]
70        #[unsafe(method_family = none)]
71        pub 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 fn styleWithShape(shape: Option<&UIShape>, mtm: MainThreadMarker) -> Retained<Self>;
87
88        /// Creates a hover style with the default shape and a `UIHoverAutomaticEffect`.
89        #[unsafe(method(automaticStyle))]
90        #[unsafe(method_family = none)]
91        pub fn automaticStyle(mtm: MainThreadMarker) -> Retained<Self>;
92
93        #[unsafe(method(init))]
94        #[unsafe(method_family = init)]
95        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
96
97        #[unsafe(method(new))]
98        #[unsafe(method_family = new)]
99        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
100    );
101}
102
103/// UIHoverStyle.
104#[cfg(all(feature = "UIResponder", feature = "UIView"))]
105impl UIView {
106    extern_methods!(
107        /// The hover style associated with this view. Defaults to `nil`,
108        /// indicating that this view should not have any hover effect.
109        /// Subclasses may configure this style to use a different default value.
110        #[unsafe(method(hoverStyle))]
111        #[unsafe(method_family = none)]
112        pub fn hoverStyle(&self) -> Option<Retained<UIHoverStyle>>;
113
114        /// Setter for [`hoverStyle`][Self::hoverStyle].
115        ///
116        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
117        #[unsafe(method(setHoverStyle:))]
118        #[unsafe(method_family = none)]
119        pub fn setHoverStyle(&self, hover_style: Option<&UIHoverStyle>);
120    );
121}