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