objc2_ui_kit/generated/
UIToolTipInteraction.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitooltipinteraction?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct UIToolTipInteraction;
18);
19
20extern_conformance!(
21    unsafe impl NSObjectProtocol for UIToolTipInteraction {}
22);
23
24#[cfg(feature = "UIInteraction")]
25extern_conformance!(
26    unsafe impl UIInteraction for UIToolTipInteraction {}
27);
28
29impl UIToolTipInteraction {
30    extern_methods!(
31        /// The interaction's delegate.
32        #[unsafe(method(delegate))]
33        #[unsafe(method_family = none)]
34        pub unsafe fn delegate(
35            &self,
36        ) -> Option<Retained<ProtocolObject<dyn UIToolTipInteractionDelegate>>>;
37
38        /// This is a [weak property][objc2::topics::weak_property].
39        /// Setter for [`delegate`][Self::delegate].
40        #[unsafe(method(setDelegate:))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn setDelegate(
43            &self,
44            delegate: Option<&ProtocolObject<dyn UIToolTipInteractionDelegate>>,
45        );
46
47        /// Indicates whether the interaction is enabled. Defaults to YES.
48        #[unsafe(method(isEnabled))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn isEnabled(&self) -> bool;
51
52        /// Setter for [`isEnabled`][Self::isEnabled].
53        #[unsafe(method(setEnabled:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn setEnabled(&self, enabled: bool);
56
57        /// The interaction's default tool tip string.
58        #[unsafe(method(defaultToolTip))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn defaultToolTip(&self) -> Option<Retained<NSString>>;
61
62        /// Setter for [`defaultToolTip`][Self::defaultToolTip].
63        #[unsafe(method(setDefaultToolTip:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn setDefaultToolTip(&self, default_tool_tip: Option<&NSString>);
66
67        /// Creates a UIToolTipInteraction.
68        #[unsafe(method(init))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
71
72        #[unsafe(method(initWithDefaultToolTip:))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn initWithDefaultToolTip(
75            this: Allocated<Self>,
76            default_tool_tip: &NSString,
77        ) -> Retained<Self>;
78    );
79}
80
81/// Methods declared on superclass `NSObject`.
82impl UIToolTipInteraction {
83    extern_methods!(
84        #[unsafe(method(new))]
85        #[unsafe(method_family = new)]
86        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
87    );
88}
89
90extern_class!(
91    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitooltipconfiguration?language=objc)
92    #[unsafe(super(NSObject))]
93    #[thread_kind = MainThreadOnly]
94    #[derive(Debug, PartialEq, Eq, Hash)]
95    pub struct UIToolTipConfiguration;
96);
97
98extern_conformance!(
99    unsafe impl NSObjectProtocol for UIToolTipConfiguration {}
100);
101
102impl UIToolTipConfiguration {
103    extern_methods!(
104        /// The string to annotate the contents at a given point.
105        #[unsafe(method(toolTip))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn toolTip(&self) -> Retained<NSString>;
108
109        #[cfg(feature = "objc2-core-foundation")]
110        /// The rectangle containing the contents being annotated by the tool tip. Value is CGRectNull if the tool tip applies to the entire view.
111        #[unsafe(method(sourceRect))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn sourceRect(&self) -> CGRect;
114
115        /// Creates a UIToolTipConfiguration with the provided string, applied to the entire view.
116        #[unsafe(method(configurationWithToolTip:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn configurationWithToolTip(
119            tool_tip: &NSString,
120            mtm: MainThreadMarker,
121        ) -> Retained<Self>;
122
123        #[cfg(feature = "objc2-core-foundation")]
124        /// Creates a UIToolTipConfiguration with the provided string, applied to the specified region.
125        #[unsafe(method(configurationWithToolTip:inRect:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn configurationWithToolTip_inRect(
128            tool_tip: &NSString,
129            source_rect: CGRect,
130            mtm: MainThreadMarker,
131        ) -> Retained<Self>;
132
133        #[unsafe(method(new))]
134        #[unsafe(method_family = new)]
135        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
136
137        #[unsafe(method(init))]
138        #[unsafe(method_family = init)]
139        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
140    );
141}
142
143extern_protocol!(
144    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitooltipinteractiondelegate?language=objc)
145    pub unsafe trait UIToolTipInteractionDelegate:
146        NSObjectProtocol + MainThreadOnly
147    {
148        #[cfg(feature = "objc2-core-foundation")]
149        /// Called when the interaction is about to begin.
150        ///
151        ///
152        /// Parameter `interaction`: This UIToolTipInteraction.
153        ///
154        ///
155        /// Returns: The tool tip configuration containing the string and rectangle for this interaction. Return nil if the interaction is inactive or the hit test fails.
156        #[optional]
157        #[unsafe(method(toolTipInteraction:configurationAtPoint:))]
158        #[unsafe(method_family = none)]
159        unsafe fn toolTipInteraction_configurationAtPoint(
160            &self,
161            interaction: &UIToolTipInteraction,
162            point: CGPoint,
163        ) -> Option<Retained<UIToolTipConfiguration>>;
164    }
165);