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