objc2_ui_kit/generated/
UITextInteraction.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
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextinteractionmode?language=objc)
13// NS_ENUM
14#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextinteractiondelegate?language=objc)
34    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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextinteraction?language=objc)
59    #[unsafe(super(NSObject))]
60    #[thread_kind = MainThreadOnly]
61    #[derive(Debug, PartialEq, Eq, Hash)]
62    pub struct UITextInteraction;
63);
64
65unsafe impl NSObjectProtocol for UITextInteraction {}
66
67#[cfg(feature = "UIInteraction")]
68unsafe impl UIInteraction for UITextInteraction {}
69
70impl UITextInteraction {
71    extern_methods!(
72        #[unsafe(method(delegate))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn delegate(
75            &self,
76        ) -> Option<Retained<ProtocolObject<dyn UITextInteractionDelegate>>>;
77
78        /// This is a [weak property][objc2::topics::weak_property].
79        /// Setter for [`delegate`][Self::delegate].
80        #[unsafe(method(setDelegate:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setDelegate(
83            &self,
84            delegate: Option<&ProtocolObject<dyn UITextInteractionDelegate>>,
85        );
86
87        #[cfg(all(
88            feature = "UIResponder",
89            feature = "UITextInput",
90            feature = "UITextInputTraits"
91        ))]
92        #[unsafe(method(textInput))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn textInput(&self) -> Option<Retained<UIResponder>>;
95
96        #[cfg(all(
97            feature = "UIResponder",
98            feature = "UITextInput",
99            feature = "UITextInputTraits"
100        ))]
101        /// This is a [weak property][objc2::topics::weak_property].
102        /// Setter for [`textInput`][Self::textInput].
103        #[unsafe(method(setTextInput:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn setTextInput(&self, text_input: Option<&UIResponder>);
106
107        #[unsafe(method(textInteractionMode))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn textInteractionMode(&self) -> UITextInteractionMode;
110
111        #[cfg(feature = "UIGestureRecognizer")]
112        #[unsafe(method(gesturesForFailureRequirements))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn gesturesForFailureRequirements(
115            &self,
116        ) -> Retained<NSArray<UIGestureRecognizer>>;
117
118        #[unsafe(method(textInteractionForMode:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn textInteractionForMode(
121            mode: UITextInteractionMode,
122            mtm: MainThreadMarker,
123        ) -> Retained<Self>;
124    );
125}
126
127/// Methods declared on superclass `NSObject`.
128impl UITextInteraction {
129    extern_methods!(
130        #[unsafe(method(init))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
133
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
137    );
138}