objc2_ui_kit/generated/
UIFindInteraction.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uifindinteractiondelegate?language=objc)
12    pub unsafe trait UIFindInteractionDelegate: NSObjectProtocol + MainThreadOnly {
13        #[cfg(all(feature = "UIFindSession", feature = "UIResponder", feature = "UIView"))]
14        /// Called when a find session is requested to begin by the user. Return an instance of a UIFindSession implementation to allow the
15        /// find session to begin, otherwise return nil to prevent the system find panel from appearing.
16        #[unsafe(method(findInteraction:sessionForView:))]
17        #[unsafe(method_family = none)]
18        unsafe fn findInteraction_sessionForView(
19            &self,
20            interaction: &UIFindInteraction,
21            view: &UIView,
22        ) -> Option<Retained<UIFindSession>>;
23
24        #[cfg(feature = "UIFindSession")]
25        /// Called when the search operation begins (and the system search UI appears).
26        /// This would be a good time to decorate your view to indicate that a search operation is about to occur.
27        /// System text elements will apply a dimming view around all non-highlighted search results, for instance.
28        #[optional]
29        #[unsafe(method(findInteraction:didBeginFindSession:))]
30        #[unsafe(method_family = none)]
31        unsafe fn findInteraction_didBeginFindSession(
32            &self,
33            interaction: &UIFindInteraction,
34            session: &UIFindSession,
35        );
36
37        #[cfg(feature = "UIFindSession")]
38        /// Called when the current search session has changed or ended. This would be a good time to remove all
39        /// decorations applied to found search results, and any decorations added when the search operation began
40        /// (such as a dimming view).
41        #[optional]
42        #[unsafe(method(findInteraction:didEndFindSession:))]
43        #[unsafe(method_family = none)]
44        unsafe fn findInteraction_didEndFindSession(
45            &self,
46            interaction: &UIFindInteraction,
47            session: &UIFindSession,
48        );
49    }
50);
51
52extern_class!(
53    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uifindinteraction?language=objc)
54    #[unsafe(super(NSObject))]
55    #[thread_kind = MainThreadOnly]
56    #[derive(Debug, PartialEq, Eq, Hash)]
57    pub struct UIFindInteraction;
58);
59
60extern_conformance!(
61    unsafe impl NSObjectProtocol for UIFindInteraction {}
62);
63
64#[cfg(feature = "UIInteraction")]
65extern_conformance!(
66    unsafe impl UIInteraction for UIFindInteraction {}
67);
68
69impl UIFindInteraction {
70    extern_methods!(
71        /// Returns YES if the find navigator panel is currently visible.
72        #[unsafe(method(isFindNavigatorVisible))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn isFindNavigatorVisible(&self) -> bool;
75
76        #[cfg(feature = "UIFindSession")]
77        /// If there's a currently active find session (implying isFindNavigatorVisible is true), returns the active find session.
78        #[unsafe(method(activeFindSession))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn activeFindSession(&self) -> Option<Retained<UIFindSession>>;
81
82        /// Assign this property to pre-populate the system find panel's search text field with a search query.
83        #[unsafe(method(searchText))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn searchText(&self) -> Option<Retained<NSString>>;
86
87        /// Setter for [`searchText`][Self::searchText].
88        #[unsafe(method(setSearchText:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setSearchText(&self, search_text: Option<&NSString>);
91
92        /// If replacement is supported, assign this property to pre-populate the system find panel's replace text field with a replacement string.
93        #[unsafe(method(replacementText))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn replacementText(&self) -> Option<Retained<NSString>>;
96
97        /// Setter for [`replacementText`][Self::replacementText].
98        #[unsafe(method(setReplacementText:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn setReplacementText(&self, replacement_text: Option<&NSString>);
101
102        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
103        /// This provider is consulted when the search options menu is being populated. A default set of search options is provided, representing the options
104        /// available in
105        /// `UITextSearchOptions,`which can be either modified, augmented, or omitted.
106        #[unsafe(method(optionsMenuProvider))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn optionsMenuProvider(
109            &self,
110        ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>;
111
112        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
113        /// Setter for [`optionsMenuProvider`][Self::optionsMenuProvider].
114        #[unsafe(method(setOptionsMenuProvider:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn setOptionsMenuProvider(
117            &self,
118            options_menu_provider: Option<
119                &block2::DynBlock<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>,
120            >,
121        );
122
123        /// See UIFindInteractionDelegate above.
124        #[unsafe(method(delegate))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn delegate(
127            &self,
128        ) -> Option<Retained<ProtocolObject<dyn UIFindInteractionDelegate>>>;
129
130        /// Creates a find interaction object with the specified delegate.
131        #[unsafe(method(initWithSessionDelegate:))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn initWithSessionDelegate(
134            this: Allocated<Self>,
135            session_delegate: &ProtocolObject<dyn UIFindInteractionDelegate>,
136        ) -> Retained<Self>;
137
138        /// Shows the find navigator panel, if not already visible.
139        ///
140        ///
141        /// Parameter `replaceVisible`: If the delegate supports text replacement, will make the replace text field
142        /// visible on first appearance.
143        #[unsafe(method(presentFindNavigatorShowingReplace:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn presentFindNavigatorShowingReplace(&self, showing_replace: bool);
146
147        /// Dismisses the find navigator panel.
148        #[unsafe(method(dismissFindNavigator))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn dismissFindNavigator(&self);
151
152        /// Jump to the next found result in the document, relative to the currently highlighted result.
153        #[unsafe(method(findNext))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn findNext(&self);
156
157        /// Jump to the previous found result in the document, relative to the currently highlighted result.
158        #[unsafe(method(findPrevious))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn findPrevious(&self);
161
162        /// Calling this triggers an update of the UI to reflect changes to the currently shown result count or result index, as defined by UIFindSession.
163        #[unsafe(method(updateResultCount))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn updateResultCount(&self);
166
167        #[unsafe(method(new))]
168        #[unsafe(method_family = new)]
169        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
170
171        #[unsafe(method(init))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
174    );
175}