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