objc2_app_kit/generated/
NSSearchField.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
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchfieldrecentsautosavename?language=objc)
11pub type NSSearchFieldRecentsAutosaveName = NSString;
12
13extern_protocol!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchfielddelegate?language=objc)
15    #[cfg(all(feature = "NSControl", feature = "NSTextField"))]
16    pub unsafe trait NSSearchFieldDelegate: NSTextFieldDelegate + MainThreadOnly {
17        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
18        #[optional]
19        #[unsafe(method(searchFieldDidStartSearching:))]
20        #[unsafe(method_family = none)]
21        unsafe fn searchFieldDidStartSearching(&self, sender: &NSSearchField);
22
23        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
24        #[optional]
25        #[unsafe(method(searchFieldDidEndSearching:))]
26        #[unsafe(method_family = none)]
27        unsafe fn searchFieldDidEndSearching(&self, sender: &NSSearchField);
28    }
29);
30
31extern_class!(
32    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchfield?language=objc)
33    #[unsafe(super(NSTextField, NSControl, NSView, NSResponder, NSObject))]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    #[cfg(all(
36        feature = "NSControl",
37        feature = "NSResponder",
38        feature = "NSTextField",
39        feature = "NSView"
40    ))]
41    pub struct NSSearchField;
42);
43
44#[cfg(all(
45    feature = "NSAccessibilityProtocols",
46    feature = "NSControl",
47    feature = "NSResponder",
48    feature = "NSTextField",
49    feature = "NSView"
50))]
51extern_conformance!(
52    unsafe impl NSAccessibility for NSSearchField {}
53);
54
55#[cfg(all(
56    feature = "NSAccessibilityProtocols",
57    feature = "NSControl",
58    feature = "NSResponder",
59    feature = "NSTextField",
60    feature = "NSView"
61))]
62extern_conformance!(
63    unsafe impl NSAccessibilityElementProtocol for NSSearchField {}
64);
65
66#[cfg(all(
67    feature = "NSAccessibilityProtocols",
68    feature = "NSControl",
69    feature = "NSResponder",
70    feature = "NSTextField",
71    feature = "NSView"
72))]
73extern_conformance!(
74    unsafe impl NSAccessibilityNavigableStaticText for NSSearchField {}
75);
76
77#[cfg(all(
78    feature = "NSAccessibilityProtocols",
79    feature = "NSControl",
80    feature = "NSResponder",
81    feature = "NSTextField",
82    feature = "NSView"
83))]
84extern_conformance!(
85    unsafe impl NSAccessibilityStaticText for NSSearchField {}
86);
87
88#[cfg(all(
89    feature = "NSAnimation",
90    feature = "NSControl",
91    feature = "NSResponder",
92    feature = "NSTextField",
93    feature = "NSView"
94))]
95extern_conformance!(
96    unsafe impl NSAnimatablePropertyContainer for NSSearchField {}
97);
98
99#[cfg(all(
100    feature = "NSAppearance",
101    feature = "NSControl",
102    feature = "NSResponder",
103    feature = "NSTextField",
104    feature = "NSView"
105))]
106extern_conformance!(
107    unsafe impl NSAppearanceCustomization for NSSearchField {}
108);
109
110#[cfg(all(
111    feature = "NSControl",
112    feature = "NSResponder",
113    feature = "NSTextField",
114    feature = "NSView"
115))]
116extern_conformance!(
117    unsafe impl NSCoding for NSSearchField {}
118);
119
120#[cfg(all(
121    feature = "NSControl",
122    feature = "NSDragging",
123    feature = "NSResponder",
124    feature = "NSTextField",
125    feature = "NSView"
126))]
127extern_conformance!(
128    unsafe impl NSDraggingDestination for NSSearchField {}
129);
130
131#[cfg(all(
132    feature = "NSControl",
133    feature = "NSResponder",
134    feature = "NSTextField",
135    feature = "NSView"
136))]
137extern_conformance!(
138    unsafe impl NSObjectProtocol for NSSearchField {}
139);
140
141#[cfg(all(
142    feature = "NSControl",
143    feature = "NSResponder",
144    feature = "NSTextContent",
145    feature = "NSTextField",
146    feature = "NSView"
147))]
148extern_conformance!(
149    unsafe impl NSTextContent for NSSearchField {}
150);
151
152#[cfg(all(
153    feature = "NSControl",
154    feature = "NSResponder",
155    feature = "NSTextField",
156    feature = "NSUserInterfaceItemIdentification",
157    feature = "NSView"
158))]
159extern_conformance!(
160    unsafe impl NSUserInterfaceItemIdentification for NSSearchField {}
161);
162
163#[cfg(all(
164    feature = "NSControl",
165    feature = "NSResponder",
166    feature = "NSTextField",
167    feature = "NSUserInterfaceValidation",
168    feature = "NSView"
169))]
170extern_conformance!(
171    unsafe impl NSUserInterfaceValidations for NSSearchField {}
172);
173
174#[cfg(all(
175    feature = "NSControl",
176    feature = "NSResponder",
177    feature = "NSTextField",
178    feature = "NSView"
179))]
180impl NSSearchField {
181    extern_methods!(
182        #[unsafe(method(searchTextBounds))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn searchTextBounds(&self) -> NSRect;
185
186        #[unsafe(method(searchButtonBounds))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn searchButtonBounds(&self) -> NSRect;
189
190        #[unsafe(method(cancelButtonBounds))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn cancelButtonBounds(&self) -> NSRect;
193
194        #[unsafe(method(recentSearches))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn recentSearches(&self) -> Retained<NSArray<NSString>>;
197
198        /// Setter for [`recentSearches`][Self::recentSearches].
199        #[unsafe(method(setRecentSearches:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setRecentSearches(&self, recent_searches: &NSArray<NSString>);
202
203        #[unsafe(method(recentsAutosaveName))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn recentsAutosaveName(
206            &self,
207        ) -> Option<Retained<NSSearchFieldRecentsAutosaveName>>;
208
209        /// Setter for [`recentsAutosaveName`][Self::recentsAutosaveName].
210        #[unsafe(method(setRecentsAutosaveName:))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn setRecentsAutosaveName(
213            &self,
214            recents_autosave_name: Option<&NSSearchFieldRecentsAutosaveName>,
215        );
216
217        #[cfg(feature = "NSMenu")]
218        #[unsafe(method(searchMenuTemplate))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn searchMenuTemplate(&self) -> Option<Retained<NSMenu>>;
221
222        #[cfg(feature = "NSMenu")]
223        /// Setter for [`searchMenuTemplate`][Self::searchMenuTemplate].
224        #[unsafe(method(setSearchMenuTemplate:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn setSearchMenuTemplate(&self, search_menu_template: Option<&NSMenu>);
227
228        #[unsafe(method(sendsWholeSearchString))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn sendsWholeSearchString(&self) -> bool;
231
232        /// Setter for [`sendsWholeSearchString`][Self::sendsWholeSearchString].
233        #[unsafe(method(setSendsWholeSearchString:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn setSendsWholeSearchString(&self, sends_whole_search_string: bool);
236
237        #[unsafe(method(maximumRecents))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn maximumRecents(&self) -> NSInteger;
240
241        /// Setter for [`maximumRecents`][Self::maximumRecents].
242        #[unsafe(method(setMaximumRecents:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setMaximumRecents(&self, maximum_recents: NSInteger);
245
246        #[unsafe(method(sendsSearchStringImmediately))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn sendsSearchStringImmediately(&self) -> bool;
249
250        /// Setter for [`sendsSearchStringImmediately`][Self::sendsSearchStringImmediately].
251        #[unsafe(method(setSendsSearchStringImmediately:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn setSendsSearchStringImmediately(&self, sends_search_string_immediately: bool);
254
255        #[unsafe(method(delegate))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn delegate(
258            &self,
259        ) -> Option<Retained<ProtocolObject<dyn NSSearchFieldDelegate>>>;
260
261        /// This is a [weak property][objc2::topics::weak_property].
262        /// Setter for [`delegate`][Self::delegate].
263        #[unsafe(method(setDelegate:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn setDelegate(
266            &self,
267            delegate: Option<&ProtocolObject<dyn NSSearchFieldDelegate>>,
268        );
269    );
270}
271
272/// Methods declared on superclass `NSControl`.
273#[cfg(all(
274    feature = "NSControl",
275    feature = "NSResponder",
276    feature = "NSTextField",
277    feature = "NSView"
278))]
279impl NSSearchField {
280    extern_methods!(
281        #[unsafe(method(initWithFrame:))]
282        #[unsafe(method_family = init)]
283        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
284
285        #[unsafe(method(initWithCoder:))]
286        #[unsafe(method_family = init)]
287        pub unsafe fn initWithCoder(
288            this: Allocated<Self>,
289            coder: &NSCoder,
290        ) -> Option<Retained<Self>>;
291    );
292}
293
294/// Methods declared on superclass `NSResponder`.
295#[cfg(all(
296    feature = "NSControl",
297    feature = "NSResponder",
298    feature = "NSTextField",
299    feature = "NSView"
300))]
301impl NSSearchField {
302    extern_methods!(
303        #[unsafe(method(init))]
304        #[unsafe(method_family = init)]
305        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
306    );
307}
308
309/// Methods declared on superclass `NSObject`.
310#[cfg(all(
311    feature = "NSControl",
312    feature = "NSResponder",
313    feature = "NSTextField",
314    feature = "NSView"
315))]
316impl NSSearchField {
317    extern_methods!(
318        #[unsafe(method(new))]
319        #[unsafe(method_family = new)]
320        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
321    );
322}
323
324/// NSSearchField_Deprecated.
325#[cfg(all(
326    feature = "NSControl",
327    feature = "NSResponder",
328    feature = "NSTextField",
329    feature = "NSView"
330))]
331impl NSSearchField {
332    extern_methods!(
333        #[deprecated]
334        #[unsafe(method(rectForSearchTextWhenCentered:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn rectForSearchTextWhenCentered(&self, is_centered: bool) -> NSRect;
337
338        #[deprecated]
339        #[unsafe(method(rectForSearchButtonWhenCentered:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn rectForSearchButtonWhenCentered(&self, is_centered: bool) -> NSRect;
342
343        #[deprecated]
344        #[unsafe(method(rectForCancelButtonWhenCentered:))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn rectForCancelButtonWhenCentered(&self, is_centered: bool) -> NSRect;
347
348        #[deprecated = "The placeholder centering UI design is no longer available. Setting this property is no-op."]
349        #[unsafe(method(centersPlaceholder))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn centersPlaceholder(&self) -> bool;
352
353        /// Setter for [`centersPlaceholder`][Self::centersPlaceholder].
354        #[deprecated = "The placeholder centering UI design is no longer available. Setting this property is no-op."]
355        #[unsafe(method(setCentersPlaceholder:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn setCentersPlaceholder(&self, centers_placeholder: bool);
358    );
359}