objc2_ui_kit/generated/
UISearchBar.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#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbaricon?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UISearchBarIcon(pub NSInteger);
20impl UISearchBarIcon {
21    #[doc(alias = "UISearchBarIconSearch")]
22    pub const Search: Self = Self(0);
23    #[doc(alias = "UISearchBarIconClear")]
24    pub const Clear: Self = Self(1);
25    #[doc(alias = "UISearchBarIconBookmark")]
26    pub const Bookmark: Self = Self(2);
27    #[doc(alias = "UISearchBarIconResultsList")]
28    pub const ResultsList: Self = Self(3);
29}
30
31unsafe impl Encode for UISearchBarIcon {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for UISearchBarIcon {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbarstyle?language=objc)
40// NS_ENUM
41#[repr(transparent)]
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
43pub struct UISearchBarStyle(pub NSUInteger);
44impl UISearchBarStyle {
45    #[doc(alias = "UISearchBarStyleDefault")]
46    pub const Default: Self = Self(0);
47    #[doc(alias = "UISearchBarStyleProminent")]
48    pub const Prominent: Self = Self(1);
49    #[doc(alias = "UISearchBarStyleMinimal")]
50    pub const Minimal: Self = Self(2);
51}
52
53unsafe impl Encode for UISearchBarStyle {
54    const ENCODING: Encoding = NSUInteger::ENCODING;
55}
56
57unsafe impl RefEncode for UISearchBarStyle {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61extern_protocol!(
62    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilooktodictatecapable?language=objc)
63    pub unsafe trait UILookToDictateCapable: NSObjectProtocol {
64        /// Enable or disable 'Look To Dictate' on the receiver.
65        #[unsafe(method(isLookToDictateEnabled))]
66        #[unsafe(method_family = none)]
67        fn isLookToDictateEnabled(&self) -> bool;
68
69        /// Setter for [`isLookToDictateEnabled`][Self::isLookToDictateEnabled].
70        #[unsafe(method(setLookToDictateEnabled:))]
71        #[unsafe(method_family = none)]
72        fn setLookToDictateEnabled(&self, look_to_dictate_enabled: bool);
73    }
74);
75
76extern_class!(
77    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbar?language=objc)
78    #[unsafe(super(UIView, UIResponder, NSObject))]
79    #[thread_kind = MainThreadOnly]
80    #[derive(Debug, PartialEq, Eq, Hash)]
81    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
82    pub struct UISearchBar;
83);
84
85#[cfg(all(
86    feature = "UIResponder",
87    feature = "UIView",
88    feature = "objc2-quartz-core"
89))]
90#[cfg(not(target_os = "watchos"))]
91extern_conformance!(
92    unsafe impl CALayerDelegate for UISearchBar {}
93);
94
95#[cfg(all(feature = "UIResponder", feature = "UIView"))]
96extern_conformance!(
97    unsafe impl NSCoding for UISearchBar {}
98);
99
100#[cfg(all(feature = "UIResponder", feature = "UIView"))]
101extern_conformance!(
102    unsafe impl NSObjectProtocol for UISearchBar {}
103);
104
105#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
106extern_conformance!(
107    unsafe impl UIAppearance for UISearchBar {}
108);
109
110#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
111extern_conformance!(
112    unsafe impl UIAppearanceContainer for UISearchBar {}
113);
114
115#[cfg(all(feature = "UIBarCommon", feature = "UIResponder", feature = "UIView"))]
116extern_conformance!(
117    unsafe impl UIBarPositioning for UISearchBar {}
118);
119
120#[cfg(all(feature = "UIResponder", feature = "UIView"))]
121extern_conformance!(
122    unsafe impl UICoordinateSpace for UISearchBar {}
123);
124
125#[cfg(all(
126    feature = "UIDynamicBehavior",
127    feature = "UIResponder",
128    feature = "UIView"
129))]
130extern_conformance!(
131    unsafe impl UIDynamicItem for UISearchBar {}
132);
133
134#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
135extern_conformance!(
136    unsafe impl UIFocusEnvironment for UISearchBar {}
137);
138
139#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
140extern_conformance!(
141    unsafe impl UIFocusItem for UISearchBar {}
142);
143
144#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
145extern_conformance!(
146    unsafe impl UIFocusItemContainer for UISearchBar {}
147);
148
149#[cfg(all(feature = "UIResponder", feature = "UIView"))]
150extern_conformance!(
151    unsafe impl UILookToDictateCapable for UISearchBar {}
152);
153
154#[cfg(all(feature = "UIResponder", feature = "UIView"))]
155extern_conformance!(
156    unsafe impl UIResponderStandardEditActions for UISearchBar {}
157);
158
159#[cfg(all(
160    feature = "UIResponder",
161    feature = "UITextInputTraits",
162    feature = "UIView"
163))]
164extern_conformance!(
165    unsafe impl UITextInputTraits for UISearchBar {}
166);
167
168#[cfg(all(
169    feature = "UIResponder",
170    feature = "UITraitCollection",
171    feature = "UIView"
172))]
173extern_conformance!(
174    unsafe impl UITraitEnvironment for UISearchBar {}
175);
176
177#[cfg(all(feature = "UIResponder", feature = "UIView"))]
178impl UISearchBar {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub fn init(this: Allocated<Self>) -> Retained<Self>;
183
184        #[cfg(feature = "objc2-core-foundation")]
185        #[unsafe(method(initWithFrame:))]
186        #[unsafe(method_family = init)]
187        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
188
189        /// # Safety
190        ///
191        /// `coder` possibly has further requirements.
192        #[unsafe(method(initWithCoder:))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn initWithCoder(
195            this: Allocated<Self>,
196            coder: &NSCoder,
197        ) -> Option<Retained<Self>>;
198
199        #[cfg(feature = "UIInterface")]
200        #[unsafe(method(barStyle))]
201        #[unsafe(method_family = none)]
202        pub fn barStyle(&self) -> UIBarStyle;
203
204        #[cfg(feature = "UIInterface")]
205        /// Setter for [`barStyle`][Self::barStyle].
206        #[unsafe(method(setBarStyle:))]
207        #[unsafe(method_family = none)]
208        pub fn setBarStyle(&self, bar_style: UIBarStyle);
209
210        #[cfg(feature = "UIBarCommon")]
211        #[unsafe(method(delegate))]
212        #[unsafe(method_family = none)]
213        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UISearchBarDelegate>>>;
214
215        #[cfg(feature = "UIBarCommon")]
216        /// Setter for [`delegate`][Self::delegate].
217        ///
218        /// This is a [weak property][objc2::topics::weak_property].
219        #[unsafe(method(setDelegate:))]
220        #[unsafe(method_family = none)]
221        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UISearchBarDelegate>>);
222
223        #[unsafe(method(text))]
224        #[unsafe(method_family = none)]
225        pub fn text(&self) -> Option<Retained<NSString>>;
226
227        /// Setter for [`text`][Self::text].
228        ///
229        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
230        #[unsafe(method(setText:))]
231        #[unsafe(method_family = none)]
232        pub fn setText(&self, text: Option<&NSString>);
233
234        #[unsafe(method(prompt))]
235        #[unsafe(method_family = none)]
236        pub fn prompt(&self) -> Option<Retained<NSString>>;
237
238        /// Setter for [`prompt`][Self::prompt].
239        ///
240        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
241        #[unsafe(method(setPrompt:))]
242        #[unsafe(method_family = none)]
243        pub fn setPrompt(&self, prompt: Option<&NSString>);
244
245        #[unsafe(method(placeholder))]
246        #[unsafe(method_family = none)]
247        pub fn placeholder(&self) -> Option<Retained<NSString>>;
248
249        /// Setter for [`placeholder`][Self::placeholder].
250        ///
251        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
252        #[unsafe(method(setPlaceholder:))]
253        #[unsafe(method_family = none)]
254        pub fn setPlaceholder(&self, placeholder: Option<&NSString>);
255
256        #[unsafe(method(showsBookmarkButton))]
257        #[unsafe(method_family = none)]
258        pub fn showsBookmarkButton(&self) -> bool;
259
260        /// Setter for [`showsBookmarkButton`][Self::showsBookmarkButton].
261        #[unsafe(method(setShowsBookmarkButton:))]
262        #[unsafe(method_family = none)]
263        pub fn setShowsBookmarkButton(&self, shows_bookmark_button: bool);
264
265        #[cfg(all(
266            feature = "UIControl",
267            feature = "UISearchTextField",
268            feature = "UITextField"
269        ))]
270        #[unsafe(method(searchTextField))]
271        #[unsafe(method_family = none)]
272        pub fn searchTextField(&self) -> Retained<UISearchTextField>;
273
274        #[unsafe(method(showsCancelButton))]
275        #[unsafe(method_family = none)]
276        pub fn showsCancelButton(&self) -> bool;
277
278        /// Setter for [`showsCancelButton`][Self::showsCancelButton].
279        #[unsafe(method(setShowsCancelButton:))]
280        #[unsafe(method_family = none)]
281        pub fn setShowsCancelButton(&self, shows_cancel_button: bool);
282
283        #[unsafe(method(showsSearchResultsButton))]
284        #[unsafe(method_family = none)]
285        pub fn showsSearchResultsButton(&self) -> bool;
286
287        /// Setter for [`showsSearchResultsButton`][Self::showsSearchResultsButton].
288        #[unsafe(method(setShowsSearchResultsButton:))]
289        #[unsafe(method_family = none)]
290        pub fn setShowsSearchResultsButton(&self, shows_search_results_button: bool);
291
292        #[unsafe(method(isSearchResultsButtonSelected))]
293        #[unsafe(method_family = none)]
294        pub fn isSearchResultsButtonSelected(&self) -> bool;
295
296        /// Setter for [`isSearchResultsButtonSelected`][Self::isSearchResultsButtonSelected].
297        #[unsafe(method(setSearchResultsButtonSelected:))]
298        #[unsafe(method_family = none)]
299        pub fn setSearchResultsButtonSelected(&self, search_results_button_selected: bool);
300
301        #[unsafe(method(setShowsCancelButton:animated:))]
302        #[unsafe(method_family = none)]
303        pub fn setShowsCancelButton_animated(&self, shows_cancel_button: bool, animated: bool);
304
305        #[cfg(feature = "UITextInput")]
306        /// Use this method to modify the contents of the Unified Content Bar, shown on top of the keyboard when search is engaged.
307        /// You may modify the returned inputAssistantItem to add to or replace the existing items on the bar.
308        /// Modifications made to the returned UITextInputAssistantItem are reflected automatically.
309        #[unsafe(method(inputAssistantItem))]
310        #[unsafe(method_family = none)]
311        pub fn inputAssistantItem(&self) -> Retained<UITextInputAssistantItem>;
312
313        #[cfg(feature = "UIColor")]
314        #[unsafe(method(tintColor))]
315        #[unsafe(method_family = none)]
316        pub fn tintColor(&self) -> Option<Retained<UIColor>>;
317
318        #[cfg(feature = "UIColor")]
319        /// Setter for [`tintColor`][Self::tintColor].
320        ///
321        /// # Safety
322        ///
323        /// `tint_color` might not allow `None`.
324        #[unsafe(method(setTintColor:))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
327
328        #[cfg(feature = "UIColor")]
329        #[unsafe(method(barTintColor))]
330        #[unsafe(method_family = none)]
331        pub fn barTintColor(&self) -> Option<Retained<UIColor>>;
332
333        #[cfg(feature = "UIColor")]
334        /// Setter for [`barTintColor`][Self::barTintColor].
335        #[unsafe(method(setBarTintColor:))]
336        #[unsafe(method_family = none)]
337        pub fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
338
339        #[unsafe(method(searchBarStyle))]
340        #[unsafe(method_family = none)]
341        pub fn searchBarStyle(&self) -> UISearchBarStyle;
342
343        /// Setter for [`searchBarStyle`][Self::searchBarStyle].
344        #[unsafe(method(setSearchBarStyle:))]
345        #[unsafe(method_family = none)]
346        pub fn setSearchBarStyle(&self, search_bar_style: UISearchBarStyle);
347
348        #[unsafe(method(isTranslucent))]
349        #[unsafe(method_family = none)]
350        pub fn isTranslucent(&self) -> bool;
351
352        /// Setter for [`isTranslucent`][Self::isTranslucent].
353        #[unsafe(method(setTranslucent:))]
354        #[unsafe(method_family = none)]
355        pub fn setTranslucent(&self, translucent: bool);
356
357        #[unsafe(method(scopeButtonTitles))]
358        #[unsafe(method_family = none)]
359        pub fn scopeButtonTitles(&self) -> Option<Retained<NSArray<NSString>>>;
360
361        /// Setter for [`scopeButtonTitles`][Self::scopeButtonTitles].
362        ///
363        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
364        #[unsafe(method(setScopeButtonTitles:))]
365        #[unsafe(method_family = none)]
366        pub fn setScopeButtonTitles(&self, scope_button_titles: Option<&NSArray<NSString>>);
367
368        #[unsafe(method(selectedScopeButtonIndex))]
369        #[unsafe(method_family = none)]
370        pub fn selectedScopeButtonIndex(&self) -> NSInteger;
371
372        /// Setter for [`selectedScopeButtonIndex`][Self::selectedScopeButtonIndex].
373        #[unsafe(method(setSelectedScopeButtonIndex:))]
374        #[unsafe(method_family = none)]
375        pub fn setSelectedScopeButtonIndex(&self, selected_scope_button_index: NSInteger);
376
377        #[unsafe(method(showsScopeBar))]
378        #[unsafe(method_family = none)]
379        pub fn showsScopeBar(&self) -> bool;
380
381        /// Setter for [`showsScopeBar`][Self::showsScopeBar].
382        #[unsafe(method(setShowsScopeBar:))]
383        #[unsafe(method_family = none)]
384        pub fn setShowsScopeBar(&self, shows_scope_bar: bool);
385
386        #[unsafe(method(setShowsScopeBar:animated:))]
387        #[unsafe(method_family = none)]
388        pub fn setShowsScopeBar_animated(&self, show: bool, animate: bool);
389
390        #[unsafe(method(inputAccessoryView))]
391        #[unsafe(method_family = none)]
392        pub fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
393
394        /// Setter for [`inputAccessoryView`][Self::inputAccessoryView].
395        #[unsafe(method(setInputAccessoryView:))]
396        #[unsafe(method_family = none)]
397        pub fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
398
399        /// When set to false, user interaction will be prevented and the search bar will take on a disabled appearance
400        /// If the search bar is associated with a UINavigationItem with `UINavigationItemSearchBarPlacementIntegrated`,
401        /// then the minimized (icon-only) UISearchBar will not grow to the text field while `enabled` is false.
402        #[unsafe(method(isEnabled))]
403        #[unsafe(method_family = none)]
404        pub fn isEnabled(&self) -> bool;
405
406        /// Setter for [`isEnabled`][Self::isEnabled].
407        #[unsafe(method(setEnabled:))]
408        #[unsafe(method_family = none)]
409        pub fn setEnabled(&self, enabled: bool);
410
411        #[cfg(feature = "UIImage")]
412        #[unsafe(method(backgroundImage))]
413        #[unsafe(method_family = none)]
414        pub fn backgroundImage(&self) -> Option<Retained<UIImage>>;
415
416        #[cfg(feature = "UIImage")]
417        /// Setter for [`backgroundImage`][Self::backgroundImage].
418        #[unsafe(method(setBackgroundImage:))]
419        #[unsafe(method_family = none)]
420        pub fn setBackgroundImage(&self, background_image: Option<&UIImage>);
421
422        #[cfg(feature = "UIImage")]
423        #[unsafe(method(scopeBarBackgroundImage))]
424        #[unsafe(method_family = none)]
425        pub fn scopeBarBackgroundImage(&self) -> Option<Retained<UIImage>>;
426
427        #[cfg(feature = "UIImage")]
428        /// Setter for [`scopeBarBackgroundImage`][Self::scopeBarBackgroundImage].
429        #[unsafe(method(setScopeBarBackgroundImage:))]
430        #[unsafe(method_family = none)]
431        pub fn setScopeBarBackgroundImage(&self, scope_bar_background_image: Option<&UIImage>);
432
433        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
434        #[unsafe(method(setBackgroundImage:forBarPosition:barMetrics:))]
435        #[unsafe(method_family = none)]
436        pub fn setBackgroundImage_forBarPosition_barMetrics(
437            &self,
438            background_image: Option<&UIImage>,
439            bar_position: UIBarPosition,
440            bar_metrics: UIBarMetrics,
441        );
442
443        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
444        #[unsafe(method(backgroundImageForBarPosition:barMetrics:))]
445        #[unsafe(method_family = none)]
446        pub fn backgroundImageForBarPosition_barMetrics(
447            &self,
448            bar_position: UIBarPosition,
449            bar_metrics: UIBarMetrics,
450        ) -> Option<Retained<UIImage>>;
451
452        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
453        #[unsafe(method(setSearchFieldBackgroundImage:forState:))]
454        #[unsafe(method_family = none)]
455        pub fn setSearchFieldBackgroundImage_forState(
456            &self,
457            background_image: Option<&UIImage>,
458            state: UIControlState,
459        );
460
461        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
462        #[unsafe(method(searchFieldBackgroundImageForState:))]
463        #[unsafe(method_family = none)]
464        pub fn searchFieldBackgroundImageForState(
465            &self,
466            state: UIControlState,
467        ) -> Option<Retained<UIImage>>;
468
469        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
470        #[unsafe(method(setImage:forSearchBarIcon:state:))]
471        #[unsafe(method_family = none)]
472        pub fn setImage_forSearchBarIcon_state(
473            &self,
474            icon_image: Option<&UIImage>,
475            icon: UISearchBarIcon,
476            state: UIControlState,
477        );
478
479        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
480        #[unsafe(method(imageForSearchBarIcon:state:))]
481        #[unsafe(method_family = none)]
482        pub fn imageForSearchBarIcon_state(
483            &self,
484            icon: UISearchBarIcon,
485            state: UIControlState,
486        ) -> Option<Retained<UIImage>>;
487
488        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
489        #[unsafe(method(setScopeBarButtonBackgroundImage:forState:))]
490        #[unsafe(method_family = none)]
491        pub fn setScopeBarButtonBackgroundImage_forState(
492            &self,
493            background_image: Option<&UIImage>,
494            state: UIControlState,
495        );
496
497        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
498        #[unsafe(method(scopeBarButtonBackgroundImageForState:))]
499        #[unsafe(method_family = none)]
500        pub fn scopeBarButtonBackgroundImageForState(
501            &self,
502            state: UIControlState,
503        ) -> Option<Retained<UIImage>>;
504
505        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
506        #[unsafe(method(setScopeBarButtonDividerImage:forLeftSegmentState:rightSegmentState:))]
507        #[unsafe(method_family = none)]
508        pub fn setScopeBarButtonDividerImage_forLeftSegmentState_rightSegmentState(
509            &self,
510            divider_image: Option<&UIImage>,
511            left_state: UIControlState,
512            right_state: UIControlState,
513        );
514
515        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
516        #[unsafe(method(scopeBarButtonDividerImageForLeftSegmentState:rightSegmentState:))]
517        #[unsafe(method_family = none)]
518        pub fn scopeBarButtonDividerImageForLeftSegmentState_rightSegmentState(
519            &self,
520            left_state: UIControlState,
521            right_state: UIControlState,
522        ) -> Option<Retained<UIImage>>;
523
524        #[cfg(feature = "UIControl")]
525        /// # Safety
526        ///
527        /// `attributes` generic should be of the correct type.
528        #[unsafe(method(setScopeBarButtonTitleTextAttributes:forState:))]
529        #[unsafe(method_family = none)]
530        pub unsafe fn setScopeBarButtonTitleTextAttributes_forState(
531            &self,
532            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
533            state: UIControlState,
534        );
535
536        #[cfg(feature = "UIControl")]
537        #[unsafe(method(scopeBarButtonTitleTextAttributesForState:))]
538        #[unsafe(method_family = none)]
539        pub fn scopeBarButtonTitleTextAttributesForState(
540            &self,
541            state: UIControlState,
542        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
543
544        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
545        #[unsafe(method(searchFieldBackgroundPositionAdjustment))]
546        #[unsafe(method_family = none)]
547        pub fn searchFieldBackgroundPositionAdjustment(&self) -> UIOffset;
548
549        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
550        /// Setter for [`searchFieldBackgroundPositionAdjustment`][Self::searchFieldBackgroundPositionAdjustment].
551        #[unsafe(method(setSearchFieldBackgroundPositionAdjustment:))]
552        #[unsafe(method_family = none)]
553        pub fn setSearchFieldBackgroundPositionAdjustment(
554            &self,
555            search_field_background_position_adjustment: UIOffset,
556        );
557
558        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
559        #[unsafe(method(searchTextPositionAdjustment))]
560        #[unsafe(method_family = none)]
561        pub fn searchTextPositionAdjustment(&self) -> UIOffset;
562
563        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
564        /// Setter for [`searchTextPositionAdjustment`][Self::searchTextPositionAdjustment].
565        #[unsafe(method(setSearchTextPositionAdjustment:))]
566        #[unsafe(method_family = none)]
567        pub fn setSearchTextPositionAdjustment(&self, search_text_position_adjustment: UIOffset);
568
569        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
570        #[unsafe(method(setPositionAdjustment:forSearchBarIcon:))]
571        #[unsafe(method_family = none)]
572        pub fn setPositionAdjustment_forSearchBarIcon(
573            &self,
574            adjustment: UIOffset,
575            icon: UISearchBarIcon,
576        );
577
578        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
579        #[unsafe(method(positionAdjustmentForSearchBarIcon:))]
580        #[unsafe(method_family = none)]
581        pub fn positionAdjustmentForSearchBarIcon(&self, icon: UISearchBarIcon) -> UIOffset;
582
583        #[unsafe(method(isLookToDictateEnabled))]
584        #[unsafe(method_family = none)]
585        pub fn isLookToDictateEnabled(&self) -> bool;
586
587        /// Setter for [`isLookToDictateEnabled`][Self::isLookToDictateEnabled].
588        #[unsafe(method(setLookToDictateEnabled:))]
589        #[unsafe(method_family = none)]
590        pub fn setLookToDictateEnabled(&self, look_to_dictate_enabled: bool);
591    );
592}
593
594/// Methods declared on superclass `NSObject`.
595#[cfg(all(feature = "UIResponder", feature = "UIView"))]
596impl UISearchBar {
597    extern_methods!(
598        #[unsafe(method(new))]
599        #[unsafe(method_family = new)]
600        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
601    );
602}
603
604extern_protocol!(
605    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbardelegate?language=objc)
606    #[cfg(feature = "UIBarCommon")]
607    pub unsafe trait UISearchBarDelegate: UIBarPositioningDelegate + MainThreadOnly {
608        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
609        #[optional]
610        #[unsafe(method(searchBarShouldBeginEditing:))]
611        #[unsafe(method_family = none)]
612        fn searchBarShouldBeginEditing(&self, search_bar: &UISearchBar) -> bool;
613
614        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
615        #[optional]
616        #[unsafe(method(searchBarTextDidBeginEditing:))]
617        #[unsafe(method_family = none)]
618        fn searchBarTextDidBeginEditing(&self, search_bar: &UISearchBar);
619
620        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
621        #[optional]
622        #[unsafe(method(searchBarShouldEndEditing:))]
623        #[unsafe(method_family = none)]
624        fn searchBarShouldEndEditing(&self, search_bar: &UISearchBar) -> bool;
625
626        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
627        #[optional]
628        #[unsafe(method(searchBarTextDidEndEditing:))]
629        #[unsafe(method_family = none)]
630        fn searchBarTextDidEndEditing(&self, search_bar: &UISearchBar);
631
632        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
633        #[optional]
634        #[unsafe(method(searchBar:textDidChange:))]
635        #[unsafe(method_family = none)]
636        fn searchBar_textDidChange(&self, search_bar: &UISearchBar, search_text: &NSString);
637
638        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
639        #[deprecated]
640        #[optional]
641        #[unsafe(method(searchBar:shouldChangeTextInRange:replacementText:))]
642        #[unsafe(method_family = none)]
643        fn searchBar_shouldChangeTextInRange_replacementText(
644            &self,
645            search_bar: &UISearchBar,
646            range: NSRange,
647            text: &NSString,
648        ) -> bool;
649
650        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
651        /// Asks the delegate if the text at the specified `ranges` should be replaced with `text`.
652        ///
653        ///
654        /// If this method returns YES then the search bar will, at its own discretion, choose any one of the specified `ranges` of text and replace it with the specified `replacementText` before deleting the text at the other ranges. If the delegate does not implement this method then the `searchBar:shouldChangeTextInRange:replacementText:` method will be called and passed the union range instead. If the delegate also does not implement that method then YES is assumed.
655        ///
656        ///
657        /// Parameter `searchBar`: The search bar asking the delegate
658        ///
659        /// Parameter `ranges`: The ranges of the text that should be deleted before replacing
660        ///
661        /// Parameter `replacementText`: The replacement text
662        ///
663        ///
664        /// Returns: Returns true if the text at the `ranges` should be replaced.
665        #[optional]
666        #[unsafe(method(searchBar:shouldChangeTextInRanges:replacementText:))]
667        #[unsafe(method_family = none)]
668        fn searchBar_shouldChangeTextInRanges_replacementText(
669            &self,
670            search_bar: &UISearchBar,
671            ranges: &NSArray<NSValue>,
672            replacement_text: &NSString,
673        ) -> bool;
674
675        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
676        #[optional]
677        #[unsafe(method(searchBarSearchButtonClicked:))]
678        #[unsafe(method_family = none)]
679        fn searchBarSearchButtonClicked(&self, search_bar: &UISearchBar);
680
681        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
682        #[optional]
683        #[unsafe(method(searchBarBookmarkButtonClicked:))]
684        #[unsafe(method_family = none)]
685        fn searchBarBookmarkButtonClicked(&self, search_bar: &UISearchBar);
686
687        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
688        #[optional]
689        #[unsafe(method(searchBarCancelButtonClicked:))]
690        #[unsafe(method_family = none)]
691        fn searchBarCancelButtonClicked(&self, search_bar: &UISearchBar);
692
693        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
694        #[optional]
695        #[unsafe(method(searchBarResultsListButtonClicked:))]
696        #[unsafe(method_family = none)]
697        fn searchBarResultsListButtonClicked(&self, search_bar: &UISearchBar);
698
699        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
700        #[optional]
701        #[unsafe(method(searchBar:selectedScopeButtonIndexDidChange:))]
702        #[unsafe(method_family = none)]
703        fn searchBar_selectedScopeButtonIndexDidChange(
704            &self,
705            search_bar: &UISearchBar,
706            selected_scope: NSInteger,
707        );
708    }
709);