objc2_ui_kit/generated/
UITextInteraction.rs1use 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
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UITextInteractionMode(pub NSInteger);
17impl UITextInteractionMode {
18 #[doc(alias = "UITextInteractionModeEditable")]
19 pub const Editable: Self = Self(0);
20 #[doc(alias = "UITextInteractionModeNonEditable")]
21 pub const NonEditable: Self = Self(1);
22}
23
24unsafe impl Encode for UITextInteractionMode {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for UITextInteractionMode {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_protocol!(
33 pub unsafe trait UITextInteractionDelegate: NSObjectProtocol + MainThreadOnly {
35 #[cfg(feature = "objc2-core-foundation")]
36 #[optional]
37 #[unsafe(method(interactionShouldBegin:atPoint:))]
38 #[unsafe(method_family = none)]
39 unsafe fn interactionShouldBegin_atPoint(
40 &self,
41 interaction: &UITextInteraction,
42 point: CGPoint,
43 ) -> bool;
44
45 #[optional]
46 #[unsafe(method(interactionWillBegin:))]
47 #[unsafe(method_family = none)]
48 unsafe fn interactionWillBegin(&self, interaction: &UITextInteraction);
49
50 #[optional]
51 #[unsafe(method(interactionDidEnd:))]
52 #[unsafe(method_family = none)]
53 unsafe fn interactionDidEnd(&self, interaction: &UITextInteraction);
54 }
55);
56
57extern_class!(
58 #[unsafe(super(NSObject))]
60 #[thread_kind = MainThreadOnly]
61 #[derive(Debug, PartialEq, Eq, Hash)]
62 pub struct UITextInteraction;
63);
64
65extern_conformance!(
66 unsafe impl NSObjectProtocol for UITextInteraction {}
67);
68
69#[cfg(feature = "UIInteraction")]
70extern_conformance!(
71 unsafe impl UIInteraction for UITextInteraction {}
72);
73
74impl UITextInteraction {
75 extern_methods!(
76 #[unsafe(method(delegate))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn delegate(
79 &self,
80 ) -> Option<Retained<ProtocolObject<dyn UITextInteractionDelegate>>>;
81
82 #[unsafe(method(setDelegate:))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn setDelegate(
87 &self,
88 delegate: Option<&ProtocolObject<dyn UITextInteractionDelegate>>,
89 );
90
91 #[cfg(all(
92 feature = "UIResponder",
93 feature = "UITextInput",
94 feature = "UITextInputTraits"
95 ))]
96 #[unsafe(method(textInput))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn textInput(&self) -> Option<Retained<UIResponder>>;
99
100 #[cfg(all(
101 feature = "UIResponder",
102 feature = "UITextInput",
103 feature = "UITextInputTraits"
104 ))]
105 #[unsafe(method(setTextInput:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn setTextInput(&self, text_input: Option<&UIResponder>);
110
111 #[unsafe(method(textInteractionMode))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn textInteractionMode(&self) -> UITextInteractionMode;
114
115 #[cfg(feature = "UIGestureRecognizer")]
116 #[unsafe(method(gesturesForFailureRequirements))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn gesturesForFailureRequirements(
119 &self,
120 ) -> Retained<NSArray<UIGestureRecognizer>>;
121
122 #[unsafe(method(textInteractionForMode:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn textInteractionForMode(
125 mode: UITextInteractionMode,
126 mtm: MainThreadMarker,
127 ) -> Retained<Self>;
128 );
129}
130
131impl UITextInteraction {
133 extern_methods!(
134 #[unsafe(method(init))]
135 #[unsafe(method_family = init)]
136 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
137
138 #[unsafe(method(new))]
139 #[unsafe(method_family = new)]
140 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
141 );
142}