objc2_ui_kit/generated/
UITextCursorDropPositionAnimator.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
7use crate::*;
8
9extern_class!(
10    /// Provides a mechanism for displaying and animating a temporary text cursor to indicate a drop location.
11    ///
12    /// For custom text view implementations that implement drag and drop functionality, use this animator providing either your own UITextCursorView
13    /// implementation or a concrete implementation to indicate at which point in your document the dropped item will be inserted. Using this animator provides
14    /// you with all of the default system animations for how the text cursor would behave.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextcursordroppositionanimator?language=objc)
17    #[unsafe(super(NSObject))]
18    #[thread_kind = MainThreadOnly]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    pub struct UITextCursorDropPositionAnimator;
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for UITextCursorDropPositionAnimator {}
25);
26
27impl UITextCursorDropPositionAnimator {
28    extern_methods!(
29        #[cfg(all(
30            feature = "UIResponder",
31            feature = "UITextCursorView",
32            feature = "UIView"
33        ))]
34        /// The cursor view to be animated.
35        #[unsafe(method(cursorView))]
36        #[unsafe(method_family = none)]
37        pub fn cursorView(&self) -> Option<Retained<UIView>>;
38
39        #[cfg(all(
40            feature = "UIResponder",
41            feature = "UITextInput",
42            feature = "UITextInputTraits",
43            feature = "UIView"
44        ))]
45        /// The object that implements the UITextInput protocol, used to query for geometry information regarding cursor placement.
46        #[unsafe(method(textInput))]
47        #[unsafe(method_family = none)]
48        pub fn textInput(&self) -> Option<Retained<UIView>>;
49
50        #[cfg(all(
51            feature = "UIResponder",
52            feature = "UITextCursorView",
53            feature = "UITextInput",
54            feature = "UITextInputTraits",
55            feature = "UIView"
56        ))]
57        /// Creates an animator for the given text cursor view implementation, and the document object that implements the UITextInput protocol.
58        ///
59        /// # Safety
60        ///
61        /// - `cursor_view` must implement UITextCursorView.
62        /// - `cursor_view` might not allow `None`.
63        /// - `text_input` must implement UITextInput.
64        /// - `text_input` might not allow `None`.
65        #[unsafe(method(initWithTextCursorView:textInput:))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn initWithTextCursorView_textInput(
68            this: Allocated<Self>,
69            cursor_view: Option<&UIView>,
70            text_input: Option<&UIView>,
71        ) -> Option<Retained<Self>>;
72
73        /// Controls the visibility of the cursor.
74        #[unsafe(method(setCursorVisible:animated:))]
75        #[unsafe(method_family = none)]
76        pub fn setCursorVisible_animated(&self, visible: bool, animated: bool);
77
78        #[cfg(feature = "UITextInput")]
79        /// Controls the placement of the cursor, using
80        /// `textInput`and
81        /// `position`to compute the final frame for the cursor view.
82        ///
83        /// # Safety
84        ///
85        /// `position` might not allow `None`.
86        #[unsafe(method(placeCursorAtPosition:animated:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn placeCursorAtPosition_animated(
89            &self,
90            position: Option<&UITextPosition>,
91            animated: bool,
92        );
93
94        #[cfg(feature = "block2")]
95        /// Optionally, provide an animation block or completion block to run alongside cursor appearance or position update animations.
96        #[unsafe(method(animateAlongsideChanges:completion:))]
97        #[unsafe(method_family = none)]
98        pub fn animateAlongsideChanges_completion(
99            &self,
100            animation: Option<&block2::DynBlock<dyn Fn()>>,
101            completion: Option<&block2::DynBlock<dyn Fn()>>,
102        );
103
104        #[unsafe(method(init))]
105        #[unsafe(method_family = init)]
106        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
107    );
108}
109
110/// Methods declared on superclass `NSObject`.
111impl UITextCursorDropPositionAnimator {
112    extern_methods!(
113        #[unsafe(method(new))]
114        #[unsafe(method_family = new)]
115        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
116    );
117}