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        unsafe fn isLookToDictateEnabled(&self) -> bool;
68
69        /// Setter for [`isLookToDictateEnabled`][Self::isLookToDictateEnabled].
70        #[unsafe(method(setLookToDictateEnabled:))]
71        #[unsafe(method_family = none)]
72        unsafe 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"))]
91unsafe impl CALayerDelegate for UISearchBar {}
92
93#[cfg(all(feature = "UIResponder", feature = "UIView"))]
94unsafe impl NSCoding for UISearchBar {}
95
96#[cfg(all(feature = "UIResponder", feature = "UIView"))]
97unsafe impl NSObjectProtocol for UISearchBar {}
98
99#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
100unsafe impl UIAppearance for UISearchBar {}
101
102#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
103unsafe impl UIAppearanceContainer for UISearchBar {}
104
105#[cfg(all(feature = "UIBarCommon", feature = "UIResponder", feature = "UIView"))]
106unsafe impl UIBarPositioning for UISearchBar {}
107
108#[cfg(all(feature = "UIResponder", feature = "UIView"))]
109unsafe impl UICoordinateSpace for UISearchBar {}
110
111#[cfg(all(
112    feature = "UIDynamicBehavior",
113    feature = "UIResponder",
114    feature = "UIView"
115))]
116unsafe impl UIDynamicItem for UISearchBar {}
117
118#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
119unsafe impl UIFocusEnvironment for UISearchBar {}
120
121#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
122unsafe impl UIFocusItem for UISearchBar {}
123
124#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
125unsafe impl UIFocusItemContainer for UISearchBar {}
126
127#[cfg(all(feature = "UIResponder", feature = "UIView"))]
128unsafe impl UILookToDictateCapable for UISearchBar {}
129
130#[cfg(all(feature = "UIResponder", feature = "UIView"))]
131unsafe impl UIResponderStandardEditActions for UISearchBar {}
132
133#[cfg(all(
134    feature = "UIResponder",
135    feature = "UITextInputTraits",
136    feature = "UIView"
137))]
138unsafe impl UITextInputTraits for UISearchBar {}
139
140#[cfg(all(
141    feature = "UIResponder",
142    feature = "UITraitCollection",
143    feature = "UIView"
144))]
145unsafe impl UITraitEnvironment for UISearchBar {}
146
147#[cfg(all(feature = "UIResponder", feature = "UIView"))]
148impl UISearchBar {
149    extern_methods!(
150        #[unsafe(method(init))]
151        #[unsafe(method_family = init)]
152        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
153
154        #[cfg(feature = "objc2-core-foundation")]
155        #[unsafe(method(initWithFrame:))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
158
159        #[unsafe(method(initWithCoder:))]
160        #[unsafe(method_family = init)]
161        pub unsafe fn initWithCoder(
162            this: Allocated<Self>,
163            coder: &NSCoder,
164        ) -> Option<Retained<Self>>;
165
166        #[cfg(feature = "UIInterface")]
167        #[unsafe(method(barStyle))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn barStyle(&self) -> UIBarStyle;
170
171        #[cfg(feature = "UIInterface")]
172        /// Setter for [`barStyle`][Self::barStyle].
173        #[unsafe(method(setBarStyle:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn setBarStyle(&self, bar_style: UIBarStyle);
176
177        #[cfg(feature = "UIBarCommon")]
178        #[unsafe(method(delegate))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UISearchBarDelegate>>>;
181
182        #[cfg(feature = "UIBarCommon")]
183        /// This is a [weak property][objc2::topics::weak_property].
184        /// Setter for [`delegate`][Self::delegate].
185        #[unsafe(method(setDelegate:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setDelegate(
188            &self,
189            delegate: Option<&ProtocolObject<dyn UISearchBarDelegate>>,
190        );
191
192        #[unsafe(method(text))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn text(&self) -> Option<Retained<NSString>>;
195
196        /// Setter for [`text`][Self::text].
197        #[unsafe(method(setText:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setText(&self, text: Option<&NSString>);
200
201        #[unsafe(method(prompt))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn prompt(&self) -> Option<Retained<NSString>>;
204
205        /// Setter for [`prompt`][Self::prompt].
206        #[unsafe(method(setPrompt:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setPrompt(&self, prompt: Option<&NSString>);
209
210        #[unsafe(method(placeholder))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn placeholder(&self) -> Option<Retained<NSString>>;
213
214        /// Setter for [`placeholder`][Self::placeholder].
215        #[unsafe(method(setPlaceholder:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn setPlaceholder(&self, placeholder: Option<&NSString>);
218
219        #[unsafe(method(showsBookmarkButton))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn showsBookmarkButton(&self) -> bool;
222
223        /// Setter for [`showsBookmarkButton`][Self::showsBookmarkButton].
224        #[unsafe(method(setShowsBookmarkButton:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn setShowsBookmarkButton(&self, shows_bookmark_button: bool);
227
228        #[cfg(all(
229            feature = "UIControl",
230            feature = "UISearchTextField",
231            feature = "UITextField"
232        ))]
233        #[unsafe(method(searchTextField))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn searchTextField(&self) -> Retained<UISearchTextField>;
236
237        #[unsafe(method(showsCancelButton))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn showsCancelButton(&self) -> bool;
240
241        /// Setter for [`showsCancelButton`][Self::showsCancelButton].
242        #[unsafe(method(setShowsCancelButton:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setShowsCancelButton(&self, shows_cancel_button: bool);
245
246        #[unsafe(method(showsSearchResultsButton))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn showsSearchResultsButton(&self) -> bool;
249
250        /// Setter for [`showsSearchResultsButton`][Self::showsSearchResultsButton].
251        #[unsafe(method(setShowsSearchResultsButton:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn setShowsSearchResultsButton(&self, shows_search_results_button: bool);
254
255        #[unsafe(method(isSearchResultsButtonSelected))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn isSearchResultsButtonSelected(&self) -> bool;
258
259        /// Setter for [`isSearchResultsButtonSelected`][Self::isSearchResultsButtonSelected].
260        #[unsafe(method(setSearchResultsButtonSelected:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn setSearchResultsButtonSelected(&self, search_results_button_selected: bool);
263
264        #[unsafe(method(setShowsCancelButton:animated:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn setShowsCancelButton_animated(
267            &self,
268            shows_cancel_button: bool,
269            animated: bool,
270        );
271
272        #[cfg(feature = "UITextInput")]
273        /// Use this method to modify the contents of the Unified Content Bar, shown on top of the keyboard when search is engaged.
274        /// You may modify the returned inputAssistantItem to add to or replace the existing items on the bar.
275        /// Modifications made to the returned UITextInputAssistantItem are reflected automatically.
276        #[unsafe(method(inputAssistantItem))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn inputAssistantItem(&self) -> Retained<UITextInputAssistantItem>;
279
280        #[cfg(feature = "UIColor")]
281        #[unsafe(method(tintColor))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
284
285        #[cfg(feature = "UIColor")]
286        /// Setter for [`tintColor`][Self::tintColor].
287        #[unsafe(method(setTintColor:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
290
291        #[cfg(feature = "UIColor")]
292        #[unsafe(method(barTintColor))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn barTintColor(&self) -> Option<Retained<UIColor>>;
295
296        #[cfg(feature = "UIColor")]
297        /// Setter for [`barTintColor`][Self::barTintColor].
298        #[unsafe(method(setBarTintColor:))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn setBarTintColor(&self, bar_tint_color: Option<&UIColor>);
301
302        #[unsafe(method(searchBarStyle))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn searchBarStyle(&self) -> UISearchBarStyle;
305
306        /// Setter for [`searchBarStyle`][Self::searchBarStyle].
307        #[unsafe(method(setSearchBarStyle:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setSearchBarStyle(&self, search_bar_style: UISearchBarStyle);
310
311        #[unsafe(method(isTranslucent))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn isTranslucent(&self) -> bool;
314
315        /// Setter for [`isTranslucent`][Self::isTranslucent].
316        #[unsafe(method(setTranslucent:))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn setTranslucent(&self, translucent: bool);
319
320        #[unsafe(method(scopeButtonTitles))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn scopeButtonTitles(&self) -> Option<Retained<NSArray<NSString>>>;
323
324        /// Setter for [`scopeButtonTitles`][Self::scopeButtonTitles].
325        #[unsafe(method(setScopeButtonTitles:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn setScopeButtonTitles(&self, scope_button_titles: Option<&NSArray<NSString>>);
328
329        #[unsafe(method(selectedScopeButtonIndex))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn selectedScopeButtonIndex(&self) -> NSInteger;
332
333        /// Setter for [`selectedScopeButtonIndex`][Self::selectedScopeButtonIndex].
334        #[unsafe(method(setSelectedScopeButtonIndex:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn setSelectedScopeButtonIndex(&self, selected_scope_button_index: NSInteger);
337
338        #[unsafe(method(showsScopeBar))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn showsScopeBar(&self) -> bool;
341
342        /// Setter for [`showsScopeBar`][Self::showsScopeBar].
343        #[unsafe(method(setShowsScopeBar:))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn setShowsScopeBar(&self, shows_scope_bar: bool);
346
347        #[unsafe(method(setShowsScopeBar:animated:))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn setShowsScopeBar_animated(&self, show: bool, animate: bool);
350
351        #[unsafe(method(inputAccessoryView))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
354
355        /// Setter for [`inputAccessoryView`][Self::inputAccessoryView].
356        #[unsafe(method(setInputAccessoryView:))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
359
360        /// When set to false, user interaction will be prevented and the search bar will take on a disabled appearance
361        /// If the search bar is associated with a UINavigationItem with `UINavigationItemSearchBarPlacementInline`,
362        /// then the minimized (icon-only) UISearchBar will not grow to the text field while `enabled` is false.
363        #[unsafe(method(isEnabled))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn isEnabled(&self) -> bool;
366
367        /// Setter for [`isEnabled`][Self::isEnabled].
368        #[unsafe(method(setEnabled:))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn setEnabled(&self, enabled: bool);
371
372        #[cfg(feature = "UIImage")]
373        #[unsafe(method(backgroundImage))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn backgroundImage(&self) -> Option<Retained<UIImage>>;
376
377        #[cfg(feature = "UIImage")]
378        /// Setter for [`backgroundImage`][Self::backgroundImage].
379        #[unsafe(method(setBackgroundImage:))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn setBackgroundImage(&self, background_image: Option<&UIImage>);
382
383        #[cfg(feature = "UIImage")]
384        #[unsafe(method(scopeBarBackgroundImage))]
385        #[unsafe(method_family = none)]
386        pub unsafe fn scopeBarBackgroundImage(&self) -> Option<Retained<UIImage>>;
387
388        #[cfg(feature = "UIImage")]
389        /// Setter for [`scopeBarBackgroundImage`][Self::scopeBarBackgroundImage].
390        #[unsafe(method(setScopeBarBackgroundImage:))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn setScopeBarBackgroundImage(
393            &self,
394            scope_bar_background_image: Option<&UIImage>,
395        );
396
397        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
398        #[unsafe(method(setBackgroundImage:forBarPosition:barMetrics:))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn setBackgroundImage_forBarPosition_barMetrics(
401            &self,
402            background_image: Option<&UIImage>,
403            bar_position: UIBarPosition,
404            bar_metrics: UIBarMetrics,
405        );
406
407        #[cfg(all(feature = "UIBarCommon", feature = "UIImage"))]
408        #[unsafe(method(backgroundImageForBarPosition:barMetrics:))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn backgroundImageForBarPosition_barMetrics(
411            &self,
412            bar_position: UIBarPosition,
413            bar_metrics: UIBarMetrics,
414        ) -> Option<Retained<UIImage>>;
415
416        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
417        #[unsafe(method(setSearchFieldBackgroundImage:forState:))]
418        #[unsafe(method_family = none)]
419        pub unsafe fn setSearchFieldBackgroundImage_forState(
420            &self,
421            background_image: Option<&UIImage>,
422            state: UIControlState,
423        );
424
425        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
426        #[unsafe(method(searchFieldBackgroundImageForState:))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn searchFieldBackgroundImageForState(
429            &self,
430            state: UIControlState,
431        ) -> Option<Retained<UIImage>>;
432
433        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
434        #[unsafe(method(setImage:forSearchBarIcon:state:))]
435        #[unsafe(method_family = none)]
436        pub unsafe fn setImage_forSearchBarIcon_state(
437            &self,
438            icon_image: Option<&UIImage>,
439            icon: UISearchBarIcon,
440            state: UIControlState,
441        );
442
443        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
444        #[unsafe(method(imageForSearchBarIcon:state:))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn imageForSearchBarIcon_state(
447            &self,
448            icon: UISearchBarIcon,
449            state: UIControlState,
450        ) -> Option<Retained<UIImage>>;
451
452        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
453        #[unsafe(method(setScopeBarButtonBackgroundImage:forState:))]
454        #[unsafe(method_family = none)]
455        pub unsafe fn setScopeBarButtonBackgroundImage_forState(
456            &self,
457            background_image: Option<&UIImage>,
458            state: UIControlState,
459        );
460
461        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
462        #[unsafe(method(scopeBarButtonBackgroundImageForState:))]
463        #[unsafe(method_family = none)]
464        pub unsafe fn scopeBarButtonBackgroundImageForState(
465            &self,
466            state: UIControlState,
467        ) -> Option<Retained<UIImage>>;
468
469        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
470        #[unsafe(method(setScopeBarButtonDividerImage:forLeftSegmentState:rightSegmentState:))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn setScopeBarButtonDividerImage_forLeftSegmentState_rightSegmentState(
473            &self,
474            divider_image: Option<&UIImage>,
475            left_state: UIControlState,
476            right_state: UIControlState,
477        );
478
479        #[cfg(all(feature = "UIControl", feature = "UIImage"))]
480        #[unsafe(method(scopeBarButtonDividerImageForLeftSegmentState:rightSegmentState:))]
481        #[unsafe(method_family = none)]
482        pub unsafe fn scopeBarButtonDividerImageForLeftSegmentState_rightSegmentState(
483            &self,
484            left_state: UIControlState,
485            right_state: UIControlState,
486        ) -> Option<Retained<UIImage>>;
487
488        #[cfg(feature = "UIControl")]
489        #[unsafe(method(setScopeBarButtonTitleTextAttributes:forState:))]
490        #[unsafe(method_family = none)]
491        pub unsafe fn setScopeBarButtonTitleTextAttributes_forState(
492            &self,
493            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
494            state: UIControlState,
495        );
496
497        #[cfg(feature = "UIControl")]
498        #[unsafe(method(scopeBarButtonTitleTextAttributesForState:))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn scopeBarButtonTitleTextAttributesForState(
501            &self,
502            state: UIControlState,
503        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
504
505        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
506        #[unsafe(method(searchFieldBackgroundPositionAdjustment))]
507        #[unsafe(method_family = none)]
508        pub unsafe fn searchFieldBackgroundPositionAdjustment(&self) -> UIOffset;
509
510        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
511        /// Setter for [`searchFieldBackgroundPositionAdjustment`][Self::searchFieldBackgroundPositionAdjustment].
512        #[unsafe(method(setSearchFieldBackgroundPositionAdjustment:))]
513        #[unsafe(method_family = none)]
514        pub unsafe fn setSearchFieldBackgroundPositionAdjustment(
515            &self,
516            search_field_background_position_adjustment: UIOffset,
517        );
518
519        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
520        #[unsafe(method(searchTextPositionAdjustment))]
521        #[unsafe(method_family = none)]
522        pub unsafe fn searchTextPositionAdjustment(&self) -> UIOffset;
523
524        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
525        /// Setter for [`searchTextPositionAdjustment`][Self::searchTextPositionAdjustment].
526        #[unsafe(method(setSearchTextPositionAdjustment:))]
527        #[unsafe(method_family = none)]
528        pub unsafe fn setSearchTextPositionAdjustment(
529            &self,
530            search_text_position_adjustment: UIOffset,
531        );
532
533        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
534        #[unsafe(method(setPositionAdjustment:forSearchBarIcon:))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn setPositionAdjustment_forSearchBarIcon(
537            &self,
538            adjustment: UIOffset,
539            icon: UISearchBarIcon,
540        );
541
542        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
543        #[unsafe(method(positionAdjustmentForSearchBarIcon:))]
544        #[unsafe(method_family = none)]
545        pub unsafe fn positionAdjustmentForSearchBarIcon(&self, icon: UISearchBarIcon) -> UIOffset;
546
547        #[unsafe(method(isLookToDictateEnabled))]
548        #[unsafe(method_family = none)]
549        pub unsafe fn isLookToDictateEnabled(&self) -> bool;
550
551        /// Setter for [`isLookToDictateEnabled`][Self::isLookToDictateEnabled].
552        #[unsafe(method(setLookToDictateEnabled:))]
553        #[unsafe(method_family = none)]
554        pub unsafe fn setLookToDictateEnabled(&self, look_to_dictate_enabled: bool);
555    );
556}
557
558/// Methods declared on superclass `NSObject`.
559#[cfg(all(feature = "UIResponder", feature = "UIView"))]
560impl UISearchBar {
561    extern_methods!(
562        #[unsafe(method(new))]
563        #[unsafe(method_family = new)]
564        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
565    );
566}
567
568extern_protocol!(
569    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchbardelegate?language=objc)
570    #[cfg(feature = "UIBarCommon")]
571    pub unsafe trait UISearchBarDelegate: UIBarPositioningDelegate + MainThreadOnly {
572        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
573        #[optional]
574        #[unsafe(method(searchBarShouldBeginEditing:))]
575        #[unsafe(method_family = none)]
576        unsafe fn searchBarShouldBeginEditing(&self, search_bar: &UISearchBar) -> bool;
577
578        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
579        #[optional]
580        #[unsafe(method(searchBarTextDidBeginEditing:))]
581        #[unsafe(method_family = none)]
582        unsafe fn searchBarTextDidBeginEditing(&self, search_bar: &UISearchBar);
583
584        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
585        #[optional]
586        #[unsafe(method(searchBarShouldEndEditing:))]
587        #[unsafe(method_family = none)]
588        unsafe fn searchBarShouldEndEditing(&self, search_bar: &UISearchBar) -> bool;
589
590        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
591        #[optional]
592        #[unsafe(method(searchBarTextDidEndEditing:))]
593        #[unsafe(method_family = none)]
594        unsafe fn searchBarTextDidEndEditing(&self, search_bar: &UISearchBar);
595
596        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
597        #[optional]
598        #[unsafe(method(searchBar:textDidChange:))]
599        #[unsafe(method_family = none)]
600        unsafe fn searchBar_textDidChange(&self, search_bar: &UISearchBar, search_text: &NSString);
601
602        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
603        #[optional]
604        #[unsafe(method(searchBar:shouldChangeTextInRange:replacementText:))]
605        #[unsafe(method_family = none)]
606        unsafe fn searchBar_shouldChangeTextInRange_replacementText(
607            &self,
608            search_bar: &UISearchBar,
609            range: NSRange,
610            text: &NSString,
611        ) -> bool;
612
613        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
614        #[optional]
615        #[unsafe(method(searchBarSearchButtonClicked:))]
616        #[unsafe(method_family = none)]
617        unsafe fn searchBarSearchButtonClicked(&self, search_bar: &UISearchBar);
618
619        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
620        #[optional]
621        #[unsafe(method(searchBarBookmarkButtonClicked:))]
622        #[unsafe(method_family = none)]
623        unsafe fn searchBarBookmarkButtonClicked(&self, search_bar: &UISearchBar);
624
625        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
626        #[optional]
627        #[unsafe(method(searchBarCancelButtonClicked:))]
628        #[unsafe(method_family = none)]
629        unsafe fn searchBarCancelButtonClicked(&self, search_bar: &UISearchBar);
630
631        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
632        #[optional]
633        #[unsafe(method(searchBarResultsListButtonClicked:))]
634        #[unsafe(method_family = none)]
635        unsafe fn searchBarResultsListButtonClicked(&self, search_bar: &UISearchBar);
636
637        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
638        #[optional]
639        #[unsafe(method(searchBar:selectedScopeButtonIndexDidChange:))]
640        #[unsafe(method_family = none)]
641        unsafe fn searchBar_selectedScopeButtonIndexDidChange(
642            &self,
643            search_bar: &UISearchBar,
644            selected_scope: NSInteger,
645        );
646    }
647);